mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
cloudstack: cs_instance: fix userdata not up to date (#18942)
Fixes unnecessary VM restart. VM userdata is currently not returned by the API listVirtualMachine and task will always be marked as changed in has_changed(), which will result in an unnecessary VM restart if force=true. Reported by @Mayeu
This commit is contained in:
parent
1da20c9716
commit
345e39e1b1
1 changed files with 4 additions and 0 deletions
|
@ -533,6 +533,10 @@ class AnsibleCloudStackInstance(AnsibleCloudStack):
|
|||
if not vpc_id and self.is_vm_in_vpc(vm=v):
|
||||
continue
|
||||
if instance_name.lower() in [ v['name'].lower(), v['displayname'].lower(), v['id'] ]:
|
||||
# Query the user data if we need to
|
||||
if 'userdata' not in v and self.get_user_data() is not None:
|
||||
res = self.cs.getVirtualMachineUserData(virtualmachineid=v['id'])
|
||||
v['userdata'] = res['virtualmachineuserdata'].get('userdata',"")
|
||||
self.instance = v
|
||||
break
|
||||
return self.instance
|
||||
|
|
Loading…
Reference in a new issue