Bug 912375 - RFE - "rhn-migrate-classic-to-rhsm" migration script to accept the expected parameter either via standard input or the equivalent of an "answer" file"
Summary: RFE - "rhn-migrate-classic-to-rhsm" migration script to accept the expected p...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: subscription-manager
Version: 7.0
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: rc
: 7.0
Assignee: candlepin-bugs
QA Contact: Tazim Kolhar
URL:
Whiteboard:
Depends On:
Blocks: rhsm-rhel70 1087603
TreeView+ depends on / blocked
 
Reported: 2013-02-18 14:45 UTC by Tazim Kolhar
Modified: 2016-04-26 00:55 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
: 1087603 (view as bug list)
Environment:
Last Closed: 2014-06-13 13:17:04 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Tazim Kolhar 2013-02-18 14:45:12 UTC
Description of problem:
In order to migrate from RHN Classic (hosted/satellite) to RHSM-web (hosted) or Katello/SAM (on-premise) there should be facility,
to pass the required parameters via command-line or answer-file

Version-Release number of selected component (if applicable):
# rpm -qa | grep subscription-manager
subscription-manager-1.1.23-1.el6.x86_64
subscription-manager-migration-1.1.23-1.el6.x86_64
subscription-manager-migration-data-1.12.2.6-1.el6.noarch


How reproducible:
# yum install subscription-manager-migration subscription-manager-migration-data --enablerepo=rel-eng.latest

Steps to Reproduce:
1. rhn-migrate-classic-to-rhsm --serverurl=qetello05.usersys.redhat.com/sam/api
   Red Hat account: qa
   Password:  ******
   System Engine Username:  admin  (or whatever the user name is)
   Password:  ****   (this is your SAM user's password)
   Org:  SAM QE
   Env:  DEV


2. Migration successful without any errors
  
Actual results:
No provision to provide the above details using command-line utility or
feeding the details to answer-file

Expected results:
This feature is added to the script .

Additional info:

Comment 2 Alex Wood 2013-10-29 15:45:36 UTC
commit 767f9a8ad6041ab6b0f251f61bb6927f1f96df89
Author: Alex Wood <awood>
Date:   Thu Sep 19 15:13:33 2013 -0400

    Refactor credentials gathering.
    
    Additionally, use a more generic term that "System Engine".

Comment 3 John Sefler 2013-10-29 21:28:31 UTC
Verifying the following continuous integration build on a RHEL6 system since rhnreg_ks now blocks registration of a RHEL7 system...

[root@jsefler-6 ~]# rpm -q subscription-manager-migration
subscription-manager-migration-1.10.5-1.git.0.86042ca.el6.x86_64



[root@jsefler-6 ~]# rhn-migrate-classic-to-rhsm --help
Usage: rhn-migrate-classic-to-rhsm [OPTIONS]

Options:
  -h, --help            show this help message and exit
  -f, --force           ignore channels not available on RHSM
  -g, --gui             launch the GUI tool to attach subscriptions, instead
                        of auto-attaching
  -n, --no-auto         don't execute the auto-attach option while registering
                        with subscription manager
  -s SERVICELEVEL, --servicelevel=SERVICELEVEL
                        service level to follow when attaching subscriptions,
                        for no service level use --servicelevel=""
  --serverurl=SERVERURL
                        specify the subscription management server to migrate
                        to
  --redhat-user=REDHATUSER
                        specify the Red Hat user name
  --redhat-password=REDHATPASSWORD
                        specify the Red Hat password
  --subscription-service-user=SUBSERVICEUSER
                        specify the subscription service user name
  --subscription-service-password=SUBSERVICEPASSWORD
                        specify the subscription service password
  --no-proxy            don't use RHN proxy settings with subscription
                        management server
  --org=ORG             organization to register to
  --environment=ENVIRONMENT
                        environment to register to


^^^ VERIFIED: Notice the new command line options to specify --redhat-user=REDHATUSER --redhat-password=REDHATPASSWORD --subscription-service-user=SUBSERVICEUSER --subscription-service-password --org=ORG --environment=ENVIRONMENT which can all be used to satisfy the request in comment 0.



[root@jsefler-6 ~]# rhn-migrate-classic-to-rhsm 
Red Hat username: qa
Red Hat password: 
Subscription Service username: non-existant-user
Subscription Service password: 
Unable to connect to certificate server: Invalid Credentials.  See /var/log/rhsm/rhsm.log for more details.
[root@jsefler-6 ~]# 

^^^ VERIFIED: The labels for interactive credential prompts have changed as expected.  The "System Engine" label has been replaced with a generic "Subscription Service" label.



[root@jsefler-6 ~]# rhn-migrate-classic-to-rhsm --redhat-user=qa --redhat-password=redhatqa --subscription-service-user=stage_test_12 --subscription-service-password=redhat --org=7065298 --no-auto --serverurl=subscription.rhn.stage.redhat.com:443/subscription

Retrieving existing RHN Classic subscription information...

+-----------------------------------------------------+
System is currently subscribed to these RHN Classic Channels:
+-----------------------------------------------------+
rhel-x86_64-server-6

+-----------------------------------------------------+
Installing product certificates for these RHN Classic channels:
+-----------------------------------------------------+
rhel-x86_64-server-6

Product certificates installed successfully to /etc/pki/product.

Preparing to unregister system from RHN Classic...
System successfully unregistered from RHN Classic.

Attempting to register system to Red Hat Subscription Management...
The system has been registered with ID: 69bbfe34-c837-43e9-b560-ab016291a201 
System 'jsefler-6.usersys.redhat.com' successfully registered to Red Hat Subscription Management.

[root@jsefler-6 ~]# 

^^^ VERIFIED: the migration script can be run with options to avoid interactive prompting.  (Note: I did not specify --environment because the hosted stage subscription management server does not support environments, but a katello server does and should only be required when more than one environment is available to the Subscription Service credentials.

Comment 5 John Sefler 2014-01-24 23:21:43 UTC
Verifying Version...
[root@jsefler-7 ~]# subscription-manager version
server type: This system is currently not registered.
subscription management server: 0.9.2-1
subscription-manager: 1.10.11-1.el7
python-rhsm: 1.10.11-1.el7


[root@jsefler-7 ~]# rhn-migrate-classic-to-rhsm --help
Usage: rhn-migrate-classic-to-rhsm [OPTIONS]

Options:
  -h, --help            show this help message and exit
  -f, --force           ignore channels not available on RHSM
  -g, --gui             launch the GUI tool to attach subscriptions, instead
                        of auto-attaching
  -n, --no-auto         don't execute the auto-attach option while registering
                        with subscription manager
  -s SERVICELEVEL, --servicelevel=SERVICELEVEL
                        service level to follow when attaching subscriptions,
                        for no service level use --servicelevel=""
  --serverurl=SERVERURL
                        specify the subscription management server to migrate
                        to
  --redhat-user=REDHATUSER
                        specify the Red Hat user name
  --redhat-password=REDHATPASSWORD
                        specify the Red Hat password
  --subscription-service-user=SUBSERVICEUSER
                        specify the subscription service user name
  --subscription-service-password=SUBSERVICEPASSWORD
                        specify the subscription service password
  --no-proxy            don't use RHN proxy settings with subscription
                        management server
  --org=ORG             organization to register to
  --environment=ENVIRONMENT
                        environment to register to


VERIFIED: rhn-migrate-classic-to-rhsm now supports new CLI options --redhat-user=REDHATUSER --redhat-password=REDHATPASSWORD --subscription-service-user=SUBSERVICEUSER --subscription-service-password=SUBSERVICEPASSWORD --org=ORG --environment=ENVIRONMENT which can all be used to satisfy the request in comment 0.


Comment 3 demonstrates the usage of these new CLI options.

Comment 6 Ludek Smid 2014-06-13 13:17:04 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.


Note You need to log in before you can comment on or make changes to this bug.