diff --git a/kvirt/baseconfig.py b/kvirt/baseconfig.py index a01233d23..5a39014d1 100644 --- a/kvirt/baseconfig.py +++ b/kvirt/baseconfig.py @@ -401,7 +401,7 @@ def __init__(self, client=None, containerclient=None, debug=False, quiet=False, self.rhnserver = options.get('rhnserver') self.rhnuser = options.get('rhnuser') self.rhnpassword = options.get('rhnpassword') - self.rhnak = options.get('rhnactivationkey') + self.rhnactivationkey = options.get('rhnactivationkey') self.rhnorg = options.get('rhnorg') self.rhnpool = options.get('rhnpool') self.tags = options.get('tags') diff --git a/kvirt/cluster/microshift/__init__.py b/kvirt/cluster/microshift/__init__.py index fa5a60887..1e4555c19 100644 --- a/kvirt/cluster/microshift/__init__.py +++ b/kvirt/cluster/microshift/__init__.py @@ -8,13 +8,9 @@ def valid_rhn_credentials(config, overrides): rhnuser = config.rhnuser or overrides.get('rhnuser') rhnpassword = config.rhnpassword or overrides.get('rhnpassword') - if rhnuser is not None and rhnpassword is not None: - return True - rhnak = config.rhnak or overrides.get('rhnactivationkey') + rhnactivationkey = config.rhnactivationkey or overrides.get('rhnactivationkey') rhnorg = config.rhnorg or overrides.get('rhnorg') - if rhnak is not None and rhnorg is not None: - return True - return False + return (rhnuser is not None and rhnpassword is not None) or (rhnactivationkey is not None and rhnorg is not None) def create(config, plandir, cluster, overrides, dnsconfig=None): diff --git a/kvirt/cluster/microshift/kcli_plan_default.yml b/kvirt/cluster/microshift/kcli_plan_default.yml index 462f86795..fa0c092f6 100644 --- a/kvirt/cluster/microshift/kcli_plan_default.yml +++ b/kvirt/cluster/microshift/kcli_plan_default.yml @@ -1,6 +1,6 @@ info: | Deploy kubernetes using microshift on $nodes vms - Image defaults to rhel8, which requires valid credentials (rhnuser/rhnpassword or rhnak/rhnorg) + Image defaults to rhel8, which requires valid credentials (rhnuser/rhnpassword or rhnorg/rhnactivationkey) The nodes can also be registered to an ACM instance by stting register_acm to true and providing kubeconfig_acm nodes: 1 cluster: mymicroshift diff --git a/kvirt/config.py b/kvirt/config.py index 024fed20a..ea220f848 100644 --- a/kvirt/config.py +++ b/kvirt/config.py @@ -552,7 +552,7 @@ def create_vm(self, name, profile=None, overrides={}, customprofile={}, k=None, default_rhnserver = father.get('rhnserver', self.rhnserver) default_rhnuser = father.get('rhnuser', self.rhnuser) default_rhnpassword = father.get('rhnpassword', self.rhnpassword) - default_rhnak = father.get('rhnactivationkey', self.rhnak) + default_rhnactivationkey = father.get('rhnactivationkey', self.rhnactivationkey) default_rhnorg = father.get('rhnorg', self.rhnorg) default_rhnpool = father.get('rhnpool', self.rhnpool) default_tags = father.get('tags', self.tags) @@ -666,7 +666,7 @@ def create_vm(self, name, profile=None, overrides={}, customprofile={}, k=None, rhnserver = profile.get('rhnserver', default_rhnserver) rhnuser = profile.get('rhnuser', default_rhnuser) rhnpassword = profile.get('rhnpassword', default_rhnpassword) - rhnak = profile.get('rhnactivationkey', default_rhnak) + rhnactivationkey = profile.get('rhnactivationkey', default_rhnactivationkey) rhnorg = profile.get('rhnorg', default_rhnorg) rhnpool = profile.get('rhnpool', default_rhnpool) flavor = profile.get('flavor', default_flavor) @@ -705,8 +705,8 @@ def create_vm(self, name, profile=None, overrides={}, customprofile={}, k=None, if rhnuser is not None and rhnpassword is not None: overrides['rhnuser'] = rhnuser overrides['rhnpassword'] = rhnpassword - elif rhnak is not None and rhnorg is not None: - overrides['rhnactivationkey'] = rhnak + elif rhnactivationkey is not None and rhnorg is not None: + overrides['rhnactivationkey'] = rhnactivationkey overrides['rhnorg'] = rhnorg else: msg = "Rhn registration required but missing credentials. " @@ -763,9 +763,9 @@ def create_vm(self, name, profile=None, overrides={}, customprofile={}, k=None, if rhnserver != "https://subscription.rhsm.redhat.com" and not valid_ip(rhnserver): fqdn = os.path.basename(rhnserver) rhncommands.append(f'rpm -Uvh http://{fqdn}/pub/katello-ca-consumer-latest.noarch.rpm') - if rhnak is not None and rhnorg is not None: + if rhnactivationkey is not None and rhnorg is not None: rhncommands.append('subscription-manager register --serverurl=%s --force --activationkey=%s --org=%s' - % (rhnserver, rhnak, rhnorg)) + % (rhnserver, rhnactivationkey, rhnorg)) if image.startswith('rhel-8') or image == 'rhel8': rhncommands.append('subscription-manager repos --enable=rhel-8-for-x86_64-baseos-rpms') elif image.startswith('rhel-server-7') or image == 'rhel7': diff --git a/kvirt/providers/ovirt/__init__.py b/kvirt/providers/ovirt/__init__.py index fb76cda45..cf364819c 100644 --- a/kvirt/providers/ovirt/__init__.py +++ b/kvirt/providers/ovirt/__init__.py @@ -269,7 +269,8 @@ def create(self, name, virttype=None, profile='', flavor=None, plan='kvirt', if cloudinit and not custom_properties and initialization is None: custom_script = '' if storemetadata and overrides: - storeoverrides = {k: overrides[k] for k in overrides if k not in ['password', 'rhnpassword', 'rhnak']} + storeoverrides = {k: overrides[k] for k in overrides if k not in ['password', 'rhnpassword', + 'rhnactivationkey']} storedata = {'path': '/root/.metadata', 'content': yaml.dump(storeoverrides, default_flow_style=False, indent=2)} if files: