for example, to re-use with an scp command.

Signed-off-by: Fabian Grünbichler <f.gruenbich...@proxmox.com>
---
this is used by pve-storage, versioned dependency needed accordingly.

 src/PVE/SSHInfo.pm | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/PVE/SSHInfo.pm b/src/PVE/SSHInfo.pm
index fad23bf..a26ae31 100644
--- a/src/PVE/SSHInfo.pm
+++ b/src/PVE/SSHInfo.pm
@@ -47,7 +47,7 @@ sub get_ssh_info {
     };
 }
 
-sub ssh_info_to_command_base {
+sub ssh_info_to_ssh_opts {
     my ($info, @extra_options) = @_;
 
     my $nodename = $info->{name};
@@ -62,8 +62,6 @@ sub ssh_info_to_command_base {
     } 
 
     return [
-       '/usr/bin/ssh',
-       '-e', 'none',
        '-o', 'BatchMode=yes',
        '-o', 'HostKeyAlias='.$nodename,
        defined($known_hosts_options) ? @$known_hosts_options : (),
@@ -71,6 +69,18 @@ sub ssh_info_to_command_base {
     ];
 }
 
+sub ssh_info_to_command_base {
+    my ($info, @extra_options) = @_;
+
+    my $opts = ssh_info_to_ssh_opts($info, @extra_options);
+
+    return [
+       '/usr/bin/ssh',
+       '-e', 'none', # only works for ssh, not scp!
+       $opts->@*,
+    ];
+}
+
 sub ssh_info_to_command {
     my ($info, @extra_options) = @_;
     my $cmd = ssh_info_to_command_base($info, @extra_options);
-- 
2.39.2



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to