Project

General

Profile

Actions

Bug #24060

closed

hammer host create using wrong API endpoint to list environments

Added by Ivan Necas almost 6 years ago. Updated almost 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 #1

Updated by Ivan Necas almost 6 years ago

  • Related to Bug #22517: Can't create a hostgroup, organization error added
Actions #2

Updated by The Foreman Bot almost 6 years ago

  • Status changed from New to Ready For Testing
  • Assignee set to Ivan Necas
  • Pull request https://github.com/Katello/hammer-cli-katello/pull/566 added
Actions #3

Updated by Ivan Necas almost 6 years ago

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

Updated by Andrew Kofink almost 6 years ago

  • Subject changed from hammer host create using wrong API endpoint to list environments to hammer host create using wrong API endpoint to list environments
  • translation missing: en.field_release set to 338
Actions

Also available in: Atom PDF