mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 11:21:25 -07:00
Cleaning up diffs after extras modules merge
This commit is contained in:
parent
2cfa25c930
commit
c65ba07d2c
126 changed files with 505 additions and 457 deletions
|
@ -53,7 +53,6 @@ options:
|
|||
state:
|
||||
description:
|
||||
- State of the instance.
|
||||
- C(restored) added in version 2.1.
|
||||
required: false
|
||||
default: 'present'
|
||||
choices: [ 'deployed', 'started', 'stopped', 'restarted', 'restored', 'destroyed', 'expunged', 'present', 'absent' ]
|
||||
|
@ -212,7 +211,7 @@ options:
|
|||
tags:
|
||||
description:
|
||||
- List of tags. Tags are a list of dictionaries having keys C(key) and C(value).
|
||||
- If you want to delete all tags, set a empty list e.g. C(tags: []).
|
||||
- "If you want to delete all tags, set a empty list e.g. C(tags: [])."
|
||||
required: false
|
||||
default: null
|
||||
aliases: [ 'tag' ]
|
||||
|
@ -899,12 +898,15 @@ class AnsibleCloudStackInstance(AnsibleCloudStack):
|
|||
|
||||
def restore_instance(self):
|
||||
instance = self.get_instance()
|
||||
|
||||
if not instance:
|
||||
instance = self.deploy_instance()
|
||||
return instance
|
||||
|
||||
self.result['changed'] = True
|
||||
# in check mode intance may not be instanciated
|
||||
if instance:
|
||||
args = {}
|
||||
args['templateid'] = self.get_template_or_iso(key='id')
|
||||
args['virtualmachineid'] = instance['id']
|
||||
res = self.cs.restoreVirtualMachine(**args)
|
||||
if 'errortext' in res:
|
||||
self.module.fail_json(msg="Failed: '%s'" % res['errortext'])
|
||||
|
||||
poll_async = self.module.params.get('poll_async')
|
||||
if poll_async:
|
||||
|
@ -963,7 +965,7 @@ def main():
|
|||
user_data = dict(default=None),
|
||||
zone = dict(default=None),
|
||||
ssh_key = dict(default=None),
|
||||
force = dict(choices=BOOLEANS, default=False),
|
||||
force = dict(type='bool', default=False),
|
||||
tags = dict(type='list', aliases=[ 'tag' ], default=None),
|
||||
vpc = dict(default=None),
|
||||
poll_async = dict(type='bool', default=True),
|
||||
|
@ -998,6 +1000,7 @@ def main():
|
|||
instance = acs_instance.expunge_instance()
|
||||
|
||||
elif state in ['restored']:
|
||||
acs_instance.present_instance()
|
||||
instance = acs_instance.restore_instance()
|
||||
|
||||
elif state in ['present', 'deployed']:
|
||||
|
@ -1020,7 +1023,7 @@ def main():
|
|||
|
||||
result = acs_instance.get_result(instance)
|
||||
|
||||
except CloudStackException, e:
|
||||
except CloudStackException as e:
|
||||
module.fail_json(msg='CloudStackException: %s' % str(e))
|
||||
|
||||
module.exit_json(**result)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue