Bug 733270

Summary: Re-registering an already registered system shouldn't be allowed
Product: Red Hat Satellite Reporter: Sachin Ghai <sghai>
Component: katello-agentAssignee: Ivan Necas <inecas>
Status: CLOSED CURRENTRELEASE QA Contact: Katello QA List <katello-qa-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.0.1CC: bkearney, inecas
Target Milestone: Unspecified   
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-08-22 17:53:40 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: 747354    

Description Sachin Ghai 2011-08-25 10:41:19 UTC
Description of problem:
I registered a system from katello cli and tried to re-register the same system with same name and it was successful.

checking info of already registered system:
============================================
[root@dhcp201-167 ~]# katello -u admin -p admin system info --org=ACME_Corporation --name=dhcp201-136.englab.pnq.redhat.com
--------------------------------------------------------------------------------
                System Information For Org [ ACME_Corporation ]
--------------------------------------------------------------------------------

Name:         dhcp201-136.englab.pnq.redhat.com
Uuid:         b7bbc425-134f-4754-a7f5-d605baf44353
Location:     None
Registered:   2011/08/25 15:03:25
Last updated: 2011/08/25 15:03:25
Description:
    Initial Registration Params

[root@dhcp201-167 ~]# katello -u admin -p admin system register --name=dhcp201-136.englab.pnq.redhat.com --org=ACME_Corporation --environment=production
Successfully registered system [ dhcp201-136.englab.pnq.redhat.com ]


[root@dhcp201-167 ~]# katello -u admin -p admin system register --name=dhcp201-136.englab.pnq.redhat.com --org=ACME_Corporation --environment=production
Successfully registered system [ dhcp201-136.englab.pnq.redhat.com ]


Repetitive listing of same system:
================================== 

[root@dhcp201-167 ~]# katello -u admin -p admin system list --org=ACME_Corporation
-------------------------------------------------------------------------------
                   Systems List For Org [ ACME_Corporation ]

 Name                               
-------------------------------------------------------------------------------
 dhcp201-167.englab.pnq.redhat.com  
 dhcp201-136.englab.pnq.redhat.com  
 dhcp201-136.englab.pnq.redhat.com  
 dhcp201-136.englab.pnq.redhat.com  
[root@dhcp201-167 ~]# 


Version-Release number of selected component (if applicable):
[root@dhcp201-167 ~]# rpm -qa | grep katello
katello-cli-0.1.5-1.git.15.654a7df.fc15.noarch
katello-0.1.70-1.git.7.ca8d03c.fc15.noarch
[root@dhcp201-167 ~]# 


How reproducible:
always

Steps to Reproduce:
1. register a system
2. re-register the same system

  
Actual results:
I can register a system multiple times and with same name.

Expected results:
Re-registering an already registered system shouldn't be allowed. A message should be thrown like: The specified system <name> is already registered.

Additional info:

Comment 1 Ivan Necas 2011-09-19 15:22:36 UTC
Validation added in commit b2ba6a8838edf7ccffb5cca1fdb69ace3489a376.

Note:
The registration of the system using different name still works.

Question for bkearney:
Should be katello-cli able to prevent from registering the system twice using different names, something like subscription manager does?

Comment 2 Bryan Kearney 2011-10-07 12:39:00 UTC
I dont believe so. The Katello CLI is an admin tool.. so I should be able to register lots of different machines. Subscription-manager i registering "this" machine, so it makes sense to stop from double registering.

Comment 3 Sachin Ghai 2011-12-06 09:11:15 UTC
I was verifying this defect with following build:

[root@dhcp193-175 f15]# rpm -qa | grep katello
katello-repos-0.1.4-1.el6.noarch
katello-cli-0.1.20-1.el6.noarch
katello-glue-pulp-0.1.123-1.el6.x86_64
katello-cli-common-0.1.20-1.el6.noarch
katello-glue-foreman-0.1.123-1.el6.x86_64
katello-configure-0.1.21-1.el6.noarch
katello-glue-candlepin-0.1.123-1.el6.x86_64
katello-common-0.1.123-1.el6.noarch
katello-0.1.123-1.el6.x86_64
katello-all-0.1.123-1.el6.x86_64


Following system was already registered.

[root@dhcp193-175 f15]# katello -u admin -p admin system list --org ACME_Corporation
--------------------------------------------------------------------------------
                   Systems List For Org [ ACME_Corporation ]

 Name                               
--------------------------------------------------------------------------------
 dhcp201-191.englab.pnq.redhat.com  


If you re-register the same machine and within same env, you will get the validation failed error twice as below.. 

katello> system register --name dhcp201-191.englab.pnq.redhat.com --org ACME_Corporation --env test
Validation failed: Name has already been taken, Name has already been taken


Here message contains "Name has already been taken" twice and it needs to be corrected.

Comment 4 Sachin Ghai 2011-12-23 11:33:49 UTC
Verified in following katello build:

[root@dhcp201-162 ~]# rpm -qa | grep katello
katello-0.1.154-1.el6.noarch
katello-trusted-ssl-cert-1.0-1.noarch
katello-cli-common-0.1.30-1.el6.noarch
katello-glue-pulp-0.1.154-1.el6.noarch
katello-configure-0.1.46-1.el6.noarch
katello-qpid-broker-key-pair-1.0-1.noarch
katello-glue-candlepin-0.1.154-1.el6.noarch
katello-all-0.1.154-1.el6.noarch
katello-repos-0.1.4-1.el6.noarch
katello-cli-0.1.30-1.el6.noarch
katello-glue-foreman-0.1.154-1.el6.noarch
katello-common-0.1.154-1.el6.noarch
katello-certs-tools-1.0.1-1.el6.noarch
katello-httpd-ssl-key-pair-1.0-1.noarch


Registering the same system twice in same org and env throws proper validation message:

katello> system register --name dhcp201-139.englab.pnq.redhat.com --org ACME_Corporation --env test
Validation failed: Name has already been taken

Comment 7 Mike McCune 2013-08-16 18:05:15 UTC
getting rid of 6.0.0 version since that doesn't exist