Bug #19048

hammer host create doesnt work with --hostgroup-title

Added by Tomáš Strachota 4 months ago. Updated 3 months ago.

Status:Closed
Priority:Normal
Assigned To:Tomáš Strachota
Category:Hosts
Target version:Foreman - Team Marek Iteration 13
Difficulty: Bugzilla link:1436162
Found in release: Pull request:https://github.com/theforeman/hammer-cli-foreman/pull/294
Story points-
Velocity based estimate-

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1436162

Description of problem:
hammer host create doesnt work with --hostgroup-title

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

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

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

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

Associated revisions

Revision 8d79daca
Added by Tomas Strachota 3 months ago

Fixes #19048 - accept hostgroup title in host create

History

#1 Updated by Tomáš Strachota 4 months ago

  • Subject changed from hammer host create doesnt work with --hostgroup-title to hammer host create doesnt work with --hostgroup-title
  • Category changed from Other commands to Hosts
  • Assigned To set to Tomáš Strachota
  • Target version set to Team Marek Iteration 12

#2 Updated by The Foreman Bot 4 months ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/hammer-cli-foreman/pull/294 added

#3 Updated by Marek Hulán 4 months ago

  • Target version changed from Team Marek Iteration 12 to Team Marek Iteration 13

#4 Updated by Anonymous 3 months ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF