Bug 798918

Summary: Headpin cli unregister doesn't have environment option
Product: [Retired] Subscription Asset Manager Reporter: yu zheng <yuzheng>
Component: katelloAssignee: Petr Chalupa <pchalupa>
Status: CLOSED CURRENTRELEASE QA Contact: Tazim Kolhar <tkolhar>
Severity: medium Docs Contact:
Priority: medium    
Version: 1.0.0CC: cwelton, esammons, khong, tkolhar, tsanders
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-08-22 13:23:49 UTC Type: ---
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: 803375    

Description yu zheng 2012-03-01 09:22:29 UTC
Description of problem:
Register two systems with a same name to two environments of an org respectively. These system can't be unregistered by headpin cli. 

Version-Release number of selected component (if applicable):
katello-cli-common-0.1.100-2.el6.noarch
katello-cli-headpin-0.1.15-2.el6.noarch
katello-headpin-0.1.140-3.el6.noarch
katello-headpin-all-0.1.140-3.el6.noarch

How reproducible:
always

Steps to Reproduce:
1.Register system1 to env1.
# subscription-manager register --org=ACME_Corporation --environment=env1 --name=testsystem
2.Register system2 to env2.
# subscription-manager register --org=ACME_Corporation --environment=env2 --name=testsystem
3.Check registered systems.
# headpin -u admin -p admin system list --org=ACME_Corporation
----------------------------------------------------------
      Systems List For Org [ ACME_Corporation ]
 Name        
----------------------------------------------------------
 testsystem  
 testsystem 
3.Unregister system1 from SAM by using headpin cli.
# headpin -u admin -p admin system unregister --help
Usage: headpin [options]
Options:
  -h, --help    show this help message and exit
  -g            grep friendly output
  -v            verbose, more structured output
  -d DELIMITER  grep friendly output column delimiter
  --org=ORG     organization name (required)
  --name=NAME   system name (required)
  
Actual results:
There is no environment option.

Expected results:
Environment should be specified to decide which system will be unregistered.

Additional info:
# headpin -u admin -p admin system unregister --name=testsystem --org=ACME_Corporation
Could not find System [ testsystem ] in Org [ ACME_Corporation ]

Comment 1 Petr Chalupa 2012-04-16 16:43:21 UTC
fixed in 9575569ba3736103cd8fdb5e1ef588c0cbba45af

Comment 2 Tazim Kolhar 2012-04-30 07:55:57 UTC
VERIFIED with the build :
[root@tyan-gt24-12 ~]# rpm -qa | grep katello
katello-configure-0.3.1-2.el6_2.noarch
katello-selinux-0.1.10-1.el6.noarch
katello-cli-headpin-0.2.0-1.el6_2.noarch
katello-candlepin-cert-key-pair-1.0-1.noarch
katello-configure-upgrade-0.3.1-2.el6_2.noarch
katello-cli-common-0.3.1-1.el6_2.noarch
katello-glue-candlepin-0.3.0-2.el6_2.noarch
katello-certs-tools-1.0.6-1.el6.noarch
katello-headpin-0.2.4-3.el6_2.noarch
katello-common-0.3.0-2.el6_2.noarch
katello-headpin-all-0.2.4-3.el6_2.noarch


Actual Results produced :

[root@kvm-guest-04 ~]# rpm -ivh http://tyan-gt24-12.rhts.eng.bos.redhat.com/pub/candlepin-cert-consumer-tyan-gt24-12.rhts.eng.bos.redhat.com-1.0-1.noarch.rpm
Retrieving http://tyan-gt24-12.rhts.eng.bos.redhat.com/pub/candlepin-cert-consumer-tyan-gt24-12.rhts.eng.bos.redhat.com-1.0-1.noarch.rpm
Preparing...                ########################################### [100%]
   1:candlepin-cert-consumer########################################### [100%]


[root@kvm-guest-04 ~]#  subscription-manager register --user admin --password admin --org ACME_Corporation --environment DEV --autosubscribe
The system has been registered with id: 5b546043-5a0d-46e0-a135-84b5783186e2 
Installed Product Current Status:

ProductName:         	Red Hat Enterprise Linux Server
Status:               	Subscribed  


[root@tyan-gt24-12 ~]# headpin -u admin -p admin system list --org ACME_Corporation
--------------------------------------------------------------------------------
                  Systems List For Org [ ACME_Corporation ]

 Name                                   Ipv4 Address   Service Level  
--------------------------------------------------------------------------------
 kvm-guest-04.rhts.eng.bos.redhat.com   None  
                        
[root@tyan-gt24-12 ~]# headpin -u admin -p admin system unregister --help
Usage: headpin [options]

Options:
  -h, --help            show this help message and exit
  -g                    grep friendly output
  -v                    verbose, more structured output
  -d DELIMITER          column delimiter in grep friendly output, works only
                        with option -g
  --org=ORG             organization name (required)
  --name=NAME           system name (required)
  --environment=ENVIRONMENT
                        environment name eg: development


Appropriate option provided to unregister the system is provided