mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +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
|
The main function for salt-cloud
|
||||||
'''
|
'''
|
||||||
|
# Define 'salt' global so we may use it after ImportError. Otherwise,
|
||||||
|
# UnboundLocalError will be raised.
|
||||||
|
global salt
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Late-imports for CLI performance
|
# Late-imports for CLI performance
|
||||||
import salt.cloud
|
import salt.cloud
|
||||||
import salt.cloud.cli
|
import salt.cloud.cli
|
||||||
has_saltcloud = True
|
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
log.error("Error importing salt cloud {0}".format(e))
|
|
||||||
# No salt cloud on Windows
|
# No salt cloud on Windows
|
||||||
has_saltcloud = False
|
log.error("Error importing salt cloud {0}".format(e))
|
||||||
if '' in sys.path:
|
|
||||||
sys.path.remove('')
|
|
||||||
|
|
||||||
if not has_saltcloud:
|
|
||||||
print('salt-cloud is not available in this system')
|
print('salt-cloud is not available in this system')
|
||||||
sys.exit(salt.defaults.exitcodes.EX_UNAVAILABLE)
|
sys.exit(salt.defaults.exitcodes.EX_UNAVAILABLE)
|
||||||
|
if '' in sys.path:
|
||||||
|
sys.path.remove('')
|
||||||
|
|
||||||
client = salt.cloud.cli.SaltCloud()
|
client = salt.cloud.cli.SaltCloud()
|
||||||
_install_signal_handlers(client)
|
_install_signal_handlers(client)
|
||||||
|
Loading…
Reference in New Issue
Block a user