Bug 1196416

Summary: rhn-migrate-classic-to-rhsm with --activation-key option should not prompt for destination credentials
Product: Red Hat Enterprise Linux 6 Reporter: John Sefler <jsefler>
Component: subscription-managerAssignee: candlepin-bugs
Status: CLOSED ERRATA QA Contact: John Sefler <jsefler>
Severity: unspecified Docs Contact:
Priority: high    
Version: 6.7CC: awood, dgoodwin, ggainey, skallesh, wpoteat
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-07-22 06:53:11 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:
Bug Depends On:    
Bug Blocks: 1121117, 1125249    

Description John Sefler 2015-02-25 23:12:44 UTC
Description of problem:
After implementation of RFE Bug 1154375, the rhn-migrate-classic-to-rhsm tool now allows the user to specify an --activation-key option.

Following the usage rules of subscription-manager register with an activation key, a few fixes are needed...

1. if rhn-migrate-classic-to-rhsm is run with the --activation-key option, then there should not be any interactive prompting for destination-user and destination-password

2. if rhn-migrate-classic-to-rhsm is run with the --activation-key option, then either the --org must be specified or interactively prompted.


Version-Release number of selected component (if applicable):
[root@jsefler-os6 ~]# rpm -q subscription-manager
subscription-manager-1.14.1-1.git.37.61e53ff.el6.x86_64



Additional info:
In my opinion, there is no need for interactive prompting of an activation-key (as currently implemented).  If this is desired in the future, then it would need to occur before the destination credential prompts.  Moreover, we would need a way to say "I don't have an activation-key".

Comment 1 Alex Wood 2015-04-07 15:37:47 UTC
*** Bug 1123025 has been marked as a duplicate of this bug. ***

Comment 2 Alex Wood 2015-04-08 14:17:47 UTC
commit e6ee0dac25ac3cf6adc0d52779e6c806e7f62799
Author: Alex Wood <awood>
Date:   Thu Feb 26 16:10:46 2015 -0500

    1196416: Migration should not need credentials with activation keys
    
    Also addresses 1196396

Comment 4 Shwetha Kallesh 2015-04-14 07:06:20 UTC
[root@dhcp35-236 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 0.9.47-1
subscription management rules: 5.14
subscription-manager: 1.14.3-1.el6
python-rhsm: 1.14.2-1.el6


Doesnot ask for destination user and password when rhn-migrate-classic-to-rhsm is used with activation-key

[root@dhcp35-236 ~]# rhn-migrate-classic-to-rhsm --activation-key rhn_migration_test --org admin
Legacy username: qa
Legacy password: 

Retrieving existing legacy subscription information...

+-----------------------------------------------------+
System is currently subscribed to these legacy channels:
+-----------------------------------------------------+
rhel-x86_64-server-6

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

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

Preparing to unregister system from legacy server...
System successfully unregistered from legacy server.

Attempting to register system to destination server...
The system has been registered with ID: 5f7fa230-b638-4d96-b33e-496aa9a2bb3a 

Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status:       Not Subscribed

Product Name: Awesome OS Server Bits
Status:       Not Subscribed

Unable to find available subscriptions for all your installed products.
System 'dhcp35-236.lab.eng.blr.redhat.com' successfully registered.


--------------------------------------------------------------------------
--------------------------------------------------------------------------

When org is not specified with activation-key , a message is displayed to user ,but there is no prompting for --org

[root@dhcp35-236 ~]# rhn-migrate-classic-to-rhsm --activation-key foo
The --activation-key option requires that a --org be given.

Comment 5 Alex Wood 2015-04-14 14:00:31 UTC
> When org is not specified with activation-key , a message is displayed to
> user ,but there is no prompting for --org
> 
> [root@dhcp35-236 ~]# rhn-migrate-classic-to-rhsm --activation-key foo
> The --activation-key option requires that a --org be given.

Not asking for an org in this situation is by design.  The primary use case for the --activation-key option was that administrators would be using it in scripts.  If we prompted for an org, the script would just sit forever waiting for input that would never appear.  Instead, I decided to make the tool fail immediately if an organization was not specified so that script authors would immediately get feedback.

Comment 6 Shwetha Kallesh 2015-04-15 06:12:26 UTC
(In reply to Alex Wood from comment #5)
> > When org is not specified with activation-key , a message is displayed to
> > user ,but there is no prompting for --org
> > 
> > [root@dhcp35-236 ~]# rhn-migrate-classic-to-rhsm --activation-key foo
> > The --activation-key option requires that a --org be given.
> 
> Not asking for an org in this situation is by design.  The primary use case
> for the --activation-key option was that administrators would be using it in
> scripts.  If we prompted for an org, the script would just sit forever
> waiting for input that would never appear.  Instead, I decided to make the
> tool fail immediately if an organization was not specified so that script
> authors would immediately get feedback.

Thanks for the clarification,moving the bug to verified as it is working as designed.

Comment 7 errata-xmlrpc 2015-07-22 06:53:11 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://rhn.redhat.com/errata/RHBA-2015-1345.html