diff --git a/cloud/azure/azure_rm_virtualmachine.py b/cloud/azure/azure_rm_virtualmachine.py index 67daf3ef023..49fee52fcf2 100644 --- a/cloud/azure/azure_rm_virtualmachine.py +++ b/cloud/azure/azure_rm_virtualmachine.py @@ -520,7 +520,7 @@ class AzureRMVirtualMachine(AzureRMModuleBase): changed=False, actions=[], powerstate_change=None, - ansible_facts=dict('azure_rm_vm') + ansible_facts=dict(azure_rm_vm=None) ) super(AzureRMVirtualMachine, self).__init__(derived_arg_spec=self.module_arg_spec, diff --git a/packaging/os/rhn_register.py b/packaging/os/rhn_register.py index 2a5496e52e2..852ea0278ce 100644 --- a/packaging/os/rhn_register.py +++ b/packaging/os/rhn_register.py @@ -119,8 +119,9 @@ sys.path.insert(0, '/usr/share/rhn') try: import up2date_client import up2date_client.config + HAS_UP2DATE_CLIENT = True except ImportError, e: - module.fail_json(msg="Unable to import up2date_client. Is 'rhn-client-tools' installed?\n%s" % e) + HAS_UP2DATE_CLIENT = False # INSERT REDHAT SNIPPETS from ansible.module_utils.redhat import * @@ -137,6 +138,9 @@ class Rhn(RegistrationBase): ''' Read configuration from /etc/sysconfig/rhn/up2date ''' + if not HAS_UP2DATE_CLIENT: + return None + self.config = up2date_client.config.initUp2dateConfig() # Add support for specifying a default value w/o having to standup some @@ -339,7 +343,7 @@ def main(): state = dict(default='present', choices=['present', 'absent']), username = dict(default=None, required=False), password = dict(default=None, required=False, no_log=True), - server_url = dict(default=rhn.config.get_option('serverURL'), required=False), + server_url = dict(default=None, required=False), activationkey = dict(default=None, required=False, no_log=True), profilename = dict(default=None, required=False), sslcacert = dict(default=None, required=False, type='path'), @@ -349,6 +353,12 @@ def main(): ) ) + if not HAS_UP2DATE_CLIENT: + module.fail_json(msg="Unable to import up2date_client. Is 'rhn-client-tools' installed?") + + if not module.params['server_url']: + module.params['server_url'] = rhn.config.get_option('serverURL') + state = module.params['state'] rhn.username = module.params['username'] rhn.password = module.params['password']