Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1583597 - hammer host create using wrong API endpoint to list environments
Summary: hammer host create using wrong API endpoint to list environments
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Hosts - Content
Version: 6.4
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: 6.4.0
Assignee: Ivan Necas
QA Contact: Ondřej Pražák
URL:
Whiteboard:
: 1595188 1598569 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-05-29 10:38 UTC by Roman Plevka
Modified: 2019-11-05 23:21 UTC (History)
13 users (show)

Fixed In Version: tfm-rubygem-hammer_cli_katello-0.13.3-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-10-16 19:31:12 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
foreman logs when creating host via hammer (4.13 KB, text/plain)
2018-07-17 09:25 UTC, Ondřej Pražák
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 24060 0 None None None 2018-06-25 11:42:39 UTC
Red Hat Bugzilla 1595188 0 unspecified CLOSED `hammer host create --environment='...' ...` complains about missing lifecycle_environment 2021-02-22 00:41:40 UTC

Internal Links: 1595188

Description Roman Plevka 2018-05-29 10:38:57 UTC
Description of problem:
this is a regression since 6.3.
`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:

<pre>
# 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,
</pre>


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

Version-Release number of selected component (if applicable):
6.4.0-1

How reproducible:
always

Steps to Reproduce:
1. try to create a host using hammer with specifying an --environment parameter

Comment 2 Marek Hulan 2018-05-29 15:44:45 UTC
Isn't this fixed by http://projects.theforeman.org/issues/22517/ could you check packages versions and compare them to the list in linked issue?

Comment 3 Ivan Necas 2018-06-25 11:40:26 UTC
I was able to reproduce the issue: the problem is we are using the customized resolver in the hostgroup but not in host command. Will send a fix upstream.

Comment 4 Ivan Necas 2018-06-25 11:42:35 UTC
Created redmine issue https://projects.theforeman.org/issues/24060 from this bug

Comment 5 Ivan Necas 2018-06-25 11:48:54 UTC
Proposed fix at https://github.com/Katello/hammer-cli-katello/pull/566

Comment 6 Satellite Program 2018-06-25 16:15:28 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/24060 has been resolved.

Comment 8 Ondřej Pražák 2018-07-17 09:25:53 UTC
Created attachment 1459373 [details]
foreman logs when creating host via hammer

Comment 9 Ivan Necas 2018-07-17 09:42:37 UTC
*** Bug 1595188 has been marked as a duplicate of this bug. ***

Comment 10 Roman Plevka 2018-07-17 12:04:16 UTC
*** Bug 1598569 has been marked as a duplicate of this bug. ***

Comment 11 Roman Plevka 2018-07-17 12:06:26 UTC
verified

since snap#11.
the lce is now properly recognized.

verified by automaed tests:
596322f6-9fdc-441a-a36d-ae2f22132b38
26e406ea-56f5-4813-bb93-e908c9015ee3
...

Comment 13 Bryan Kearney 2018-10-16 19:31:12 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/RHSA-2018:2927


Note You need to log in before you can comment on or make changes to this bug.