File 0024-Fix-open-ssh-bsc-1004723-upstream-issue-36966.patch of Package salt.4202

From 403159ff43045cb6c24a68da15dabc517adc706f Mon Sep 17 00:00:00 2001
From: Bo Maryniuk <bo@suse.de>
Date: Mon, 24 Oct 2016 15:23:48 +0200
Subject: [PATCH 24/38] Fix open-ssh bsc#1004723 (upstream issue 36966)

* Do not restart the whole thing if roster is not around
* Do not prematurily raise an exception, let the main loop take care of it instead
* Fix PEP8
---
 salt/client/ssh/__init__.py | 7 ++++---
 salt/roster/__init__.py     | 7 -------
 2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/salt/client/ssh/__init__.py b/salt/client/ssh/__init__.py
index c4b6934..a5e8199 100644
--- a/salt/client/ssh/__init__.py
+++ b/salt/client/ssh/__init__.py
@@ -179,7 +179,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'],
@@ -385,9 +385,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)
diff --git a/salt/roster/__init__.py b/salt/roster/__init__.py
index 37dc18d..77ef61b 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
-- 
2.10.2

openSUSE Build Service is sponsored by