From 8d1450cc47e0faf867847fd88a387602f3d765c5 Mon Sep 17 00:00:00 2001 From: Bo Maryniuk Date: Mon, 24 Oct 2016 15:23:48 +0200 Subject: [PATCH 1/3] Fix PEP8 --- salt/client/ssh/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/salt/client/ssh/__init__.py b/salt/client/ssh/__init__.py index f08eb1b579..151ffad2e7 100644 --- a/salt/client/ssh/__init__.py +++ b/salt/client/ssh/__init__.py @@ -215,7 +215,7 @@ class SSH(object): raise salt.exceptions.SaltSystemExit('No ssh binary found in path -- ssh must be installed for salt-ssh to run. Exiting.') self.opts['_ssh_version'] = ssh_version() self.tgt_type = self.opts['selected_target_option'] \ - if self.opts['selected_target_option'] else 'glob' + if self.opts['selected_target_option'] else 'glob' self.roster = salt.roster.Roster(opts, opts.get('roster', 'flat')) self.targets = self.roster.targets( self.opts['tgt'], From 372f2bbd93887cf4865a848fe14fb04265d46c86 Mon Sep 17 00:00:00 2001 From: Bo Maryniuk Date: Mon, 24 Oct 2016 15:24:09 +0200 Subject: [PATCH 2/3] Do not restart the whole thing if roster is not around --- salt/client/ssh/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/salt/client/ssh/__init__.py b/salt/client/ssh/__init__.py index 151ffad2e7..86834a1eb4 100644 --- a/salt/client/ssh/__init__.py +++ b/salt/client/ssh/__init__.py @@ -430,9 +430,10 @@ class SSH(object): returned = set() rets = set() init = False - if not self.targets: - raise salt.exceptions.SaltClientError('No matching targets found in roster.') while True: + if not self.targets: + log.error('No matching targets found in roster.') + break if len(running) < self.opts.get('ssh_max_procs', 25) and not init: try: host = next(target_iter) From 28edda457e6eb77c4c6ac999d9adaee398ab3fb9 Mon Sep 17 00:00:00 2001 From: Bo Maryniuk Date: Mon, 24 Oct 2016 15:24:52 +0200 Subject: [PATCH 3/3] Do not prematurily raise an exception, let the main loop take care of it instead --- salt/roster/__init__.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/salt/roster/__init__.py b/salt/roster/__init__.py index 37dc18dcd5..77ef61b29d 100644 --- a/salt/roster/__init__.py +++ b/salt/roster/__init__.py @@ -82,12 +82,5 @@ class Roster(object): except IOError as exc: pass - if not targets: - raise salt.exceptions.SaltSystemExit( - 'No hosts found with target {0} of type {1}'.format( - tgt, - tgt_type) - ) - log.debug('Matched minions: {0}'.format(targets)) return targets