|
|
@ -234,7 +234,7 @@ import tempfile
|
|
|
|
import types
|
|
|
|
import types
|
|
|
|
|
|
|
|
|
|
|
|
from ansible.module_utils.basic import AnsibleModule
|
|
|
|
from ansible.module_utils.basic import AnsibleModule
|
|
|
|
from ansible.module_utils.pycompat24 import get_exception
|
|
|
|
from ansible.module_utils._text import to_native
|
|
|
|
from ansible.module_utils.six.moves import configparser
|
|
|
|
from ansible.module_utils.six.moves import configparser
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -766,9 +766,8 @@ def main():
|
|
|
|
result = rhsm.update_subscriptions_by_pool_ids(pool_ids)
|
|
|
|
result = rhsm.update_subscriptions_by_pool_ids(pool_ids)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
result = rhsm.update_subscriptions(pool)
|
|
|
|
result = rhsm.update_subscriptions(pool)
|
|
|
|
except Exception:
|
|
|
|
except Exception as e:
|
|
|
|
e = get_exception()
|
|
|
|
module.fail_json(msg="Failed to update subscriptions for '%s': %s" % (server_hostname, to_native(e)))
|
|
|
|
module.fail_json(msg="Failed to update subscriptions for '%s': %s" % (server_hostname, e))
|
|
|
|
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
module.exit_json(**result)
|
|
|
|
module.exit_json(**result)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
@ -785,9 +784,8 @@ def main():
|
|
|
|
subscribed_pool_ids = rhsm.subscribe_by_pool_ids(pool_ids)
|
|
|
|
subscribed_pool_ids = rhsm.subscribe_by_pool_ids(pool_ids)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
subscribed_pool_ids = rhsm.subscribe(pool)
|
|
|
|
subscribed_pool_ids = rhsm.subscribe(pool)
|
|
|
|
except Exception:
|
|
|
|
except Exception as e:
|
|
|
|
e = get_exception()
|
|
|
|
module.fail_json(msg="Failed to register with '%s': %s" % (server_hostname, to_native(e)))
|
|
|
|
module.fail_json(msg="Failed to register with '%s': %s" % (server_hostname, e))
|
|
|
|
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
module.exit_json(changed=True,
|
|
|
|
module.exit_json(changed=True,
|
|
|
|
msg="System successfully registered to '%s'." % server_hostname,
|
|
|
|
msg="System successfully registered to '%s'." % server_hostname,
|
|
|
@ -800,9 +798,8 @@ def main():
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
rhsm.unsubscribe()
|
|
|
|
rhsm.unsubscribe()
|
|
|
|
rhsm.unregister()
|
|
|
|
rhsm.unregister()
|
|
|
|
except Exception:
|
|
|
|
except Exception as e:
|
|
|
|
e = get_exception()
|
|
|
|
module.fail_json(msg="Failed to unregister: %s" % to_native(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)
|
|
|
|
|
|
|
|
|
|
|
|