mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 00:55:19 +00:00
parent
823f0ce350
commit
f91edf3a33
@ -1632,11 +1632,18 @@ class Map(Cloud):
|
||||
for alias, drivers in query_map.items():
|
||||
for driver, vms in drivers.items():
|
||||
for vm_name, vm_details in vms.items():
|
||||
if (vm_details != 'Absent') and \
|
||||
(
|
||||
vm_details['state'].lower() in
|
||||
matching_states[action]
|
||||
):
|
||||
# Only certain actions are support in to use in this case. Those actions are the
|
||||
# "Global" salt-cloud actions defined in the "matching_states" dictionary above.
|
||||
# If a more specific action is passed in, we shouldn't stack-trace - exit gracefully.
|
||||
try:
|
||||
state_action = matching_states[action]
|
||||
except KeyError:
|
||||
log.error(
|
||||
'The use of \'{0}\' as an action is not supported in this context. '
|
||||
'Only \'start\', \'stop\', and \'reboot\' are supported options.'.format(action)
|
||||
)
|
||||
raise SaltCloudException()
|
||||
if (vm_details != 'Absent') and (vm_details['state'].lower() in state_action):
|
||||
vm_names.append(vm_name)
|
||||
return vm_names
|
||||
|
||||
|
@ -195,7 +195,10 @@ class SaltCloud(parsers.SaltCloudParser):
|
||||
self.config.get('map', None)):
|
||||
if self.config.get('map', None):
|
||||
log.info('Applying map from {0!r}.'.format(self.config['map']))
|
||||
names = mapper.get_vmnames_by_action(self.options.action)
|
||||
try:
|
||||
names = mapper.get_vmnames_by_action(self.options.action)
|
||||
except SaltCloudException:
|
||||
return []
|
||||
else:
|
||||
names = self.config.get('names', None)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user