Step 3: Profit! (enable log-level from command line)

This commit is contained in:
Joseph Hall 2012-11-14 18:53:21 +00:00
parent 46e30a3a3b
commit 2e17b3855b
2 changed files with 11 additions and 4 deletions

View File

@ -117,6 +117,15 @@ class SaltCloud(object):
help=('Execute a query and return select information about ' help=('Execute a query and return select information about '
'the nodes running on configured cloud providers')) 'the nodes running on configured cloud providers'))
parser.add_option('-l',
'--log-level',
dest='log_level',
default='warn',
help=("Console logging log level. One of 'all', 'garbage',"
"'trace', 'debug', 'info', 'warning', 'error', 'quiet'."
"For the log file setting see the configuration file."
"Default: 'warning'."))
parser.add_option('--list-locations', parser.add_option('--list-locations',
dest='list_locations', dest='list_locations',
default=False, default=False,

View File

@ -110,10 +110,8 @@ def create(vm_):
print('Failed to start Salt on Cloud VM {0}'.format(vm_['name'])) print('Failed to start Salt on Cloud VM {0}'.format(vm_['name']))
log.warn('Failed to start Salt on Cloud VM {0}'.format(vm_['name'])) log.warn('Failed to start Salt on Cloud VM {0}'.format(vm_['name']))
print('Created Cloud VM {0} with the following values:'.format( print('Created Cloud VM {0} with the following values:'.format(vm_['name']))
log.warn('Created Cloud VM {0} with the following values:'.format( log.warn('Created Cloud VM {0} with the following values:'.format(vm_['name']))
vm_['name']
))
for key, val in data.__dict__.items(): for key, val in data.__dict__.items():
print(' {0}: {1}'.format(key, val)) print(' {0}: {1}'.format(key, val))
log.warn(' {0}: {1}'.format(key, val)) log.warn(' {0}: {1}'.format(key, val))