Don't stacktrace on query return in ec2.create_snapshot

Fixes #24484
This commit is contained in:
rallytime 2015-08-12 13:15:02 -06:00
parent de00c181f8
commit 4975300591

View file

@ -3703,38 +3703,52 @@ def delete_keypair(kwargs=None, call=None):
def create_snapshot(kwargs=None, call=None, wait_to_finish=False):
'''
Create a snapshot
Create a snapshot.
volume_id
The ID of the Volume from which to create a snapshot.
description
The optional description of the snapshot.
CLI Exampe:
.. code-block:: bash
salt-cloud -f create_snapshot my-ec2-config volume_id=vol-351d8826
salt-cloud -f create_snapshot my-ec2-config volume_id=vol-351d8826 \\
description="My Snapshot Description"
'''
if call != 'function':
log.error(
raise SaltCloudSystemExit(
'The create_snapshot function must be called with -f '
'or --function.'
)
return False
if 'volume_id' not in kwargs:
log.error('A volume_id must be specified to create a snapshot.')
return False
if kwargs is None:
kwargs = {}
if 'description' not in kwargs:
kwargs['description'] = ''
volume_id = kwargs.get('volume_id', None)
description = kwargs.get('description', '')
params = {'Action': 'CreateSnapshot'}
if volume_id is None:
raise SaltCloudSystemExit(
'A volume_id must be specified to create a snapshot.'
)
if 'volume_id' in kwargs:
params['VolumeId'] = kwargs['volume_id']
if 'description' in kwargs:
params['Description'] = kwargs['description']
params = {'Action': 'CreateSnapshot',
'VolumeId': volume_id,
'Description': description}
log.debug(params)
data = aws.query(params,
return_url=True,
return_root=True,
location=get_location(),
provider=get_provider(),
opts=__opts__,
sigver='4')
sigver='4')[0]
r_data = {}
for d in data: