Bug 1127572 - Hammer does not work with nested hostgroups with same name [NEEDINFO]
Summary: Hammer does not work with nested hostgroups with same name
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Hammer
Version: 6.0.3
Hardware: Unspecified
OS: Unspecified
unspecified
medium vote
Target Milestone: Unspecified
Assignee: Martin Bacovsky
QA Contact: Corey Welton
URL: http://projects.theforeman.org/issues...
Whiteboard:
Depends On:
Blocks: 1122832
TreeView+ depends on / blocked
 
Reported: 2014-08-07 07:47 UTC by Peter Vreman
Modified: 2019-04-01 20:26 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-07-27 11:19:52 UTC
peter.vreman: needinfo? (tkolhar)


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Foreman Issue Tracker 9318 None None None 2016-04-22 16:22:33 UTC

Description Peter Vreman 2014-08-07 07:47:49 UTC
Description of problem:
Nested hostgroups that have the same name cannot be retrieved on hammer commandline. Specifying the full path/label does not work either:

# hammer -c /opt/hoici/etc/hammer-hoici.yaml --csv hostgroup list --per-page=9999 | grep Server
48,Server,"",,,,41/46
40,Server,"",,,,35/38
# hammer -c /opt/hoici/etc/hammer-hoici.yaml hostgroup info --name=Server
Error: hostgroup found more than once
# hammer -c /opt/hoici/etc/hammer-hoici.yaml hostgroup info --name=prod/Stibo/Server
Error: hostgroup not found

Secondly the list option does also not include the full path. The Label column is always empty

# hammer -c /opt/hoici/etc/hammer-hoici.yaml --csv hostgroup list
Id,Name,Label,Operating System,Environment,Model,Ancestry
52,crash,"",,,,""
53,IPS,"",,,,52
56,CITest,"",,,,52/53
54,Satellite6,"",,,,52/53
55,UserTest,"",,,,52/53
41,dev,"",,,,""


To retrieve the full path 



Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. Create nested hostgroups with duplicate names
2. List hostgroups
3. Info of hostgroup, List/Add puppet classes to hostgroup, etc.

Actual results:

Expected results:
Hostgroup list shall provide Label as unique identifier
All actions on Hostgroups shall allow Label as hostgroup input.

Additional info:

Comment 1 Dominic Cleal 2014-08-07 07:52:03 UTC
Created redmine issue http://projects.theforeman.org/issues/6975 from this bug

Comment 3 Bryan Kearney 2015-03-05 14:19:30 UTC
Connecting redmine issue http://projects.theforeman.org/issues/9318 from this bug

Comment 4 Bryan Kearney 2015-03-05 15:03:06 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/9318 has been closed

Comment 5 Peter Vreman 2015-07-20 14:38:04 UTC
List title in list is fixed in Sat6.1.0:

# hammer -c /opt/hoici/etc/sat6/hammer-hoici.yaml --csv hostgroup list
Id,Name,Title,Operating System,Environment,Model
1,crash,crash,,,
2,Backup,crash/Backup,,,
3,BackupTest,crash/Backup/BackupTest,RedHat 6.5,KT_Hilti_Library_hg_crash_9,
4,FTP,crash/FTP,,,
5,ftp,crash/FTP/ftp,RedHat 6.5,KT_Hilti_Library_hg_crash_9,
6,ldap,crash/FTP/ldap,RedHat 6.5,KT_Hilti_Library_hg_crash_9,
7,ILF,crash/ILF,,,
8,Cluster1,crash/ILF/Cluster1,RedHat 6.5,KT_Hilti_Library_hg_crash_9,
9,Cluster2,crash/ILF/Cluster2,RedHat 6.5,KT_Hilti_Library_hg_crash_9,
10,Gateway1,crash/ILF/Gateway1,RedHat 6.5,KT_Hilti_Library_hg_crash_9,
11,Gateway2,crash/ILF/Gateway2,RedHat 6.5,KT_Hilti_Library_hg_crash_9,

The retrieve by title is still not fixed in Sat6.1.0:

# hammer -c /opt/hoici/etc/sat6/hammer-hoici.yaml --csv hostgroup info --help
Message
"Usage:
    hammer hostgroup info [OPTIONS]

Options:
 --id ID
 --name NAME                   Hostgroup name
 -h, --help                    print help
"


# hammer -c /opt/hoici/etc/sat6/hammer-hoici.yaml --csv hostgroup info --name=crash/Backup/BackupTest
Error: hostgroup not found

Comment 6 Martin Bacovsky 2015-07-20 15:12:49 UTC
Unfortunately this issue was fixed too late to get in 6.1. The fix was merged and released upstream in hammer 0.2.0 and will be present in Satellite 6.2.

There is new option --title and

# hammer -c /opt/hoici/etc/sat6/hammer-hoici.yaml --csv hostgroup info --title=crash/Backup/BackupTest

should work then.

Comment 7 Tazim Kolhar 2015-10-19 11:00:41 UTC
*** This bug is verified in upstream.  This fix should eventually land in future downstream builds ***
Version Tested:
# rpm -qa | grep foreman
nec-em17.rhts.eng.bos.redhat.com-foreman-client-1.0-1.noarch
foreman-1.11.0-0.develop.201510121538gitb6b977a.el7.noarch
tfm-rubygem-hammer_cli_foreman_docker-0.0.3-4.el7.noarch
nec-em17.rhts.eng.bos.redhat.com-foreman-proxy-client-1.0-1.noarch
tfm-rubygem-hammer_cli_foreman-0.4.0-1.201510071112git33fd59b.el7.noarch
foreman-debug-1.11.0-0.develop.201510121538gitb6b977a.el7.noarch
foreman-release-1.11.0-0.develop.201510121538gitb6b977a.el7.noarch
foreman-postgresql-1.11.0-0.develop.201510121538gitb6b977a.el7.noarch
foreman-vmware-1.11.0-0.develop.201510121538gitb6b977a.el7.noarch
tfm-rubygem-foreman_hooks-0.3.9-1.el7.noarch
tfm-rubygem-foreman-tasks-0.7.6-1.fm1_10.el7.noarch
tfm-rubygem-hammer_cli_foreman_tasks-0.0.8-1.el7.noarch
tfm-rubygem-foreman_bootdisk-6.0.0-2.fm1_10.el7.noarch
foreman-release-scl-1-1.el7.x86_64
foreman-libvirt-1.11.0-0.develop.201510121538gitb6b977a.el7.noarch
foreman-selinux-1.11.0-0.develop.201510071426git6234447.el7.noarch
foreman-ovirt-1.11.0-0.develop.201510121538gitb6b977a.el7.noarch
tfm-rubygem-hammer_cli_foreman_bootdisk-0.1.3-3.el7.noarch
tfm-rubygem-foreman_gutterball-0.0.1-3.el7.noarch
nec-em17.rhts.eng.bos.redhat.com-foreman-proxy-1.0-2.noarch
tfm-rubygem-foreman_discovery-4.1.0-1.fm1_10.el7.noarch
tfm-rubygem-foreman_docker-1.4.1-2.fm1_10.el7.noarch
foreman-proxy-1.11.0-0.develop.201510120849git5f36f2e.el7.noarch
foreman-compute-1.11.0-0.develop.201510121538gitb6b977a.el7.noarch
foreman-gce-1.11.0-0.develop.201510121538gitb6b977a.el7.noarch

steps:
# hammer --csv hostgroup list
[Foreman] Password for admin: 
Id,Name,Title,Operating System,Environment,Model
1,host_test_grp,host_test_grp,"","",""
2,host_test_grp1,host_test_grp/host_test_grp1,"","",""

Comment 8 Peter Vreman 2015-10-19 14:45:52 UTC
Please also test the hostgroup info --title as mentioned in the original description and in https://bugzilla.redhat.com/show_bug.cgi?id=1127572#c6

Comment 12 Bryan Kearney 2016-07-27 11:19:52 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://access.redhat.com/errata/RHBA-2016:1501


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