mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 14:22:46 +00:00
Fix incorrect use of is for comparisons.
See https://bugs.python.org/issue34850 for details.
This commit is contained in:
@@ -1378,7 +1378,7 @@ def core(module):
|
||||
|
||||
# Set VM Host
|
||||
vmhost = module.params.get('vmhost')
|
||||
if vmhost is not False and vmhost is not "False":
|
||||
if vmhost is not False and vmhost != "False":
|
||||
if r.setVMHost(vminfo['name'], vmhost) is False:
|
||||
return RHEV_FAILED, msg
|
||||
|
||||
|
||||
@@ -489,22 +489,22 @@ def core(module):
|
||||
module.fail_json(msg="state change requires a guest specified")
|
||||
|
||||
if state == 'running':
|
||||
if v.status(guest) is 'paused':
|
||||
if v.status(guest) == 'paused':
|
||||
res['changed'] = True
|
||||
res['msg'] = v.unpause(guest)
|
||||
elif v.status(guest) is not 'running':
|
||||
elif v.status(guest) != 'running':
|
||||
res['changed'] = True
|
||||
res['msg'] = v.start(guest)
|
||||
elif state == 'shutdown':
|
||||
if v.status(guest) is not 'shutdown':
|
||||
if v.status(guest) != 'shutdown':
|
||||
res['changed'] = True
|
||||
res['msg'] = v.shutdown(guest)
|
||||
elif state == 'destroyed':
|
||||
if v.status(guest) is not 'shutdown':
|
||||
if v.status(guest) != 'shutdown':
|
||||
res['changed'] = True
|
||||
res['msg'] = v.destroy(guest)
|
||||
elif state == 'paused':
|
||||
if v.status(guest) is 'running':
|
||||
if v.status(guest) == 'running':
|
||||
res['changed'] = True
|
||||
res['msg'] = v.pause(guest)
|
||||
else:
|
||||
|
||||
@@ -509,7 +509,7 @@ def core(module):
|
||||
|
||||
res['changed'] = False
|
||||
if state in ['active']:
|
||||
if v.status(name) is not 'active':
|
||||
if v.status(name) != 'active':
|
||||
res['changed'] = True
|
||||
res['msg'] = v.start(name)
|
||||
elif state in ['present']:
|
||||
@@ -523,13 +523,13 @@ def core(module):
|
||||
elif state in ['inactive']:
|
||||
entries = v.list_nets()
|
||||
if name in entries:
|
||||
if v.status(name) is not 'inactive':
|
||||
if v.status(name) != 'inactive':
|
||||
res['changed'] = True
|
||||
res['msg'] = v.destroy(name)
|
||||
elif state in ['undefined', 'absent']:
|
||||
entries = v.list_nets()
|
||||
if name in entries:
|
||||
if v.status(name) is not 'inactive':
|
||||
if v.status(name) != 'inactive':
|
||||
v.destroy(name)
|
||||
res['changed'] = True
|
||||
res['msg'] = v.undefine(name)
|
||||
|
||||
@@ -578,7 +578,7 @@ def core(module):
|
||||
|
||||
res['changed'] = False
|
||||
if state in ['active']:
|
||||
if v.status(name) is not 'active':
|
||||
if v.status(name) != 'active':
|
||||
res['changed'] = True
|
||||
res['msg'] = v.start(name)
|
||||
elif state in ['present']:
|
||||
@@ -592,20 +592,20 @@ def core(module):
|
||||
elif state in ['inactive']:
|
||||
entries = v.list_pools()
|
||||
if name in entries:
|
||||
if v.status(name) is not 'inactive':
|
||||
if v.status(name) != 'inactive':
|
||||
res['changed'] = True
|
||||
res['msg'] = v.destroy(name)
|
||||
elif state in ['undefined', 'absent']:
|
||||
entries = v.list_pools()
|
||||
if name in entries:
|
||||
if v.status(name) is not 'inactive':
|
||||
if v.status(name) != 'inactive':
|
||||
v.destroy(name)
|
||||
res['changed'] = True
|
||||
res['msg'] = v.undefine(name)
|
||||
elif state in ['deleted']:
|
||||
entries = v.list_pools()
|
||||
if name in entries:
|
||||
if v.status(name) is not 'inactive':
|
||||
if v.status(name) != 'inactive':
|
||||
v.destroy(name)
|
||||
v.delete(name, mode)
|
||||
res['changed'] = True
|
||||
|
||||
Reference in New Issue
Block a user