Bug 1715992 - `hammer hostgroup create --environment` always fails
Summary: `hammer hostgroup create --environment` always fails
Keywords:
Status: CLOSED DUPLICATE of bug 1713222
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Hammer - Content
Version: 6.6.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: 6.6.0
Assignee: Jonathon Turel
QA Contact: Roman Plevka
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-05-31 22:03 UTC by Mirek Długosz
Modified: 2019-06-19 19:36 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-06-19 19:36:05 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Mirek Długosz 2019-05-31 22:03:26 UTC
hammer hostgroup create --environment <puppet_environment_name> always fails with error:

Could not create the hostgroup:
  Error: lifecycle_environment not found.


hammer seems to think that --environment is used to specify lifecycle environment, while it's used to specify Puppet environment. 

In /var/log/foreman/production.log, there is:
2019-05-31T20:54:46 [I|app|b7867ca9] Started GET "/katello/api/organizations/7/environments?name=KT_oMHY60_Library_ZYzexpLbxK_5" for 192.168.121.250 at 2019-05-31 20:54:46 +0000

While in Satellite 6.5, there was:
2019-05-31T20:54:18 [I|app|] Started GET "/api/environments?search=name+%3D+%22KT_mvLeiC_Library_RuZbccweCO_4%22" for 192.168.121.164 at 2019-05-31 20:54:18 +0000

Requested endpoints are different and 6.6 one is incorrect.



Steps to Reproduce:
1. Create new Puppet environment
2. hammer hostgroup create --environment="new_environment" --name="hostgroup_name" --query-organization="Default Organization"


Expected results:
New hostgroup is created


Actual results:
Could not create the hostgroup:
  Error: lifecycle_environment not found.

When running with --debug flag, following will be printed:

[DEBUG 2019-05-31T20:35:16 Exception] Using exception handler HammerCLIForeman::ExceptionHandler#handle_general_exception
[ERROR 2019-05-31T20:35:16 Exception] Error: lifecycle_environment not found.
Could not create the hostgroup:
  Error: lifecycle_environment not found.
[ERROR 2019-05-31T20:35:16 Exception] 

HammerCLIForeman::ResolverError (lifecycle_environment not found.):
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.17.0/lib/hammer_cli_foreman/id_resolver.rb:244:in `pick_result'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.17.0/lib/hammer_cli_foreman/id_resolver.rb:201:in `find_resource'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.17.0/lib/hammer_cli_foreman/id_resolver.rb:149:in `get_id'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.17.0/lib/hammer_cli_foreman/id_resolver.rb:137:in `block (2 levels) in define_id_finders'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_katello-0.18.pre.master/lib/hammer_cli_katello/id_resolver.rb:70:in `environment_id'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.17.0/lib/hammer_cli_foreman/commands.rb:131:in `get_resource_id'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.17.0/lib/hammer_cli_foreman/option_sources/id_params.rb:23:in `block in get_options'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.17.0/lib/hammer_cli_foreman/option_sources/id_params.rb:20:in `each'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.17.0/lib/hammer_cli_foreman/option_sources/id_params.rb:20:in `get_options'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.17.1/lib/hammer_cli/options/sources/base.rb:8:in `process'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.17.1/lib/hammer_cli/options/processor_list.rb:22:in `block in process'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.17.1/lib/hammer_cli/options/processor_list.rb:21:in `each'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.17.1/lib/hammer_cli/options/processor_list.rb:21:in `inject'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.17.1/lib/hammer_cli/options/processor_list.rb:21:in `process'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.17.1/lib/hammer_cli/options/processor_list.rb:22:in `block in process'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.17.1/lib/hammer_cli/options/processor_list.rb:21:in `each'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.17.1/lib/hammer_cli/options/processor_list.rb:21:in `inject'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.17.1/lib/hammer_cli/options/processor_list.rb:21:in `process'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.17.1/lib/hammer_cli/options/option_collector.rb:17:in `all_options_raw'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.17.1/lib/hammer_cli/options/option_collector.rb:21:in `all_options'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.17.1/lib/hammer_cli/options/option_collector.rb:25:in `options'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.17.1/lib/hammer_cli/abstract.rb:312:in `options'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.17.1/lib/hammer_cli/abstract.rb:82:in `parse'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:62:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.17.1/lib/hammer_cli/abstract.rb:69:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/subcommand/execution.rb:11:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:63:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.17.1/lib/hammer_cli/abstract.rb:69:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/subcommand/execution.rb:11:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:63:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.17.1/lib/hammer_cli/abstract.rb:69:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:132:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.17.1/bin/hammer:147:in `<top (required)>'
    /bin/hammer:23:in `load'
    /bin/hammer:23:in `<main>'


Versions:
Satellite 6.6 snap 4
tfm-rubygem-hammer_cli-0.17.1-1.el7sat.noarch
satellite-6.6.0-5.beta.el7sat.noarch
foreman-1.22.0-0.5.RC2.1.el7sat.noarch
pulp-server-2.19.0-14.el7sat.noarch
tfm-rubygem-katello-3.12.0.rc2-11.master.el7sat.noarch

Comment 3 Jonathon Turel 2019-06-19 19:36:05 UTC

*** This bug has been marked as a duplicate of bug 1713222 ***


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