make virt module command= work again - better error handling should be in its
future
This commit is contained in:
parent
5963f6afe2
commit
c49004f2ef
1 changed files with 3 additions and 2 deletions
5
virt
5
virt
|
@ -312,6 +312,7 @@ def core(module):
|
|||
v = Virt()
|
||||
res = {}
|
||||
|
||||
|
||||
if state:
|
||||
if not guest:
|
||||
module.fail_json(msg = "state change requires a guest specified")
|
||||
|
@ -337,13 +338,13 @@ def core(module):
|
|||
res = getattr(v, command)(guest)
|
||||
if type(res) != dict:
|
||||
res = { command: res }
|
||||
return rc, res
|
||||
return VIRT_SUCCESS, res
|
||||
|
||||
elif hasattr(v, command):
|
||||
res = getattr(v, command)()
|
||||
if type(res) != dict:
|
||||
res = { command: res }
|
||||
return rc, res
|
||||
return VIRT_SUCCESS, res
|
||||
|
||||
else:
|
||||
module.fail_json(msg="Command %s not recognized" % basecmd)
|
||||
|
|
Loading…
Reference in a new issue