mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #28117 from rallytime/fix-23655
Clean up stacktrace when master can't be reached in lxc cloud driver
This commit is contained in:
commit
9cdb970289
2 changed files with 6 additions and 7 deletions
|
@ -86,6 +86,8 @@ class SaltCloud(parsers.SaltCloudParser):
|
|||
log.info('salt-cloud starting')
|
||||
try:
|
||||
mapper = salt.cloud.Map(self.config)
|
||||
except SaltCloudSystemExit as exc:
|
||||
self.handle_exception(exc.args, exc)
|
||||
except SaltCloudException as exc:
|
||||
msg = 'There was an error generating the mapper.'
|
||||
self.handle_exception(msg, exc)
|
||||
|
@ -366,7 +368,7 @@ class SaltCloud(parsers.SaltCloudParser):
|
|||
|
||||
def handle_exception(self, msg, exc):
|
||||
if isinstance(exc, SaltCloudException):
|
||||
# It's a know exception an we know own to handle it
|
||||
# It's a known exception and we know how to handle it
|
||||
if isinstance(exc, SaltCloudSystemExit):
|
||||
# This is a salt cloud system exit
|
||||
if exc.exit_code > 0:
|
||||
|
|
|
@ -530,13 +530,10 @@ def get_configured_provider(vm_=None):
|
|||
{}).get(dalias, {}).get(driver, {})
|
||||
# in all cases, verify that the linked saltmaster is alive.
|
||||
if data:
|
||||
try:
|
||||
ret = _salt('test.ping', salt_target=data['target'])
|
||||
if not ret:
|
||||
raise Exception('error')
|
||||
return data
|
||||
except Exception:
|
||||
ret = _salt('test.ping', salt_target=data['target'])
|
||||
if not ret:
|
||||
raise SaltCloudSystemExit(
|
||||
'Configured provider {0} minion: {1} is unreachable'.format(
|
||||
__active_provider_name__, data['target']))
|
||||
return data
|
||||
return False
|
||||
|
|
Loading…
Add table
Reference in a new issue