Description of problem: hammer host create doesnt work with --hostgroup-title Version-Release number of selected component (if applicable): How reproducible: 100% Steps to Reproduce: 1. create 2 nested host groups with the lowest hostgroub being non-unique 2. try to create a host with the hammer command using --hostgroup-title and not --hostgroup 3. Actual results: Command fials Expected results: Host created Additional info: We use nested hostgroups and one of the layers of nesting is the DC name (p1 or p2). We have created hostgroups under these 2 locations that represent our lifecycle environments - dit100 sit100 etc. hg-rhel6-base/p1/sit100 hg-rhel6-basep1/dit100 ... hg-rhel6-base/p2/sit100 hg-rhel6-base/p2/dit100 ... etc As the hostgroup name (dit100) is not unique, we cant use --hostgroup with hammer host create as it finds more than one hostgroup that matches. We were happy to see that we could use --hostgroup-title as these ARE unique but the command fails [root@lmi-sat001-p1 ~]# hammer host create --name tdi-tst242 --hostgroup-title "hg-rhel6-base/p1/dit100-p1" --ip 172.31.5.242 --compute-resource 'VMware DC1' --compute-profile 1-Small --location P1 --organization TLG Could not create the host: Error: Options --environment-id, --architecture-id, --domain-id, --puppet-proxy-id, --operatingsystem-id, --partition-table-id are required See: 'hammer host create --help' As a work around we have added the DC name to each hostgorup to make it unique but this means duplicating info in the name [root@lmi-sat001-p1 ~]# hammer host create --name tdi-tst242-p1 --hostgroup dit100-p1 --ip 172.31.5.242 --compute-resource 'VMware DC1' --compute-profile 1-Small --location P1 --organization TLG Host created
Created redmine issue http://projects.theforeman.org/issues/19048 from this bug
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/19048 has been resolved.
Waiting for next build, but at this moment functionality doesn't work as it should. Verified by test automation script: LANG=en_US.UTF-8 hammer -v -u admin -p changeme --output=csv host create --ip="104.31.75.150" --location-id="278" --hostgroup-title="pDSZMUBWXw/LNrkRTRlXf" --mac="86:bc:d6:a3:f1:2c" --organization-id="279" --name="kypokqcdxg" --root-password="xMiaPauT" robottelo.ssh: INFO: <<< stderr Error: At least one of options --architecture, --architecture-id is required See: 'hammer host create --help' Could not create the host: Error: At least one of options --architecture, --architecture-id is required See: 'hammer host create --help' [ERROR 2017-08-01 08:07:49 Exception] Clamp::UsageError (At least one of options --architecture, --architecture-id is required): /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.2/lib/hammer_cli/abstract.rb:44:in `rescue in parse' /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.2/lib/hammer_cli/abstract.rb:40:in `parse' /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:67:in `run' /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.2/lib/hammer_cli/abstract.rb:29:in `run' /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/subcommand/execution.rb:11:in `execute' /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run' /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.2/lib/hammer_cli/abstract.rb:29:in `run' /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/subcommand/execution.rb:11:in `execute' /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run' /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.2/lib/hammer_cli/abstract.rb:29:in `run' /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:133:in `run' /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.2/bin/hammer:147:in `<top (required)>' /usr/bin/hammer:23:in `load' /usr/bin/hammer:23:in `<main>' Note: Works properly with hostgroup ID
Automation tests still for versions: * candlepin-2.0.40-1.el7.noarch * candlepin-selinux-2.0.40-1.el7.noarch * foreman-1.15.2-1.el7sat.noarch * foreman-cli-1.15.2-1.el7sat.noarch * foreman-compute-1.15.2-1.el7sat.noarch * foreman-debug-1.15.2-1.el7sat.noarch * foreman-discovery-image-3.1.1-22.el7sat.noarch * foreman-ec2-1.15.2-1.el7sat.noarch * foreman-gce-1.15.2-1.el7sat.noarch * foreman-installer-1.15.2-1.el7sat.noarch * foreman-installer-katello-3.4.4-1.el7sat.noarch * foreman-libvirt-1.15.2-1.el7sat.noarch * foreman-openstack-1.15.2-1.el7sat.noarch * foreman-ovirt-1.15.2-1.el7sat.noarch * foreman-postgresql-1.15.2-1.el7sat.noarch * foreman-proxy-1.15.2-1.el7sat.noarch * foreman-rackspace-1.15.2-1.el7sat.noarch * foreman-selinux-1.15.2-1.el7sat.noarch * foreman-vmware-1.15.2-1.el7sat.noarch * katello-3.4.4-2.el7sat.noarch * katello-ca-consumer-sat-r220-02.lab.eng.rdu2.redhat.com-1.0-4.noarch * katello-certs-tools-2.4.0-1.el7sat.noarch * katello-client-bootstrap-1.4.0-1.el7sat.noarch * katello-common-3.4.4-2.el7sat.noarch * katello-debug-3.4.4-2.el7sat.noarch * katello-default-ca-1.0-1.noarch * katello-installer-base-3.4.4-1.el7sat.noarch * katello-selinux-3.0.2-1.el7sat.noarch * katello-server-ca-1.0-1.noarch * katello-service-3.4.4-2.el7sat.noarch * openldap-2.4.44-5.el7.x86_64 * pulp-client-1.0-1.noarch * pulp-docker-plugins-2.3.0-1.el7sat.noarch * pulp-katello-1.0.2-1.el7sat.noarch * pulp-ostree-plugins-1.2.1-1.el7sat.noarch * pulp-puppet-plugins-2.12.2-1.el7sat.noarch * pulp-puppet-tools-2.12.2-1.el7sat.noarch * pulp-rpm-plugins-2.12.2-2.el7sat.noarch * pulp-selinux-2.12.2-2.el7sat.noarch * pulp-server-2.12.2-2.el7sat.noarch * python-ldap-2.4.15-2.el7.x86_64 * tfm-rubygem-ldap_fluff-0.4.6-1.el7sat.noarch * tfm-rubygem-net-ldap-0.15.0-1.el7sat.noarch test log: 2017-08-05 11:14:33 - robottelo.ssh - INFO - >>> LANG=en_US.UTF-8 hammer -v -u admin -p changeme --output=csv host create --ip="151.45.230.209" --location-id="110" --hostgroup-title="uDnrQeuqmm/ldmhsdLaTQ" --mac="e6:bf:b5:77:b4:67" --organization-id="111" --name="rcmvmdvnrt" --root-password="cqsFThIf" 2017-08-05 11:14:35 - robottelo.ssh - INFO - <<< stderr [ERROR 2017-08-05 11:14:35 Exception] Error: At least one of options --architecture, --architecture-id is required See: 'hammer host create --help' Could not create the host: Error: At least one of options --architecture, --architecture-id is required See: 'hammer host create --help' [ERROR 2017-08-05 11:14:35 Exception] Clamp::UsageError (At least one of options --architecture, --architecture-id is required): /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.2/lib/hammer_cli/abstract.rb:44:in `rescue in parse' /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.2/lib/hammer_cli/abstract.rb:40:in `parse' /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:67:in `run' /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.2/lib/hammer_cli/abstract.rb:29:in `run' /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/subcommand/execution.rb:11:in `execute' /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run' /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.2/lib/hammer_cli/abstract.rb:29:in `run' /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/subcommand/execution.rb:11:in `execute' /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run' /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.2/lib/hammer_cli/abstract.rb:29:in `run' /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:133:in `run' /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.2/bin/hammer:147:in `<top (required)>' /usr/bin/hammer:23:in `load' /usr/bin/hammer:23:in `<main>'
The reason why this bug failed qe is because it was delivered in hammer-cli-foreman 0.11.0, while we have 0.10.2 in Sat 6.3. I'm not sure if the upstream is going to release 0.10.x for this or we will cherry-pick, anyway, setting to POST state, as the reason for the failure was missed patch.
Verified by test automation script hammer -v -u admin -p changeme --output=csv host create --ip="30.126.116.189" --location-id="65" --hostgroup-title="DcBxVxDVjl/eYIYIFHghn" --mac="60:de:43:70:a4:23" --organization-id="66" --name="bilpukwols" --root-password="HSwasHjs" Message,Id,Name Host created,33,bilpukwols.eorxc692do
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/RHSA-2018:0336