Provide clear error message after failure (#32928)

This commit is contained in:
Abhijeet Kasurde 2017-11-16 06:42:27 +00:00 committed by GitHub
parent 2d4c4e09db
commit e61bcc3438
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 71 additions and 1 deletions

View file

@ -1580,8 +1580,9 @@ def main():
# VM doesn't exist
else:
if module.params['state'] in ['poweredon', 'poweredoff', 'present', 'restarted', 'suspended']:
# Create it ...
result = pyv.deploy_vm()
if result['failed']:
module.fail_json(msg='Failed to create a virtual machine : %s' % result['msg'])
if result['failed']:
module.fail_json(**result)