Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1393069

Summary: bootstrap.py cannot handle whtespace in activation key or org name when calling rhn-migrate-classic-to-rhsm
Product: Red Hat Satellite Reporter: Dylan Gross <dgross>
Component: BootstrapAssignee: Rich Jerrido <rjerrido>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.2.3CC: abalakht, bbuckingham, egolov, ehelms, jcallaha, sjagtap
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-02-21 17:09:02 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 Dylan Gross 2016-11-08 19:36:07 UTC
Description of problem:

   bootstrap.py script cannot handle a whitespace in the activation key name when making a call to /usr/sbin/rhn-migrate-classic-to-rhsm

Version-Release number of selected component (if applicable):

    Satellite 6.2.3

How reproducible:

    Always.

Steps to Reproduce:
1.   Create an activation key with whitespace in the name (e.g.):  RHEL 6
2.   Use the bootstrap.py from katello-client-bootstrap RPM
3.   Example usage on a client currently registered to RHN (so boo:
   
   #  /root/bootstrap.py --force -l admin -s satellite6.example.com -o 'myorg' -L 'mylocation' -g RHEL6_hostgroup -a "RHEL 6"

Actual results:

Output will have an error complaining that it couldn't find activation key "RHEL" instead of using "RHEL 6", when it makes a call to /usr/sbin/rhn-migrate-classic-to-rhsm

[ERROR], [2016-11-08 14:01:56], EXITING: [/usr/sbin/rhn-migrate-classic-to-rhsm --org myorg --activation-key RHEL 6  --destination-url=https://satellite6.example.com:443/rhsm --keep --force] failed to execute properly.
Couldn't find activation key 'RHEL'


Expected results:

  The full argument of the activation key is passed to /usr/sbin/rhn-migrate-classic-to-rhsm and interpreted as a single entity.


Additional info:

In the bootstrap.py:migrate_systems() function, line 202  below should have (at least) the second %s wrapped in single-quotes as is done in the register_systems() call right below it.    If I make that modification, it appears to pass the activation key correctly.   I suspect the %s for the org should also be surrounded by single-quotes.

192 def migrate_systems(org_name, activationkey):
193     org_label = return_matching_katello_key('organizations', 'name="%s"' % org_name, 'label', False)
194     print_generic("Calling rhn-migrate-classic-to-rhsm")
195     options.rhsmargs += " --destination-url=https://%s:%s/rhsm" % (options.foreman_fqdn, API_PORT)
196     if options.legacy_purge:
197         options.rhsmargs += " --legacy-user '%s' --legacy-password '%s'" % (options.legacy_login, options.legacy_password)
198     else:
199         options.rhsmargs += " --keep"
200     if options.force:
201         options.rhsmargs += " --force"
202     exec_failexit("/usr/sbin/rhn-migrate-classic-to-rhsm --org %s --activation-key %s %s" % (org_label, activationkey, options.rhsmargs))
203     exec_failexit("subscription-manager config --rhsm.baseurl=https://%s/pulp/repos" % options.foreman_fqdn)

Comment 2 Rich Jerrido 2016-11-10 13:26:03 UTC
Fixed upstream in this commit (https://github.com/Katello/katello-client-bootstrap/commit/7a1215fe19df0392dd83e3a7063f59ca4eb55667).

Comment 4 Bryan Kearney 2018-02-21 17:09:02 UTC
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://access.redhat.com/errata/RHSA-2018:0336