From c4c6610bf7314cc4c6ecf656bef341e2d1ca1587 Mon Sep 17 00:00:00 2001 From: Matei Albu Date: Mon, 19 Dec 2016 16:54:52 +0100 Subject: [PATCH] Add --ssh-option to salt-ssh --ssh-option can be used to pass -o options to the ssh client. (cherry picked from commit 16f21e5) Add spaces around = Fix salt-ssh err when -ssh-option is missing --- salt/client/ssh/__init__.py | 7 ++++++- salt/client/ssh/shell.py | 19 ++++++++++++++++--- salt/utils/parsers.py | 18 +++++++++++++----- 3 files changed, 35 insertions(+), 9 deletions(-) diff --git a/salt/client/ssh/__init__.py b/salt/client/ssh/__init__.py index 23ec948fe0..bbef9d8de1 100644 --- a/salt/client/ssh/__init__.py +++ b/salt/client/ssh/__init__.py @@ -295,6 +295,9 @@ class SSH(object): 'remote_port_forwards': self.opts.get( 'ssh_remote_port_forwards' ), + 'ssh_options': self.opts.get( + 'ssh_options' + ) } if self.opts.get('rand_thin_dir'): self.defaults['thin_dir'] = os.path.join( @@ -693,6 +696,7 @@ class Single(object): identities_only=False, sudo_user=None, remote_port_forwards=None, + ssh_options=None, **kwargs): # Get mine setting and mine_functions if defined in kwargs (from roster) self.mine = mine @@ -749,7 +753,8 @@ class Single(object): 'mods': self.mods, 'identities_only': identities_only, 'sudo_user': sudo_user, - 'remote_port_forwards': remote_port_forwards} + 'remote_port_forwards': remote_port_forwards, + 'ssh_options': ssh_options} # Pre apply changeable defaults self.minion_opts = { 'grains_cache': True, diff --git a/salt/client/ssh/shell.py b/salt/client/ssh/shell.py index f78cb623e1..613660fe34 100644 --- a/salt/client/ssh/shell.py +++ b/salt/client/ssh/shell.py @@ -64,7 +64,8 @@ class Shell(object): mods=None, identities_only=False, sudo_user=None, - remote_port_forwards=None): + remote_port_forwards=None, + ssh_options=None): self.opts = opts # ssh , but scp [