Bug 1550601

Summary: rh_subscription: module not configured.
Product: Red Hat Enterprise Linux 7 Reporter: Christopher Wawak <cwawak>
Component: cloud-initAssignee: Ryan McCabe <rmccabe>
Status: CLOSED NOTABUG QA Contact: Huijuan Zhao <huzhao>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.4CC: eterrell, huzhao, jgreguske, leiwang, linl, xiachen
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-09-30 07:58:55 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Christopher Wawak 2018-03-01 15:09:30 UTC
Description of problem:
When booting a RHEL 7.4 template on a RHV 4.1 env, subscription details are not applied by the rh_subscription module.

Version-Release number of selected component (if applicable):
cloud-init-0.7.9-9.el7_4.2.x86_64

How reproducible:
Every time

Steps to Reproduce:
1. Create RHEL 7.4 VM template in RHV 4.1 environment user_data
2. Specify rh_subscription data in user_data
3. Boot

Actual results:
Subscription information is not appleid

Expected results:
Subscription information is applied

Additional info:
# cat /mnt/openstack/latest/user_data
#cloud-config
output:
  all: '>> /var/log/cloud-init-output.log'
disable_root: 0
runcmd:
- 'sed -i ''/^datasource_list: /d'' /etc/cloud/cloud.cfg; echo ''datasource_list:
  ["NoCloud", "ConfigDrive"]'' >> /etc/cloud/cloud.cfg'
ssh_pwauth: true
chpasswd:
  expire: false
user: root
rh_subscription:
  activation_key: 'redacted'
  org: 'redacted'
  auto-attach: False
  add-pool: [ 'redacted' ]
  disable-repo: [ '*' ]
  enable-repo: [ 'rhel-7-server-rpms', 'rhel-7-server-extras-rpms' ]

Logs:
2018-03-01 09:41:13,155 - stages.py[DEBUG]: Running module rh_subscription (<module 'cloudinit.config.cc_rh_subscription' from '/usr/lib/python2.7/site-packages/cloudinit/config/cc_rh_subscription.pyc'>) with frequency once-per-instance
2018-03-01 09:41:13,156 - handlers.py[DEBUG]: start: modules-config/config-rh_subscription: running config-rh_subscription with frequency once-per-instance
2018-03-01 09:41:13,156 - util.py[DEBUG]: Writing to /var/lib/cloud/instances/c97e86e8-2f65-4c5c-b490-3f1e64479cc7/sem/config_rh_subscription - wb: [420] 20 bytes
2018-03-01 09:41:13,157 - util.py[DEBUG]: Restoring selinux mode for /var/lib/cloud/instances/c97e86e8-2f65-4c5c-b490-3f1e64479cc7/sem/config_rh_subscription (recursive=False)
2018-03-01 09:41:13,158 - util.py[DEBUG]: Restoring selinux mode for /var/lib/cloud/instances/c97e86e8-2f65-4c5c-b490-3f1e64479cc7/sem/config_rh_subscription (recursive=False)
2018-03-01 09:41:13,159 - helpers.py[DEBUG]: Running config-rh_subscription using lock (<FileLock using file '/var/lib/cloud/instances/c97e86e8-2f65-4c5c-b490-3f1e64479cc7/sem/config_rh_subscrip
tion'>)
2018-03-01 09:41:13,159 - cc_rh_subscription.py[DEBUG]: rh_subscription: module not configured.
2018-03-01 09:41:13,159 - handlers.py[DEBUG]: finish: modules-config/config-rh_subscription: SUCCESS: config-rh_subscription ran successfully

Comment 2 Ryan McCabe 2018-03-01 16:07:35 UTC
It looks like this is broken because the disabled list is taking precedence over the enabled list.

For the moment, I think it should work if you explicitly disable only what needs disabling. It will need fixing upstream to make it work as it ought to.

Comment 3 Eduardo Otubo 2020-09-29 12:55:05 UTC
Can you double check if you meet this issue with latest versions of cloud-init like RHEL-7.9/cloud-init-19.4?

Comment 4 Christopher Wawak 2020-09-29 13:25:54 UTC
Unfortunately, I don't have access to the appropriate environments (or the same job) that would allow me to replicate this. Sorry, all!

Comment 5 Eduardo Otubo 2020-09-29 13:33:00 UTC
@huzhao, can you reproduce this issue with latest release?

Comment 6 xiachen 2020-09-30 07:58:55 UTC
This is not a bug. It is caused by using the wrong parameter "activation_key" in configuration rh_subscription module.
The correct parameter should be "activation-key".
see the example here, https://cloudinit.readthedocs.io/en/latest/topics/modules.html#redhat-subscription

and I checked source code, it works as expected to show the message "rh_subscription: module not configured", so close it as NOT A BUG.
detail in cloudinit/config/cc_rh_subscription.py


Tested rh_subscription module with disable and enable repo, 
cloud-init-0.7.9-9.el7_4.2.x86_64 & rhel 7.4
cloud-init-19.4-7.el7.x86_64 & rhel7.9
Result: PASS.