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 1154611

Summary: Content host can be created with same name more than once
Product: Red Hat Satellite Reporter: Tazim Kolhar <tkolhar>
Component: HammerAssignee: Katello Bug Bin <katello-bugs>
Status: CLOSED WORKSFORME QA Contact: Tazim Kolhar <tkolhar>
Severity: medium Docs Contact:
Priority: unspecified    
Version: NightlyCC: cwelton, oshtaier
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-04-13 08:34:14 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:
Attachments:
Description Flags
content host none

Description Tazim Kolhar 2014-10-20 10:05:22 UTC
Created attachment 948486 [details]
content host

Description of problem:
Content host can be created with name same more than once

Version-Release number of selected component (if applicable):
# rpm -qa | grep foreman
ruby193-rubygem-foreman_bootdisk-4.0.0-1.el7.noarch
foreman-proxy-1.7.0-0.develop.201410170812git8aa4e0f.el7.noarch
foreman-ovirt-1.7.0-0.develop.201410171840git6be0508.el7.noarch
rhel7abrt.usersys.redhat.com-foreman-proxy-1.0-1.noarch
foreman-compute-1.7.0-0.develop.201410171840git6be0508.el7.noarch
ruby193-rubygem-foreman_hooks-0.3.7-2.el7.noarch
foreman-libvirt-1.7.0-0.develop.201410171840git6be0508.el7.noarch
foreman-postgresql-1.7.0-0.develop.201410171840git6be0508.el7.noarch
foreman-1.7.0-0.develop.201410171840git6be0508.el7.noarch
foreman-vmware-1.7.0-0.develop.201410171840git6be0508.el7.noarch
foreman-release-1.7.0-0.develop.201410171840git6be0508.el7.noarch
foreman-selinux-1.7.0-0.develop.201409301113git2f345de.el7.noarch
rubygem-hammer_cli_foreman_tasks-0.0.3-2.201409091410git163c264.git.0.988ca80.el7.noarch
rhel7abrt.usersys.redhat.com-foreman-client-1.0-1.noarch
foreman-gce-1.7.0-0.develop.201410171840git6be0508.el7.noarch
rubygem-hammer_cli_foreman-0.1.3-1.201410151235gitbc8c449.el7.noarch
ruby193-rubygem-foreman-tasks-0.6.9-1.el7.noarch
ruby193-rubygem-foreman_discovery-1.4.0-0.1.rc4.el7.noarch


How reproducible:
everytime

Steps to Reproduce:
1.# hammer -v -u admin -p ****  --output csv content-host create --name='test_host' --lifecycle-environment-id='20' --content-view-id='20' --organization-id='12' --description='msxraRPlApsiWVSQMRga'
Name,ID,Katello Agent Installed,Description,Location,Lifecycle Environment,Content View,Entitlement Status,Release Version,Autoheal
test_host,f4d5ad51-e5d8-4047-9798-997a189a7507,false,msxraRPlApsiWVSQMRga,None,Library,Default Organization View,valid,"",true
Message,Id,Name
Content host created,f4d5ad51-e5d8-4047-9798-997a189a7507,test_host

2.# hammer -v -u admin -p ***  --output csv content-host create --name='test_host' --lifecycle-environment-id='20' --content-view-id='20' --organization-id='12' --description='msxraRPlApsiWVSQMRga'
Name,ID,Katello Agent Installed,Description,Location,Lifecycle Environment,Content View,Entitlement Status,Release Version,Autoheal
test_host,dc08db1b-ab70-4b42-a8ac-57a44b048fb2,false,msxraRPlApsiWVSQMRga,None,Library,Default Organization View,valid,"",true
Message,Id,Name
Content host created,dc08db1b-ab70-4b42-a8ac-57a44b048fb2,test_host

3.

Actual results:
content host with same name can be created more than once

Expected results:
content host names must be unique

Additional info:
screen shot attached

Comment 1 RHEL Program Management 2014-10-20 10:23:01 UTC
Since this issue was entered in Red Hat Bugzilla, the release flag has been
set to ? to ensure that it is properly evaluated for this release.

Comment 3 Oleksandr Shtaier 2016-04-13 08:33:40 UTC
Error is a little bit weird, but we cannot create new content host with a name of existing entity

>hammer -u user -p pass content-host create --content-view-id=1707 --lifecycle-environment-id=1640 --organization-id=1731 --description=test123 --name=test11225
Name:                    test11225
ID:                      74d1dc25-1679-4c79-9b51-6a6d1cd96d64
Katello Agent Installed: no
Description:             
Location:                None
Lifecycle Environment:   Library
Content View:            Default Organization View
Entitlement Status:      valid
Release Version:         
Autoheal:                true
Security Errata:         0
Bugfix Errata:           0
Enhancement Errata:      0

Content host created

>hammer -u user -p pass content-host create --content-view-id=1707 --lifecycle-environment-id=1640 --organization-id=1731 --description=test123 --name=test11225
Could not create content host:
  ERROR:  null value in column "host_id" violates not-null constraint
  DETAIL:  Failing row contains (1346, null, 29, null, 2016-04-13 08:30:56.183079, 2016-04-13 08:30:56.183079).