Modernize the salt-cloud script

This commit is contained in:
Thomas S Hatch 2013-11-08 14:11:27 -07:00
parent 99bbf9ea9a
commit 5de4e73d4d
2 changed files with 19 additions and 11 deletions

View File

@ -10,6 +10,7 @@ import sys
# Import salt libs
import salt
import salt.cli
import salt.cloud.cli
def salt_master():
@ -105,6 +106,19 @@ def salt_ssh():
raise SystemExit('\nExiting gracefully on Ctrl-c')
def salt_cloud():
'''
The main function for salt-cloud
'''
if '' in sys.path:
sys.path.remove('')
try:
cloud = salt.cloud.cli.SaltCloud()
cloud.run()
except KeyboardInterrupt:
raise SystemExit('\nExiting gracefully on Ctrl-c')
def salt_main():
'''
Publish commands to the salt system from the command line on the

View File

@ -1,16 +1,10 @@
#!/usr/bin/env python
'''
Publish commands to the salt system from the command line on the master.
'''
import salt.cloud.cli
from salt.scripts import salt_cloud
def main():
'''
The main function for salt-cloud
'''
cloud = salt.cloud.cli.SaltCloud()
cloud.run()
if __name__ == '__main__':
try:
main()
except KeyboardInterrupt:
raise SystemExit('\nExiting gracefully on Ctrl-c')
salt_cloud()