Skip to content

Commit 5ed7ae3

Browse files
committed
remove ray
1 parent 6934a74 commit 5ed7ae3

File tree

1 file changed

+1
-44
lines changed

1 file changed

+1
-44
lines changed

app/Helpers/SshMultiplexingHelper.php

Lines changed: 1 addition & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,9 @@ public static function serverSshConfiguration(Server $server)
2424
public static function ensureMultiplexedConnection(Server $server)
2525
{
2626
if (! self::isMultiplexingEnabled()) {
27-
ray('SSH Multiplexing: DISABLED')->red();
2827
return;
2928
}
3029

31-
ray('SSH Multiplexing: ENABLED')->green();
32-
ray('Ensuring multiplexed connection for server:', $server);
33-
3430
$sshConfig = self::serverSshConfiguration($server);
3531
$muxSocket = $sshConfig['muxFilename'];
3632
$sshKeyLocation = $sshConfig['sshKeyLocation'];
@@ -41,15 +37,10 @@ public static function ensureMultiplexedConnection(Server $server)
4137
if (data_get($server, 'settings.is_cloudflare_tunnel')) {
4238
$checkCommand = 'cloudflared access ssh --hostname %h -O check -o ControlPath=' . $muxSocket . ' ' . $server->user . '@' . $server->ip;
4339
}
44-
ray('Check Command:', $checkCommand);
4540
$process = Process::run($checkCommand);
4641

4742
if ($process->exitCode() !== 0) {
48-
ray('SSH Multiplexing: Existing connection check failed or not found')->orange();
49-
ray('Establishing new connection');
5043
self::establishNewMultiplexedConnection($server);
51-
} else {
52-
ray('SSH Multiplexing: Existing connection is valid')->green();
5344
}
5445
}
5546

@@ -59,10 +50,6 @@ public static function establishNewMultiplexedConnection(Server $server)
5950
$sshKeyLocation = $sshConfig['sshKeyLocation'];
6051
$muxSocket = $sshConfig['muxFilename'];
6152

62-
ray('Establishing new multiplexed connection')->blue();
63-
ray('SSH Key Location:', $sshKeyLocation);
64-
ray('Mux Socket:', $muxSocket);
65-
6653
$connectionTimeout = config('constants.ssh.connection_timeout');
6754
$serverInterval = config('constants.ssh.server_interval');
6855
$muxPersistTime = config('constants.ssh.mux_persist_time');
@@ -75,25 +62,11 @@ public static function establishNewMultiplexedConnection(Server $server)
7562
$establishCommand = 'cloudflared access ssh --hostname %h -fNM -o ControlMaster=auto -o ControlPath=' . $muxSocket . ' -o ControlPersist=' . $muxPersistTime . ' ' . self::getCommonSshOptions($server, $sshKeyLocation, $connectionTimeout, $serverInterval) . $server->user . '@' . $server->ip;
7663
}
7764

78-
ray('Establish Command:', $establishCommand);
79-
8065
$establishProcess = Process::run($establishCommand);
8166

82-
ray('Establish Process Exit Code:', $establishProcess->exitCode());
83-
ray('Establish Process Output:', $establishProcess->output());
84-
ray('Establish Process Error Output:', $establishProcess->errorOutput());
85-
8667
if ($establishProcess->exitCode() !== 0) {
87-
ray('Failed to establish multiplexed connection')->red();
8868
throw new \RuntimeException('Failed to establish multiplexed connection: '.$establishProcess->errorOutput());
8969
}
90-
91-
ray('Successfully established multiplexed connection')->green();
92-
93-
// Check if the mux socket file was created
94-
if (! file_exists($muxSocket)) {
95-
ray('Mux socket file not found after connection establishment')->orange();
96-
}
9770
}
9871

9972
public static function removeMuxFile(Server $server)
@@ -105,19 +78,7 @@ public static function removeMuxFile(Server $server)
10578
if (data_get($server, 'settings.is_cloudflare_tunnel')) {
10679
$closeCommand = 'cloudflared access ssh --hostname %h -O exit -o ControlPath=' . $muxSocket . ' ' . $server->user . '@' . $server->ip;
10780
}
108-
$process = Process::run($closeCommand);
109-
110-
ray('Closing multiplexed connection')->blue();
111-
ray('Close command:', $closeCommand);
112-
ray('Close process exit code:', $process->exitCode());
113-
ray('Close process output:', $process->output());
114-
ray('Close process error output:', $process->errorOutput());
115-
116-
if ($process->exitCode() !== 0) {
117-
ray('Failed to close multiplexed connection')->orange();
118-
} else {
119-
ray('Successfully closed multiplexed connection')->green();
120-
}
81+
Process::run($closeCommand);
12182
}
12283

12384
public static function generateScpCommand(Server $server, string $source, string $dest)
@@ -143,8 +104,6 @@ public static function generateScpCommand(Server $server, string $source, string
143104
$scp_command .= self::getCommonSshOptions($server, $sshKeyLocation, config('constants.ssh.connection_timeout'), config('constants.ssh.server_interval'), isScp: true);
144105
$scp_command .= "{$source} {$server->user}@{$server->ip}:{$dest}";
145106

146-
ray('SCP Command:', $scp_command);
147-
148107
return $scp_command;
149108
}
150109

@@ -182,8 +141,6 @@ public static function generateSshCommand(Server $server, string $command)
182141
.$command.PHP_EOL
183142
.$delimiter;
184143

185-
ray('SSH Command:', $ssh_command);
186-
187144
return $ssh_command;
188145
}
189146

0 commit comments

Comments
 (0)