Merge pull request #37178 from isbm/isbm-fix-saltapi-ssh-crash

Fix Salt-API ssh crash
This commit is contained in:
Mike Place 2016-10-25 13:51:50 +09:00 committed by GitHub
commit d608465d77
2 changed files with 4 additions and 10 deletions

View File

@ -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)

View File

@ -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