Project

General

Profile

Bug #36099

Updated by Oleh Fedorenko almost 2 years ago

hammer hostgroup create/update --name <name> --puppet-environment <name> --lifecycle-environment <name> --query-organization-id 1 fails. The workaround is to use each time one of the options related to environments. 

 [ INFO 2023-02-16T13:56:09 API] GET /katello/api/organizations/1/environments 
 [DEBUG 2023-02-16T13:56:09 API] Params: { 
        "name" => "dev", 
     :per_page => 1000, 
         :page => 1 
 } 
 [DEBUG 2023-02-16T13:56:09 API] Headers: { 
     :params => { 
            "name" => "dev", 
         :per_page => 1000, 
             :page => 1 
     } 
 } 
 [DEBUG 2023-02-16T13:56:09 API] Using authenticator: HammerCLIForeman::Api::InteractiveBasicAuth 
 [DEBUG 2023-02-16T13:56:10 API] Response: { 
          "total" => 0, 
       "subtotal" => 0, 
     "selectable" => 0, 
           "page" => "1", 
       "per_page" => "1000", 
          "error" => nil, 
         "search" => nil, 
           "sort" => { 
            "by" => "name", 
         "order" => "asc" 
     }, 
        "results" => [] 
 } 
 [DEBUG 2023-02-16T13:56:10 API] Response headers: { 
                                  :date => "Thu, 16 Feb 2023 13:56:09 GMT", 
                                :server => "Apache", 
                       :foreman_version => "3.6.0-develop", 
                   :foreman_api_version => "2", 
          :foreman_current_organization => "1; Default Organization", 
              :foreman_current_location => "; ANY", 
                          :content_type => "application/json; charset=utf-8", 
                       :apipie_checksum => "6fb70fc1dd918536eac2f0f265c3abddc6136aa2", 
                                  :etag => "W/\"2a2540031476365e734ade9c75785f31\"", 
                         :cache_control => "max-age=0, private, must-revalidate", 
                          :x_request_id => "33a7b6a3-469a-4be7-9d3d-eb3b6601142c", 
                             :x_runtime => "0.304501", 
             :strict_transport_security => "max-age=631139040; includeSubdomains", 
                       :x_frame_options => "sameorigin", 
                :x_content_type_options => "nosniff", 
                      :x_xss_protection => "1; mode=block", 
                    :x_download_options => "noopen", 
     :x_permitted_cross_domain_policies => "none", 
               :content_security_policy => "default-src 'self'; child-src 'self'; connect-src 'self' ws: wss:; img-src 'self' data:; script-src 'unsafe-eval' 'unsafe-inline' 'self'; style-src 'unsafe-inline' 'self'", 
                            :set_cookie => [ 
         [0] "_session_id=1234bfb6bfc54ddbe411d9d7fb1ab9cb; path=/; HttpOnly; secure; SameSite=Lax" 
     ], 
                                   :via => "1.1 foreman.helo.com", 
                     :transfer_encoding => "chunked" 
 } 
 [DEBUG 2023-02-16T13:56:10 Exception] Using exception handler HammerCLIForeman::ExceptionHandler#handle_general_exception 
 [ERROR 2023-02-16T13:56:10 Exception] Error: lifecycle_environment not found. 
 Could not update the hostgroup: 
   Error: lifecycle_environment not found. 
 [ERROR 2023-02-16T13:56:10 Exception]  

 HammerCLIForeman::ResolverError (lifecycle_environment not found.): 
     /home/vagrant/hammer-cli-foreman/lib/hammer_cli_foreman/id_resolver.rb:250:in `pick_result' 
     /home/vagrant/hammer-cli-foreman/lib/hammer_cli_foreman/id_resolver.rb:191:in `find_resource' 
     /home/vagrant/hammer-cli-foreman/lib/hammer_cli_foreman/id_resolver.rb:154:in `get_id' 
     /home/vagrant/hammer-cli-foreman/lib/hammer_cli_foreman/id_resolver.rb:142:in `block (2 levels) in define_id_finders' 
     /home/vagrant/hammer-cli-foreman/lib/hammer_cli_foreman/commands.rb:142:in `get_resource_id' 
     /home/vagrant/hammer-cli-foreman/lib/hammer_cli_foreman/option_sources/id_params.rb:48:in `block in get_options' 
     /home/vagrant/hammer-cli-foreman/lib/hammer_cli_foreman/option_sources/id_params.rb:43:in `each' 
     /home/vagrant/hammer-cli-foreman/lib/hammer_cli_foreman/option_sources/id_params.rb:43:in `get_options' 
     /home/vagrant/hammer-cli/lib/hammer_cli/options/sources/base.rb:8:in `process' 
     /home/vagrant/hammer-cli/lib/hammer_cli/options/processor_list.rb:22:in `block in process' 
     /home/vagrant/hammer-cli/lib/hammer_cli/options/processor_list.rb:21:in `each' 
     /home/vagrant/hammer-cli/lib/hammer_cli/options/processor_list.rb:21:in `inject' 
     /home/vagrant/hammer-cli/lib/hammer_cli/options/processor_list.rb:21:in `process' 
     /home/vagrant/hammer-cli/lib/hammer_cli/options/processor_list.rb:22:in `block in process' 
     /home/vagrant/hammer-cli/lib/hammer_cli/options/processor_list.rb:21:in `each' 
     /home/vagrant/hammer-cli/lib/hammer_cli/options/processor_list.rb:21:in `inject' 
     /home/vagrant/hammer-cli/lib/hammer_cli/options/processor_list.rb:21:in `process' 
     /home/vagrant/hammer-cli/lib/hammer_cli/options/option_collector.rb:17:in `all_options_raw' 
     /home/vagrant/hammer-cli/lib/hammer_cli/options/option_collector.rb:21:in `all_options' 
     /home/vagrant/hammer-cli/lib/hammer_cli/options/option_collector.rb:25:in `options' 
     /home/vagrant/hammer-cli/lib/hammer_cli/abstract.rb:389:in `options' 
     /home/vagrant/hammer-cli/lib/hammer_cli/abstract.rb:117:in `parse' 
     /usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:62:in `run' 
     /home/vagrant/hammer-cli/lib/hammer_cli/abstract.rb:103:in `run' 
     /usr/share/gems/gems/clamp-1.1.2/lib/clamp/subcommand/execution.rb:11:in `execute' 
     /usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:63:in `run' 
     /home/vagrant/hammer-cli/lib/hammer_cli/abstract.rb:103:in `run' 
     /usr/share/gems/gems/clamp-1.1.2/lib/clamp/subcommand/execution.rb:11:in `execute' 
     /usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:63:in `run' 
     /home/vagrant/hammer-cli/lib/hammer_cli/abstract.rb:103:in `run' 
     /usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:132:in `run' 
     /home/vagrant/hammer-cli/bin/hammer:147:in `<top (required)>' 
     /usr/share/gems/bin/hammer:23:in `load' 
     /usr/share/gems/bin/hammer:23:in `<top (required)>' 
     /usr/share/gems/gems/bundler-2.2.24/lib/bundler/cli/exec.rb:63:in `load' 
     /usr/share/gems/gems/bundler-2.2.24/lib/bundler/cli/exec.rb:63:in `kernel_load' 
     /usr/share/gems/gems/bundler-2.2.24/lib/bundler/cli/exec.rb:28:in `run' 
     /usr/share/gems/gems/bundler-2.2.24/lib/bundler/cli.rb:475:in `exec' 
     /usr/share/gems/gems/bundler-2.2.24/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run' 
     /usr/share/gems/gems/bundler-2.2.24/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command' 
     /usr/share/gems/gems/bundler-2.2.24/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch' 
     /usr/share/gems/gems/bundler-2.2.24/lib/bundler/cli.rb:31:in `dispatch' 
     /usr/share/gems/gems/bundler-2.2.24/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start' 
     /usr/share/gems/gems/bundler-2.2.24/lib/bundler/cli.rb:25:in `start' 
     /usr/share/gems/gems/bundler-2.2.24/libexec/bundle:46:in `block in <top (required)>' 
     /usr/share/gems/gems/bundler-2.2.24/lib/bundler/friendly_errors.rb:128:in `with_friendly_errors' 
     /usr/share/gems/gems/bundler-2.2.24/libexec/bundle:34:in `<top (required)>' 
     /usr/bin/bundle:23:in `load' 
     /usr/bin/bundle:23:in `<main>' 
 ``` 

 Note that `dev` is not a lifecycle environment and thus should not resolve via Katello API, but Puppet.

Back