feat: Include feedback

This commit is contained in:
Samori Gorse 2025-01-05 16:58:01 +01:00
parent e3faa8f29e
commit 372f6e41ff

View file

@ -48,7 +48,7 @@ options:
vm_uid: vm_uid:
description: description:
- UID of the target Virtual Machine. Required when O(state=absent), O(state=started), O(state=stopped) or - UID of the target Virtual Machine. Required when O(state=absent), O(state=started), O(state=stopped) or
O(state=restarted) O(state=restarted).
type: str type: str
label: label:
description: Label of the Virtual Machine to create, can be used when O(state=present). description: Label of the Virtual Machine to create, can be used when O(state=present).
@ -59,7 +59,7 @@ options:
template: template:
description: description:
- UID of a template to create Virtual Machine from. - UID of a template to create Virtual Machine from.
- Muse be provided when O(state=present) - Muse be provided when O(state=present).
type: str type: str
boot_after_create: boot_after_create:
description: Boot Virtual Machine after creation, can be used when O(state=present). description: Boot Virtual Machine after creation, can be used when O(state=present).
@ -172,9 +172,9 @@ class XenOrchestra(object):
def call(self, method, params): def call(self, method, params):
'''Calls a method on the XO server with the provided parameters.''' '''Calls a method on the XO server with the provided parameters.'''
id = self.pointer pointer = self.pointer
self.conn.send(json.dumps({ self.conn.send(json.dumps({
'id': id, 'id': pointer,
'jsonrpc': '2.0', 'jsonrpc': '2.0',
'method': method, 'method': method,
'params': params 'params': params
@ -183,7 +183,7 @@ class XenOrchestra(object):
waited = 0 waited = 0
while waited < self.CALL_TIMEOUT: while waited < self.CALL_TIMEOUT:
response = json.loads(self.conn.recv()) response = json.loads(self.conn.recv())
if 'id' in response and response['id'] == id: if response.get('id') == pointer:
return response return response
else: else:
sleep(0.1) sleep(0.1)
@ -319,7 +319,7 @@ def main():
if state == 'present': if state == 'present':
result = xen_orchestra.create_vm() result = xen_orchestra.create_vm()
module.exit_json(changed=True, vm_uid=result) module.exit_json(changed=False, vm_uid=result)
if __name__ == '__main__': if __name__ == '__main__':