mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
vcenter_license: Fix fail_json call (#53933)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
parent
50d56ca89d
commit
866f934044
1 changed files with 2 additions and 2 deletions
|
@ -196,13 +196,13 @@ def main():
|
||||||
try:
|
try:
|
||||||
assigned_license = lam.QueryAssignedLicenses(entityId=entityId)
|
assigned_license = lam.QueryAssignedLicenses(entityId=entityId)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json('Could not query vCenter "%s" assigned license info due to %s.' % (entityId, to_native(e)))
|
module.fail_json(msg='Could not query vCenter "%s" assigned license info due to %s.' % (entityId, to_native(e)))
|
||||||
|
|
||||||
if not assigned_license or (len(assigned_license) != 0 and assigned_license[0].assignedLicense.licenseKey != license):
|
if not assigned_license or (len(assigned_license) != 0 and assigned_license[0].assignedLicense.licenseKey != license):
|
||||||
try:
|
try:
|
||||||
lam.UpdateAssignedLicense(entity=entityId, licenseKey=license)
|
lam.UpdateAssignedLicense(entity=entityId, licenseKey=license)
|
||||||
except Exception:
|
except Exception:
|
||||||
module.fail_json('Could not assign "%s" (%s) to vCenter.' % (license, key.name))
|
module.fail_json(msg='Could not assign "%s" (%s) to vCenter.' % (license, key.name))
|
||||||
result['changed'] = True
|
result['changed'] = True
|
||||||
result['licenses'] = pyv.list_keys(lm.licenses)
|
result['licenses'] = pyv.list_keys(lm.licenses)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue