Actions
Bug #24060
closedhammer host create using wrong API endpoint to list environments
Difficulty:
Triaged:
Bugzilla link:
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1583597
Description of problem:
`hammer host create` accepts a --environment parameter (which is supposed to be a puppet environment). However, on specifying this, it uses the API endpoint of katello environments, which are lifecycle environments:
# hammer -d -u admin -p changeme --output=csv host create --medium-id="31" --ip="142.89.31.218" --location-id="2" --operatingsystem-id="2" --environment="KT_QrEczI_Library_pTBRPfBmGb_168" --domain-id="18" --partition-table-id="91" --mac="86:fa:fa:27:ef:0a" --organization-id="127" --architecture-id="1" --name="GkhWDIhihR" --puppet-classes="generic_1" --root-password="vERLTilA" ... ... [ INFO 2018-05-29T06:34:03 API] GET /katello/api/organizations/127/environments [DEBUG 2018-05-29T06:34:03 API] Params: { "name" => "KT_QrEczI_Library_pTBRPfBmGb_168" } [DEBUG 2018-05-29T06:34:03 API] Headers: { :params => { "name" => "KT_QrEczI_Library_pTBRPfBmGb_168" } } [DEBUG 2018-05-29T06:34:03 API] Using authenticator: HammerCLIForeman::Api::InteractiveBasicAuth [DEBUG 2018-05-29T06:34:03 API] Response: { "total" => 0, "subtotal" => 0,
This obviously always fails to create a host if the --environment parameter is specified.
the correct endpoint to be queried is:
/api/v2/organizations/<id>/environments
How reproducible:
always
Steps to Reproduce:
1. try to create a host using hammer with specifying an --environment parameter
Actions