mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
Merge pull request #39555 from sergeizv/fix-unbound-local-error
Fix UnboundLocalError
This commit is contained in:
commit
b004d4513d
@ -430,21 +430,21 @@ def salt_cloud():
|
||||
'''
|
||||
The main function for salt-cloud
|
||||
'''
|
||||
# Define 'salt' global so we may use it after ImportError. Otherwise,
|
||||
# UnboundLocalError will be raised.
|
||||
global salt
|
||||
|
||||
try:
|
||||
# Late-imports for CLI performance
|
||||
import salt.cloud
|
||||
import salt.cloud.cli
|
||||
has_saltcloud = True
|
||||
except ImportError as e:
|
||||
log.error("Error importing salt cloud {0}".format(e))
|
||||
# No salt cloud on Windows
|
||||
has_saltcloud = False
|
||||
if '' in sys.path:
|
||||
sys.path.remove('')
|
||||
|
||||
if not has_saltcloud:
|
||||
log.error("Error importing salt cloud {0}".format(e))
|
||||
print('salt-cloud is not available in this system')
|
||||
sys.exit(salt.defaults.exitcodes.EX_UNAVAILABLE)
|
||||
if '' in sys.path:
|
||||
sys.path.remove('')
|
||||
|
||||
client = salt.cloud.cli.SaltCloud()
|
||||
_install_signal_handlers(client)
|
||||
|
Loading…
Reference in New Issue
Block a user