Project

General

Profile

Actions

Bug #24060

closed

hammer host create using wrong API endpoint to list environments

Added by Ivan Necas over 6 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Hosts
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

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


Related issues 1 (0 open1 closed)

Related to Katello - Bug #22517: Can't create a hostgroup, organization errorClosedMartin Bacovsky02/06/2018Actions
Actions

Also available in: Atom PDF