Open ralfbosz opened 1 year ago
I ran into this too, and I found that the regex added in e12d8a98ea0d277d5b0be7bed9f2d9cb234fd618 was not working on RHEL6 and RHEL7, but it does work on RHEL8 and RHEL9. Versions of subscription-manager checked: RHEL6: subscription-manager-1.20.10-8.el6.x86_64 -> Does not work RHEL7: subscription-manager-1.24.51-1.el7_9.x86_64 -> Does not work RHEL8: subscription-manager-1.28.32-1.el8.x86_64 -> Works RHEL9: subscription-manager-1.29.30.1-1.el9_1.x86_64 -> Works
In case of RHEL8 or RHEL9, the output of the subscription-manager config --help
command results in something like this:
usage: subscription-manager config [OPTIONS]
List, set, or remove the configuration parameters in use by this system
optional arguments:
-h, --help show this help message and exit
--list list the configuration for this system
--remove REMOVE remove configuration entry by section.name
--server.port SERVER.PORT
Section: server, Name: port
--server.server_timeout SERVER.SERVER_TIMEOUT
Section: server, Name: server_timeout
--server.proxy_scheme SERVER.PROXY_SCHEME
Section: server, Name: proxy_scheme
--server.proxy_port SERVER.PROXY_PORT
Section: server, Name: proxy_port
--server.no_proxy SERVER.NO_PROXY
Section: server, Name: no_proxy
with a space as separator.
In case of RHEL6 or RHEL7 the output of the subscription-manager config --help
command results in something like this:
Usage: subscription-manager config [OPTIONS]
List, set, or remove the configuration parameters in use by this system
Options:
-h, --help show this help message and exit
--list list the configuration for this system
--remove=REMOVE remove configuration entry by section.name
--server.proxy_hostname=SERVER.PROXY_HOSTNAME
Section: server, Name: proxy_hostname
--server.server_timeout=SERVER.SERVER_TIMEOUT
Section: server, Name: server_timeout
--server.proxy_user=SERVER.PROXY_USER
Section: server, Name: proxy_user
--server.no_proxy=SERVER.NO_PROXY
Section: server, Name: no_proxy
with an '=' as separator.
Because the code to parse this output reads: https://github.com/waveclaw/puppet-subscription_manager/blob/a8bddf22d45de457acf47743ab58120e507b82b8/lib/puppet/provider/rhsm_config/subscription_manager.rb#L244 The regex expects the separator to be a single space only.
If the line is altered to
m = line.match(%r{^\s+--([a-z_0-9]+\.[a-z_0-9]+)[=\s][A-Z]+.*})
it works in both (RHEL6/7 and RHEL8/9) cases.
Note: I did not test on RHEL5, that OS is now well beyond extended support, so I don't see a reason to still support it.
Opened #121 to fix this issue.
@waveclaw, can you please shine your light on this? The fix is really easy.
@waveclaw, can you please shine your light on this? The fix is really easy.
No, it's not 'really easy.' This is not a 'just update the regex' situation. If you had provided an actual merge-request you would have seen the breakage on the unit test.
I have to re-write the provider to support that small looking change plus additional OS detection code. That has knock-on effects up to forcing a new major release when the state parsing changes in any way.
I'm mostly supporting Oracle, Alma and Rocky Linux. Behavior is different but the OS detection finds it as RedHat. That is obviously a problem for legacy versions like 6 and current but older releases like 7.
I'm probably faced with checking if subscription-manager is 1.25 or later as that brought in the new 'equal-less' options parsing without pushing the major release of a backwards-incompatible API change.
Sorry for short cutting the solution, I thought I did the right thing by creating PR, but apparently I didn't. I'm normally using Gitlab or Bitbucket on prem, so I'm missing the experience on Github. I'd love to see a unit test against my proposed change, so how can I achieve that? I'm very willing to fix this properly, as it still affects our environment.
The config still does not change when using rhsm_config:
From a debug-run:
It seems that the cmds[:apply] is nill. Tested it with a debug and Puppet.debug line in the code and it is empty. No idea how to fix it.
https://github.com/waveclaw/puppet-subscription_manager/blob/a8bddf22d45de457acf47743ab58120e507b82b8/lib/puppet/provider/rhsm_config/subscription_manager.rb#L43