Project

General

Profile

Bug #22517

Can't create a hostgroup, organization error

Added by Stephen Benjamin over 3 years ago. Updated about 3 years ago.

Status:
Closed
Priority:
Normal
Category:
Hammer
Target version:
Difficulty:
Triaged:
Bugzilla link:

Description

Here's what I have installed:

tfm-rubygem-hammer_cli_foreman_docker-0.0.4-3.el7.noarch
tfm-rubygem-hammer_cli_foreman-0.12.pre.develop-2.201802011401git170e7d8.el7.noarch
tfm-rubygem-hammer_cli_katello-0.11.0-1.201802051800git8a9f851.el7.noarch
tfm-rubygem-hammer_cli-0.12.pre.develop-2.201802011449gitd5dff2d.el7.noarch
tfm-rubygem-hammer_cli_foreman_tasks-0.0.12-2.fm1_17.el7.noarch
tfm-rubygem-hammer_cli_foreman_bootdisk-0.1.3-6.el7.noarch

Trying to create a host group I get an error:

[root@centos7-provision-koji ~]# hammer -u admin -p changeme -d -vvvv hostgroup create --name 'Forklift Base' --architecture x86_64 --domain zpm.example.com --environment production --puppet-ca-proxy-id 1 --puppet-proxy-id 1 --subnet '192.168.73.0/24' --root-pass changeme --organization-ids 1
[ INFO 2018-02-06T16:06:41 Init] Initialization of Hammer CLI (0.12.pre.develop) has started...
[DEBUG 2018-02-06T16:06:41 Init] Running at ruby 2.4.0-p0
[ INFO 2018-02-06T16:06:41 Init] Configuration from the file /etc/hammer/cli_config.yml has been loaded
[ INFO 2018-02-06T16:06:41 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman.yml has been loaded
[ INFO 2018-02-06T16:06:41 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_bootdisk.yml has been loaded
[ INFO 2018-02-06T16:06:41 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_docker.yml has been loaded
[ INFO 2018-02-06T16:06:41 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_tasks.yml has been loaded
[ INFO 2018-02-06T16:06:41 Init] Configuration from the file /etc/hammer/cli.modules.d/katello.yml has been loaded
[ INFO 2018-02-06T16:06:41 Init] Configuration from the file /root/.hammer/cli.modules.d/foreman.yml has been loaded
[DEBUG 2018-02-06T16:06:41 SSLoptions] SSL options: {
    :ssl_ca_file => "/etc/pki/katello/certs/katello-server-ca.crt",
     :verify_ssl => true
}
[DEBUG 2018-02-06T16:06:41 API] Global headers: {
        :content_type => "application/json",
              :accept => "application/json;version=2",
    "Accept-Language" => "en" 
}
[DEBUG 2018-02-06T16:06:41 API] Follow redirects: never
[DEBUG 2018-02-06T16:06:41 Connection] Registered: foreman
[ INFO 2018-02-06T16:06:41 Modules] Extension module hammer_cli_foreman (0.12.pre.develop) loaded.
[ INFO 2018-02-06T16:06:41 Modules] Extension module hammer_cli_foreman_bootdisk (0.1.3) loaded.
[ INFO 2018-02-06T16:06:41 HammerCLI::MainCommand] subcommand organization (HammerCLIForeman::Organization) was removed.
[ INFO 2018-02-06T16:06:41 HammerCLI::MainCommand] subcommand organization (HammerCLIKatello::Organization) was created.
[ INFO 2018-02-06T16:06:41 Modules] Extension module hammer_cli_katello (0.11.0) loaded.
[DEBUG 2018-02-06T16:06:41 Init] Using locale 'en'
[DEBUG 2018-02-06T16:06:41 Init] 'mo' files for locale domain 'hammer-cli' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.12.pre.develop/locale'
[DEBUG 2018-02-06T16:06:41 Init] 'mo' files for locale domain 'hammer-cli-foreman' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.12.pre.develop/locale'
[DEBUG 2018-02-06T16:06:41 Init] 'mo' files for locale domain 'hammer_cli_foreman_docker' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman_docker-0.0.4/locale'
[DEBUG 2018-02-06T16:06:41 Init] 'mo' files for locale domain 'hammer-cli-katello' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_katello-0.11.0/locale'
[ INFO 2018-02-06T16:06:41 HammerCLI::MainCommand] Called with options: {"option_verbose"=>true, "option_debug"=>true, "option_username"=>"admin", "option_password"=>"***"}
[ INFO 2018-02-06T16:06:41 HammerCLIForeman::Hostgroup] Called with options: {}
[ INFO 2018-02-06T16:06:41 HammerCLIForeman::Hostgroup::CreateCommand] Error occured while searching for environment
[DEBUG 2018-02-06T16:06:41 Exception] Using exception handler HammerCLIForeman::ExceptionHandler#handle_general_exception
[ERROR 2018-02-06T16:06:41 Exception] Error: Could not find organization, please set one of options --organizations, --organization-titles, --organization-ids.
Could not create the hostgroup:
  Error: Could not find organization, please set one of options --organizations, --organization-titles, --organization-ids.
[ERROR 2018-02-06T16:06:41 Exception] 

HammerCLIForeman::MissingSearchOptions (Could not find organization, please set one of options --organizations, --organization-titles, --organization-ids.):
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.12.pre.develop/lib/hammer_cli_foreman/option_sources/id_params.rb:33:in `rescue in get_options'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.12.pre.develop/lib/hammer_cli_foreman/option_sources/id_params.rb:11:in `get_options'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.12.pre.develop/lib/hammer_cli/options/option_collector.rb:13:in `block in all_options_raw'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.12.pre.develop/lib/hammer_cli/options/option_collector.rb:12:in `each'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.12.pre.develop/lib/hammer_cli/options/option_collector.rb:12:in `inject'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.12.pre.develop/lib/hammer_cli/options/option_collector.rb:12:in `all_options_raw'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.12.pre.develop/lib/hammer_cli/options/option_collector.rb:18:in `all_options'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.12.pre.develop/lib/hammer_cli/options/option_collector.rb:22:in `options'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.12.pre.develop/lib/hammer_cli/abstract.rb:239:in `options'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.12.pre.develop/lib/hammer_cli/abstract.rb:42: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.12.pre.develop/lib/hammer_cli/abstract.rb:29: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.12.pre.develop/lib/hammer_cli/abstract.rb:29: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.12.pre.develop/lib/hammer_cli/abstract.rb:29: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.12.pre.develop/bin/hammer:142:in `<top (required)>'
    /bin/hammer:22:in `load'
    /bin/hammer:22:in `<main>'

Related issues

Related to Katello - Bug #24060: hammer host create using wrong API endpoint to list environmentsClosed2018-06-25

Associated revisions

Revision a0ce4454 (diff)
Added by Martin Bacovsky over 3 years ago

Fixes #22517 - Resolvables compatible with option sources (#542)

  • Fixes #22517 - Resolvables compatible with option sources
  • Resolvables refactoring
  • Whitespace fixes
  • Removing unused method

History

#1 Updated by Martin Bacovsky over 3 years ago

  • Target version set to 247
  • Assignee set to Martin Bacovsky
  • Status changed from New to Assigned
  • Category changed from Foreman commands (obsolete) to Hammer
  • Project changed from Hammer CLI to Katello

The issue is a regression introduced with recent patch in hammer core that breaks some resolvers in hammer-cli-katello.
If you specify --environment-id instead of --environment it should work as a workaround.

#2 Updated by The Foreman Bot over 3 years ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/Katello/hammer-cli-katello/pull/542 added

#3 Updated by Justin Sherrill over 3 years ago

  • Legacy Backlogs Release (now unused) set to 339

#4 Updated by Martin Bacovsky over 3 years ago

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

#5 Updated by Jan Hutař over 3 years ago

Hello.
I have attempted to test this. First I have reproduced on my Foreman nightly installed yesterday:

[root@foreman-nightly ~]# hammer -u admin -p changeme -d -vvvv hostgroup create --name 'Forklift Base' --architecture x86_64 --domain zpm.example.com --environment production --puppet-ca-proxy-id 1 --puppet-proxy-id 1 --subnet '192.168.73.0/24' --root-pass changeme --organization-ids 1
[ INFO 2018-02-23T12:31:45 Init] Initialization of Hammer CLI (0.12.pre.develop) has started...
[DEBUG 2018-02-23T12:31:45 Init] Running at ruby 2.4.0-p0
[ INFO 2018-02-23T12:31:45 Init] Configuration from the file /etc/hammer/cli_config.yml has been loaded
[ INFO 2018-02-23T12:31:45 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman.yml has been loaded
[ INFO 2018-02-23T12:31:45 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_bootdisk.yml has been loaded
[ INFO 2018-02-23T12:31:45 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_docker.yml has been loaded
[ INFO 2018-02-23T12:31:45 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_tasks.yml has been loaded
[ INFO 2018-02-23T12:31:45 Init] Configuration from the file /etc/hammer/cli.modules.d/katello.yml has been loaded
[ INFO 2018-02-23T12:31:45 Init] Configuration from the file /root/.hammer/cli.modules.d/foreman.yml has been loaded
[DEBUG 2018-02-23T12:31:45 SSLoptions] SSL options: {
    :ssl_ca_file => "/etc/pki/katello/certs/katello-server-ca.crt",
     :verify_ssl => true
}
[DEBUG 2018-02-23T12:31:45 API] Global headers: {
        :content_type => "application/json",
              :accept => "application/json;version=2",
    "Accept-Language" => "en" 
}
[DEBUG 2018-02-23T12:31:45 API] Follow redirects: never
[DEBUG 2018-02-23T12:31:45 Connection] Registered: foreman
[ INFO 2018-02-23T12:31:45 Modules] Extension module hammer_cli_foreman (0.12.pre.develop) loaded.
[ INFO 2018-02-23T12:31:45 Modules] Extension module hammer_cli_foreman_bootdisk (0.1.3) loaded.
[ INFO 2018-02-23T12:31:45 HammerCLI::MainCommand] subcommand organization (HammerCLIForeman::Organization) was removed.
[ INFO 2018-02-23T12:31:45 HammerCLI::MainCommand] subcommand organization (HammerCLIKatello::Organization) was created.
[ INFO 2018-02-23T12:31:45 Modules] Extension module hammer_cli_katello (0.11.0) loaded.
[DEBUG 2018-02-23T12:31:45 Init] Using locale 'en'
[DEBUG 2018-02-23T12:31:45 Init] 'mo' files for locale domain 'hammer-cli' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.12.pre.develop/locale'
[DEBUG 2018-02-23T12:31:45 Init] 'mo' files for locale domain 'hammer-cli-foreman' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.12.pre.develop/locale'
[DEBUG 2018-02-23T12:31:45 Init] 'mo' files for locale domain 'hammer_cli_foreman_docker' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman_docker-0.0.4/locale'
[DEBUG 2018-02-23T12:31:45 Init] 'mo' files for locale domain 'hammer-cli-katello' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_katello-0.11.0/locale'
[ INFO 2018-02-23T12:31:45 HammerCLI::MainCommand] Called with options: {"option_verbose"=>true, "option_debug"=>true, "option_username"=>"admin", "option_password"=>"***"}
[ INFO 2018-02-23T12:31:45 HammerCLIForeman::Hostgroup] Called with options: {}
[ INFO 2018-02-23T12:31:46 HammerCLIForeman::Hostgroup::CreateCommand] Error occured while searching for environment
[DEBUG 2018-02-23T12:31:46 Exception] Using exception handler HammerCLIForeman::ExceptionHandler#handle_general_exception
[ERROR 2018-02-23T12:31:46 Exception] Error: Could not find organization, please set one of options --organizations, --organization-titles, --organization-ids.
Could not create the hostgroup:
  Error: Could not find organization, please set one of options --organizations, --organization-titles, --organization-ids.
[ERROR 2018-02-23T12:31:46 Exception] 

HammerCLIForeman::MissingSearchOptions (Could not find organization, please set one of options --organizations, --organization-titles, --organization-ids.):
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.12.pre.develop/lib/hammer_cli_foreman/option_sources/id_params.rb:33:in `rescue in get_options'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.12.pre.develop/lib/hammer_cli_foreman/option_sources/id_params.rb:11:in `get_options'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.12.pre.develop/lib/hammer_cli/options/option_collector.rb:13:in `block in all_options_raw'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.12.pre.develop/lib/hammer_cli/options/option_collector.rb:12:in `each'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.12.pre.develop/lib/hammer_cli/options/option_collector.rb:12:in `inject'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.12.pre.develop/lib/hammer_cli/options/option_collector.rb:12:in `all_options_raw'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.12.pre.develop/lib/hammer_cli/options/option_collector.rb:18:in `all_options'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.12.pre.develop/lib/hammer_cli/options/option_collector.rb:22:in `options'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.12.pre.develop/lib/hammer_cli/abstract.rb:239:in `options'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.12.pre.develop/lib/hammer_cli/abstract.rb:42: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.12.pre.develop/lib/hammer_cli/abstract.rb:29: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.12.pre.develop/lib/hammer_cli/abstract.rb:29: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.12.pre.develop/lib/hammer_cli/abstract.rb:29: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.12.pre.develop/bin/hammer:142:in `<top (required)>'
    /usr/bin/hammer:22:in `load'
    /usr/bin/hammer:22:in `<main>'

Then I have upgraded:

# yum -y upgrade   # 9 packages updated, foreman moved from 0:1.18.0-0.develop.201802191629git3de2d5a.el7 to 0:1.18.0-0.develop.201802230850gitbdcdb09.el7
# foreman-installer --upgrade

but I can still reproduce:

# hammer -u admin -p changeme -d -vvvv hostgroup create --name 'Forklift Base' --architecture x86_64 --domain zpm.example.com --environment production --puppet-ca-proxy-id 1 --puppet-proxy-id 1 --subnet '192.168.73.0/24' --root-pass changeme --organization-ids 1
[ INFO 2018-02-23T12:59:31 Init] Initialization of Hammer CLI (0.12.0) has started...
[DEBUG 2018-02-23T12:59:31 Init] Running at ruby 2.4.0-p0
[ INFO 2018-02-23T12:59:31 Init] Configuration from the file /etc/hammer/cli_config.yml has been loaded
[ INFO 2018-02-23T12:59:31 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman.yml has been loaded
[ INFO 2018-02-23T12:59:31 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_bootdisk.yml has been loaded
[ INFO 2018-02-23T12:59:31 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_docker.yml has been loaded
[ INFO 2018-02-23T12:59:31 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_tasks.yml has been loaded
[ INFO 2018-02-23T12:59:31 Init] Configuration from the file /etc/hammer/cli.modules.d/katello.yml has been loaded
[ INFO 2018-02-23T12:59:31 Init] Configuration from the file /root/.hammer/cli.modules.d/foreman.yml has been loaded
[DEBUG 2018-02-23T12:59:31 SSLoptions] SSL options: {
    :ssl_ca_file => "/etc/pki/katello/certs/katello-server-ca.crt",
     :verify_ssl => true
}
[DEBUG 2018-02-23T12:59:31 API] Global headers: {
        :content_type => "application/json",
              :accept => "application/json;version=2",
    "Accept-Language" => "en" 
}
[DEBUG 2018-02-23T12:59:31 API] Follow redirects: never
[DEBUG 2018-02-23T12:59:31 Connection] Registered: foreman
[ INFO 2018-02-23T12:59:31 Modules] Extension module hammer_cli_foreman (0.13.pre.develop) loaded.
[ INFO 2018-02-23T12:59:31 Modules] Extension module hammer_cli_foreman_bootdisk (0.1.3) loaded.
[ INFO 2018-02-23T12:59:32 HammerCLI::MainCommand] subcommand organization (HammerCLIForeman::Organization) was removed.
[ INFO 2018-02-23T12:59:32 HammerCLI::MainCommand] subcommand organization (HammerCLIKatello::Organization) was created.
[ INFO 2018-02-23T12:59:32 Modules] Extension module hammer_cli_katello (0.11.0) loaded.
[DEBUG 2018-02-23T12:59:32 Init] Using locale 'en'
[DEBUG 2018-02-23T12:59:32 Init] 'mo' files for locale domain 'hammer-cli' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.12.0/locale'
[DEBUG 2018-02-23T12:59:32 Init] 'mo' files for locale domain 'hammer-cli-foreman' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.13.pre.develop/locale'
[DEBUG 2018-02-23T12:59:32 Init] 'mo' files for locale domain 'hammer_cli_foreman_docker' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman_docker-0.0.4/locale'
[DEBUG 2018-02-23T12:59:32 Init] 'mo' files for locale domain 'hammer-cli-katello' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_katello-0.11.0/locale'
[ INFO 2018-02-23T12:59:32 HammerCLI::MainCommand] Called with options: {"option_verbose"=>true, "option_debug"=>true, "option_username"=>"admin", "option_password"=>"***"}
[ INFO 2018-02-23T12:59:32 HammerCLIForeman::Hostgroup] Called with options: {}
[ INFO 2018-02-23T12:59:32 HammerCLIForeman::Hostgroup::CreateCommand] Error occured while searching for environment
[DEBUG 2018-02-23T12:59:32 Exception] Using exception handler HammerCLIForeman::ExceptionHandler#handle_general_exception
[ERROR 2018-02-23T12:59:32 Exception] Error: Could not find organization, please set one of options --organizations, --organization-titles, --organization-ids.
Could not create the hostgroup:
  Error: Could not find organization, please set one of options --organizations, --organization-titles, --organization-ids.
[ERROR 2018-02-23T12:59:32 Exception] 

HammerCLIForeman::MissingSearchOptions (Could not find organization, please set one of options --organizations, --organization-titles, --organization-ids.):
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.13.pre.develop/lib/hammer_cli_foreman/option_sources/id_params.rb:41:in `rescue in get_options'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.13.pre.develop/lib/hammer_cli_foreman/option_sources/id_params.rb:19:in `get_options'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.12.0/lib/hammer_cli/options/option_collector.rb:13:in `block in all_options_raw'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.12.0/lib/hammer_cli/options/option_collector.rb:12:in `each'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.12.0/lib/hammer_cli/options/option_collector.rb:12:in `inject'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.12.0/lib/hammer_cli/options/option_collector.rb:12:in `all_options_raw'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.12.0/lib/hammer_cli/options/option_collector.rb:18:in `all_options'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.12.0/lib/hammer_cli/options/option_collector.rb:22:in `options'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.12.0/lib/hammer_cli/abstract.rb:239:in `options'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.12.0/lib/hammer_cli/abstract.rb:42: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.12.0/lib/hammer_cli/abstract.rb:29: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.12.0/lib/hammer_cli/abstract.rb:29: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.12.0/lib/hammer_cli/abstract.rb:29: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.12.0/bin/hammer:142:in `<top (required)>'
    /usr/bin/hammer:22:in `load'
    /usr/bin/hammer:22:in `<main>'

Do I need to do any extra step when updating, or do you see any other problem please?

#6 Updated by Martin Bacovsky over 3 years ago

@Jan, is there the hammer-cli-katello patch present in nightlies?
You could tell from

 rpm -ql tfm-rubygem-hammer_cli_katello|grep lifecycle_environment_name_mapping.rb

#7 Updated by Jan Hutař over 3 years ago

Martin Bacovsky wrote:

@Jan, is there the hammer-cli-katello patch present in nightlies?
You could tell from
[...]

Hmm, looks like it is missing:

# rpm -q tfm-rubygem-hammer_cli_katello
tfm-rubygem-hammer_cli_katello-0.11.0-1.201802051800git8a9f851.el7.noarch
# rpm -ql tfm-rubygem-hammer_cli_katello|grep mapping

#8 Updated by Martin Bacovsky over 3 years ago

The patch was merged 02/21 while the nightly build is from 02/05. I'll check what is wrong with the nightlies.

#9 Updated by Martin Bacovsky over 3 years ago

@jan, the nightlies are broken ATM. You can use the build directly from the Koji http://koji.katello.org/koji/buildinfo?buildID=25396 though.

#10 Updated by Jan Hutař over 3 years ago

Martin Bacovsky wrote:

@jan, the nightlies are broken ATM. You can use the build directly from the Koji http://koji.katello.org/koji/buildinfo?buildID=25396 though.

Thank you!

[root@foreman-nightly ~]# rpm -qa tfm-rubygem-hammer_cli_katello
tfm-rubygem-hammer_cli_katello-0.11.0-1.201802271800gita0ce445.el7.noarch
[root@foreman-nightly ~]# hammer -u admin -p changeme -d -vvvv hostgroup create --name 'Forklift Base' --architecture x86_64 --domain zpm.example.com --environment production --puppet-ca-proxy-id 1 --puppet-proxy-id 1 --subnet '192.168.73.0/24' --root-pass changeme --organization-ids 1
[...]
Hostgroup created.

Would it be useful to investigate or report that the package is missing in nightly, or is it already tracked somewhere?

#11 Updated by Jan Hutař over 3 years ago

Martin Bacovsky wrote:

@jan, the nightlies are broken ATM. You can use the build directly from the Koji http://koji.katello.org/koji/buildinfo?buildID=25396 though.

Also, would it make sense to create a test for this particular case? If so, would it go here? https://github.com/Katello/hammer-cli-katello/tree/master/test/functional/hostgroup

#12 Updated by Martin Bacovsky over 3 years ago

Jan, according to my information the broken Katello pipeline is currently waiting on https://github.com/theforeman/foreman/pull/5272 being merged.
Good idea with the test. Hammer-cli-katello is adding --lifecycle-environment option in a way that is conflicting with the --environment option. It would actually be useful to test commands where both --lifecycle-environment and --environment exist. I'm not sure if 'hostgroup' is the only such resource, probably also 'host'. The place you suggest is where I would put the test.

#13 Updated by Andrew Kofink over 3 years ago

  • Legacy Backlogs Release (now unused) changed from 339 to 284

#14 Updated by The Foreman Bot over 3 years ago

  • Pull request https://github.com/Katello/hammer-cli-katello/pull/549 added

#15 Updated by Ivan Necas about 3 years ago

  • Related to Bug #24060: hammer host create using wrong API endpoint to list environments added

Also available in: Atom PDF