Red Hat Bugzilla – Bug 1320507
Wrong prefix prompts when register using serverurl without prefix
Last modified: 2017-03-21 06:54:44 EDT
Description of problem: Wrong prefix prompts when register using serverurl without prefix Version-Release number of selected component (if applicable): subscription-manager: 1.16.8-7.el6 python-rhsm: 1.16.6-1.el6 How reproducible: always Steps to Reproduce: 1. Register system without any parameters. [root@pogo-cn1100-01 ~]# subscription-manager register Registering to: samserv.redhat.com:443/sam/api Username: ^C User interrupted process. 2.Register system with serverurl, port and prefix. [root@pogo-cn1100-01 ~]# subscription-manager register --serverurl=samserv.redhat.com:443/sam/api Registering to: samserv.redhat.com:443/sam/api Username: admin Password: The system has been registered with ID: 9718390b-de71-4d2d-998a-045704146853 3. Register system with serverurl but not prefix. [root@pogo-cn1100-01 ~]# subscription-manager register --serverurl=samserv.redhat.com Registering to: samserv.redhat.com:443/subscription <===== should be 'sam/api' Username: ^C User interrupted process. Actual results: As step 3. Expected results: The prefix in step 3 should be /sam/api Additional info:
Reproducing the failure... [root@jsefler-6 ~]# subscription-manager config --server.hostname=hostname --server.port=123 --server.prefix=/prefix [root@jsefler-6 ~]# [root@jsefler-6 ~]# subscription-manager register Registering to: hostname:123/prefix <===== VERIFIED/EXPECTED Username: ^C User interrupted process. [root@jsefler-6 ~]# [root@jsefler-6 ~]# subscription-manager register --serverurl=jsefler-f22-candlepin.usersys.redhat.com:8443/candlepin --insecure Registering to: jsefler-f22-candlepin.usersys.redhat.com:8443/candlepin <===== VERIFIED/EXPECTED Username: testuser1 Password: Organization: admin The system has been registered with ID: 932b5cf9-2a2e-445e-ab69-be7d4ce76856 [root@jsefler-6 ~]# [root@jsefler-6 ~]# subscription-manager unregister System has been unregistered. [root@jsefler-6 ~]# [root@jsefler-6 ~]# subscription-manager register Registering to: jsefler-f22-candlepin.usersys.redhat.com:8443/candlepin <==== VERIFIED/EXPECTED Username: ^C User interrupted process. [root@jsefler-6 ~]# [root@jsefler-6 ~]# subscription-manager register --serverurl=jsefler-f22-candlepin.usersys.redhat.com Unable to reach the server at jsefler-f22-candlepin.usersys.redhat.com:443/subscription <==== FAILED [root@jsefler-6 ~]# [root@jsefler-6 ~]# subscription-manager config | egrep " hostname| port| prefix" hostname = jsefler-f22-candlepin.usersys.redhat.com port = 8443 prefix = /candlepin [root@jsefler-6 ~]# The configured port and prefix were NOT used when the port and prefix were absent from the specified --serverurl value. Instead the default port 443 and default prefix /subscription were used.
Fix merged to upstream master as of the below commit. As it is in before the branch for 6.9, moving to modified. commit ea10b99095ad58df57ed107e13bf19498e003ae8 Author: William Poteat <wpoteat@redhat.com> Date: Mon Apr 11 13:28:43 2016 -0400 1320507: Use config entry before default for port and prefix
fixed in subscription-manager-1.17.5-1
(In reply to John Sefler from comment #6) > fixed in subscription-manager-1.17.5-1 Trying to verify the bug on RHEL-7.3-RC-2.0: subscription-manager: 1.17.15-1.el7 python-rhsm: 1.17.9-1.el7 1 Specifying the port and prefix in CLI: 1) With rhsm.conf configured. [root@dhcp-128-71 ~]# egrep "hostname|port|prefix" /etc/rhsm/rhsm.conf # Server hostname: hostname = samserv.redhat.com # Server prefix: prefix = /sam/api # Server port: port = 443 [root@dhcp-128-71 ~]# subscription-manager config | egrep " hostname| port| prefix" hostname = samserv.redhat.com port = [443] prefix = /sam/api [root@dhcp-128-71 ~]# subscription-manager register --serverurl=samserv.redhat.com:443/sam/api Registering to: samserv.redhat.com:443/sam/api Username: admin Password: The system has been registered with ID: 40d17a2a-1268-425b-a030-86da77a6f980 2) Without rhsm.conf configured. [root@dhcp-128-71 ~]# subscription-manager config | egrep " hostname| port| prefix" hostname = samserv.redhat.com port = [443] prefix = [/subscription] [root@dhcp-128-71 ~]# egrep "hostname|port|prefix" /etc/rhsm/rhsm.conf # Server hostname: hostname = samserv.redhat.com # Server prefix: prefix = # Server port: port = [root@dhcp-128-71 ~]# subscription-manager register --serverurl=samserv.redhat.com:443/sam/api Registering to: samserv.redhat.com:443/sam/api Username: admin Password: The system has been registered with ID: 8eace28d-cd09-4c14-b5d6-bc331a2a8e53 Verified. CLI with registration takes first priority over conf and default value. 2. Without CLI, rhsm.conf file is configured. [root@dhcp-128-71 ~]# subscription-manager unregister System has been unregistered. [root@dhcp-128-71 ~]# egrep "hostname|port|prefix" /etc/rhsm/rhsm.conf # Server hostname: hostname = samserv.redhat.com # Server prefix: prefix = /sam/api # Server port: port = 443 [root@dhcp-128-71 ~]# subscription-manager config | egrep " hostname| port| prefix" hostname = samserv.redhat.com port = [443] prefix = /sam/api [root@dhcp-128-71 ~]# subscription-manager register --serverurl=samserv.redhat.com Registering to: samserv.redhat.com:443/sam/api Username: admin Password: The system has been registered with ID: 3b501cd2-06bd-40b9-97c4-cc6fe945a868 Verified. Registration uses the configured rhsm.conf file when NOT specifying port and prefix in cli. 3. Without CLI or rhsm.conf. [root@dhcp-128-71 ~]# subscription-manager unregister System has been unregistered. [root@dhcp-128-71 ~]# egrep "hostname|port|prefix" /etc/rhsm/rhsm.conf # Server hostname: hostname = samserv.redhat.com # Server prefix: prefix = # Server port: port = [root@dhcp-128-71 ~]# subscription-manager config | egrep " hostname| port| prefix" hostname = samserv.redhat.com port = [443] prefix = [/subscription] [root@dhcp-128-71 ~]# subscription-manager register --serverurl=samserv.redhat.com Registering to: samserv.redhat.com:443/subscription Username: admin Password: The system has been registered with ID: 4e1c26d0-8940-47ad-87f5-156ec3ba5cae Verified. The default port and prefix value play roles when no cli specified or rhsm.conf configured.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHSA-2017-0698.html