Bug 1319079

Summary: Unable to create a host via hammer
Product: Red Hat Satellite Reporter: Andrii Balakhtar <abalakht>
Component: HammerAssignee: Marek Hulan <mhulan>
Status: CLOSED ERRATA QA Contact: Corey Welton <cwelton>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.2.0CC: bbuckingham, cwelton, ehelms
Target Milestone: UnspecifiedKeywords: Regression, Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
URL: http://projects.theforeman.org/issues/13966
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-27 11:23:43 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:

Description Andrii Balakhtar 2016-03-18 15:29:46 UTC
Description of problem:
Cannot create a host via hammer.
If you try to create a host without an interface, hammer throws following error 'Error: At least one interface must be set as primary', 
and if you try to create a host with interface specified - it throws 'Error: ApipieBindings::InvalidArgumentTypesError: host[interfaces_attributes][0] - Hash was expected'

Version-Release number of selected component (if applicable):
Sat6.2 Snap 4

How reproducible:
Always

Steps to Reproduce:
1. Try to create a host with valid data, e.g. 
hammer host create --medium-id="106" --root-pass="test" --mac="#mac#" --organization-id="212" --location-id="211" --architecture-id="104" --operatingsystem-id="102" --name="new_host" --environment-id="99" --domain-id="99" --puppet-proxy-id="1" --partition-table-id="180" --interface="primary=true,provision=true,identifier=enp4s0f0,type=interface,mac=#mac#,ip=#ip#"
2.
3.

Actual results:
Following error message is shown:
Could not create the host:
  Error: ApipieBindings::InvalidArgumentTypesError: host[interfaces_attributes][0] - Hash was expected

Expected results:
Host was successfully created

Additional info:

Comment 2 Marek Hulan 2016-03-23 09:23:00 UTC
This bug combines two issues - first is that primary interface must be specified which was fixed (http://projects.theforeman.org/issues/13927). Second is the attributes error which I linked and is also fixed (http://projects.theforeman.org/issues/13966)

Comment 6 Corey Welton 2016-03-31 16:07:21 UTC
I believe this works now?

# hammer host create --medium-id="9" --root-pass="changeme" --mac="2e-ba-bb-97-45-d6" --organization-id="1" --location-id="1" --architecture-id="1" --operatingsystem-id="1" --name="new_host" --environment-id="1" --domain-id="1" --puppet-proxy-id="1" --partition-table-id="1" --interface="primary=true,provision=true,identifier=enp4s0f0,type=interface,mac=2e-ba-bb-97-45-d6,ip=192.168.1.200" --name "frobble"
[Foreman] Password for admin: 
Host created

Comment 7 Corey Welton 2016-03-31 18:17:19 UTC
Above ^ was executed against SNAP6.  If it is not verified correctly, please reopen, but reading the initial report, I believe this suffices.

Comment 9 Bryan Kearney 2016-07-27 11:23:43 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