Commit fb1385bb by Andrew Resch

Replace CommandException with Exception

parent e0c4c51c
...@@ -372,7 +372,7 @@ def main(): ...@@ -372,7 +372,7 @@ def main():
rhn.configure(**module.params) rhn.configure(**module.params)
rhn.register(username, password, autosubscribe, activationkey) rhn.register(username, password, autosubscribe, activationkey)
rhn.subscribe(pool) rhn.subscribe(pool)
except CommandException, e: except Exception, e:
module.fail_json(msg="Failed to register with '%s': %s" % (server_hostname, e)) module.fail_json(msg="Failed to register with '%s': %s" % (server_hostname, e))
else: else:
module.exit_json(changed=True, msg="System successfully registered to '%s'." % server_hostname) module.exit_json(changed=True, msg="System successfully registered to '%s'." % server_hostname)
...@@ -385,7 +385,7 @@ def main(): ...@@ -385,7 +385,7 @@ def main():
try: try:
rhn.unsubscribe() rhn.unsubscribe()
rhn.unregister() rhn.unregister()
except CommandException, e: except Exception, e:
module.fail_json(msg="Failed to unregister: %s" % e) module.fail_json(msg="Failed to unregister: %s" % e)
else: else:
module.exit_json(changed=True, msg="System successfully unregistered from %s." % server_hostname) module.exit_json(changed=True, msg="System successfully unregistered from %s." % server_hostname)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment