-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
redhat_subscription: drop unneeded args to Rhsm.register()
#5583
redhat_subscription: drop unneeded args to Rhsm.register()
#5583
Conversation
4c422c8
to
f5c35b0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution. Can you please add a changelog fragment? Thanks.
f5c35b0
to
d30f678
Compare
d30f678
to
c3d2ad7
Compare
Stop passing all the "rhsm_", and "server_" module arguments to "Rhsm.register()", and thus as arguments for "subscription-manager register": - right before calling "Rhsm.register()", "Rhsm.configure()" is called to configure subscription-manager with all the "rhsm_", and "server_" arguments; hence, they are already configured - the passed argument to "--serverurl" is partially wrong: "Rhsm.register()" passes only the hostname, whereas the other bits (port and prefix) are supported too; this "works" because port and prefix were already configured previously, and the lax parsing that subscription-manager does allows for missing bits - the parsing done by subscription-manager for "--baseurl" strips out the URL scheme and always uses https: this means that specifying "rhsm_baseurl: http://server" as module parameter will be taken as "https://server" by subscription-manager; since "rhsm_baseurl" is already configured by "Rhsm.configure()", this issue is gone
c3d2ad7
to
5cc99bb
Compare
ciao pino! ;-) |
Backport to stable-6: 💚 backport PR created✅ Backport PR branch: Backported as #5626 🤖 @patchback |
Stop passing all the "rhsm_", and "server_" module arguments to "Rhsm.register()", and thus as arguments for "subscription-manager register": - right before calling "Rhsm.register()", "Rhsm.configure()" is called to configure subscription-manager with all the "rhsm_", and "server_" arguments; hence, they are already configured - the passed argument to "--serverurl" is partially wrong: "Rhsm.register()" passes only the hostname, whereas the other bits (port and prefix) are supported too; this "works" because port and prefix were already configured previously, and the lax parsing that subscription-manager does allows for missing bits - the parsing done by subscription-manager for "--baseurl" strips out the URL scheme and always uses https: this means that specifying "rhsm_baseurl: http://server" as module parameter will be taken as "https://server" by subscription-manager; since "rhsm_baseurl" is already configured by "Rhsm.configure()", this issue is gone (cherry picked from commit 101c957)
…5626) Stop passing all the "rhsm_", and "server_" module arguments to "Rhsm.register()", and thus as arguments for "subscription-manager register": - right before calling "Rhsm.register()", "Rhsm.configure()" is called to configure subscription-manager with all the "rhsm_", and "server_" arguments; hence, they are already configured - the passed argument to "--serverurl" is partially wrong: "Rhsm.register()" passes only the hostname, whereas the other bits (port and prefix) are supported too; this "works" because port and prefix were already configured previously, and the lax parsing that subscription-manager does allows for missing bits - the parsing done by subscription-manager for "--baseurl" strips out the URL scheme and always uses https: this means that specifying "rhsm_baseurl: http://server" as module parameter will be taken as "https://server" by subscription-manager; since "rhsm_baseurl" is already configured by "Rhsm.configure()", this issue is gone (cherry picked from commit 101c957) Co-authored-by: Pino Toscano <ptoscano@redhat.com>
The redhat_subscription used to handle certain options both writing them to the config file (using "subscription-manager config"), and passing them as command line parameters to "subscription-manager register". This was problematic for rhsm_baseurl, as subscription-manager sadly forces "https" as scheme when parsing "--baseurl" as passed to "register". This was fixed with [1] (backported to community.general 6.x with [2]), available since community.general 6.1.0. Hence, directly pass the "rhc_baseurl" role parameter as "rhsm_baseurl" parameter of the redhat_subscription module. [1] ansible-collections/community.general#5583 [2] ansible-collections/community.general#5626 Signed-off-by: Pino Toscano <ptoscano@redhat.com>
The redhat_subscription used to handle certain options both writing them to the config file (using "subscription-manager config"), and passing them as command line parameters to "subscription-manager register". This was problematic for rhsm_baseurl, as subscription-manager sadly forces "https" as scheme when parsing "--baseurl" as passed to "register". This was fixed with [1] (backported to community.general 6.x with [2]), available since community.general 6.1.0. Hence, directly pass the "rhc_baseurl" role parameter as "rhsm_baseurl" parameter of the redhat_subscription module. [1] ansible-collections/community.general#5583 [2] ansible-collections/community.general#5626 Signed-off-by: Pino Toscano <ptoscano@redhat.com>
The redhat_subscription used to handle certain options both writing them to the config file (using "subscription-manager config"), and passing them as command line parameters to "subscription-manager register". This was problematic for rhsm_baseurl, as subscription-manager sadly forces "https" as scheme when parsing "--baseurl" as passed to "register". This was fixed with [1] (backported to community.general 6.x with [2]), available since community.general 6.1.0. Hence, directly pass the "rhc_baseurl" role parameter as "rhsm_baseurl" parameter of the redhat_subscription module. [1] ansible-collections/community.general#5583 [2] ansible-collections/community.general#5626 Signed-off-by: Pino Toscano <ptoscano@redhat.com>
SUMMARY
Stop passing all the
rhsm_
, andserver_
module arguments toRhsm.register()
, and thus as arguments forsubscription-manager register
:Rhsm.register()
,Rhsm.configure()
is called to configure subscription-manager with all therhsm_
, andserver_
arguments; hence, they are already configured--serverurl
is partially wrong:Rhsm.register()
passes only the hostname, whereas the other bits (port and prefix) are supported too; this "works" because port and prefix were already configured previously, and the lax parsing that subscription-manager does allows for missing bits--baseurl
strips out the URL scheme and always uses https: this means that specifyingrhsm_baseurl: http://server
as module parameter will be taken ashttps://server
by subscription-manager; sincerhsm_baseurl
is already configured byRhsm.configure()
, this issue is goneISSUE TYPE
COMPONENT NAME
redhat_subscription
ADDITIONAL INFORMATION
There should be no behaviour change for the module; the only change is when a http URL for
rhsm_baseurl
is specified, now it is really used as it is.