waveclaw / puppet-subscription_manager

Handle Client Registration to RedHat Satellite 6 or Katello
https://rhn.redhat.com
Other
6 stars 34 forks source link

Boolean conversion to '0' and '1' issue for rhsm.conf on Puppet open source 5.5.x and 6.0.x #76

Closed jacraig-vcu closed 5 years ago

jacraig-vcu commented 5 years ago

When using module v5.0.0 and running Puppet open source 5.5.x and 6.0.x, the following is observed:

[...]
Notice: /Stage[main]/Subscription_manager::Config/Rhsm_config[/etc/rhsm/rhsm.conf]/server_insecure: server_insecure changed false to 'false'
Notice: /Stage[main]/Subscription_manager::Config/Rhsm_config[/etc/rhsm/rhsm.conf]/rhsm_manage_repos: rhsm_manage_repos changed true to 'true'
Notice: /Stage[main]/Subscription_manager::Config/Rhsm_config[/etc/rhsm/rhsm.conf]/rhsm_full_refresh_on_yum: rhsm_full_refresh_on_yum changed true to 'true'
Notice: /Stage[main]/Subscription_manager::Config/Rhsm_config[/etc/rhsm/rhsm.conf]/rhsm_report_package_profile: rhsm_report_package_profile changed true to 'true'
Info: Class[Subscription_manager::Config]: Scheduling refresh of Class[Subscription_manager::Service]
[...]

This translates to the strings 'true' and 'false' being defined in '/etc/rhsm/rhsm.conf' for each of the listed items, in lieu of the expected integers 1 and 0, respectively.

This results in various errors, including the following when running 'yum':

$ sudo yum update
Loaded plugins: enabled_repos_upload, package_upload, product-id, search-disabled-repos, subscription-manager, tracer_upload
Options error: Section: rhsm, Property: full_refresh_on_yum - Integer value expected
Uploading Enabled Repositories Report
Loaded plugins: product-id, subscription-manager
Unable to upload Enabled Repositories Report
jonasbartho commented 5 years ago

We are dealing with the same issue .. Changing the values from true/false to 1/0 in Puppet doesn't get accepted.

mungo312 commented 5 years ago

Same problem here

jonasbartho commented 5 years ago

Hi, are there any updates on this? :) We are now still on version 3.3.3 of your module, and now are getting the following error after upgrading to RHL Satellite 6.4.0 when running puppet:

Config/rhsm_config[/etc/rhsm/rhsm.conf]: Could not evaluate: Invalid parameter rhsm_repomd_gpg_url

We added "rhsm_repomd_gpg_url" as a new property in /lib/puppet/type/rhsm_config.rb + added it in /data/defaults.yaml and it was solved, but we are nevertheless looking forward to have the current boolean bug resolved.

waveclaw commented 5 years ago

This is a bug in the rhsm_config provider. I have hit this in production and will need to re-write the rhsm_config type and subscription_manager provider to fix this.

Puppet has a major bug with boolean properties. If they are false then Puppet stops managing them.

Instead of boolean propeties, rhsm_config provides 'binary' options that can be true or false. These are to map to 1 or 0 in the rhsm.conf file.

The bug in Puppet effectively broke this module from 3.3 until 5.0.0. The 4.x series was unpublished as attempts to deal with the Puppet bug only made the problem worse. 5.x and later abandoned any pretense of boolean properties and is supposed to use 0 or 1 (or mapping of false and true to 0 and 1.)

Per https://bugzilla.redhat.com/show_bug.cgi?id=1462759 and https://www.mankier.com/5/rhsm.conf these settings are 1 or 0 and can never be the strings "true" or "false":

This setting might be limited to 1 or 0 rhsm.auto_enable_yum_plugins depending on the subscription_manager version.

This will not require an API breaking change so the 5.x series will be able to accept it.

waveclaw commented 5 years ago

This is deployed now and widely tested.