Hammer not able to update hosts

Problem:
Hello,

I’m trying to use hammer as a tool to interact with the hosts I have in Foreman, the main problem is that I can list and show information about my hosts with hammer host list, but I am not able to update hosts in Foreman. Foreman was responding with a 500 and I needed to enable the debug logs on the server to be able to understand what was going on. Basically hammer is adding a compute_resources: {} in the update request and Foreman is complaining about it. I’ll leave logs down below.

Am I doing something wrong? I would appreciate any help on this. Thanks.

Expected outcome:

$ hammer host update --name node.example.org --environment production
Host updated

Foreman and Proxy versions:
foreman 2.1.2
hammer 2.2.1
hammer_cli_foreman 2.2.0

Other relevant data:
Logs from the hammer command

$ hammer -d host update --name node.example.org --environment production
[ INFO 2020-09-08T14:56:10 Init] Initialization of Hammer CLI (2.2.1) has started...
[DEBUG 2020-09-08T14:56:10 Init] Running at ruby 2.6.3-p62
[ INFO 2020-09-08T14:56:10 Init] Configuration from the file /Users/pigueira/.hammer/cli_config.yml has been loaded
[ INFO 2020-09-08T14:56:10 Init] Configuration from the file /Users/pigueira/.hammer/cli.modules.d/foreman.yml has been loaded
[DEBUG 2020-09-08T14:56:10 SSLoptions] SSL options: {
    :verify_ssl => true
}
[DEBUG 2020-09-08T14:56:10 API] Global headers: {
        :content_type => "application/json",
              :accept => "application/json;version=2",
    "Accept-Language" => "en"
}
[DEBUG 2020-09-08T14:56:10 API] Follow redirects: never
[DEBUG 2020-09-08T14:56:10 Connection] Registered: foreman
[DEBUG 2020-09-08T14:56:10 HammerCLIForeman::CommandExtensions::OptionSources] Added predefined options for HammerCLIForeman::Command:
[ INFO 2020-09-08T14:56:10 Extensions] Applied HammerCLIForeman::CommandExtensions::OptionSources for *all* except *nothing* on HammerCLIForeman::Command.
[DEBUG 2020-09-08T14:56:10 HammerCLIForeman::CommandExtensions::Fields] Added predefined options for HammerCLIForeman::ListCommand: [:fields]
[ INFO 2020-09-08T14:56:10 Extensions] Applied HammerCLIForeman::CommandExtensions::Fields for *all* except *nothing* on HammerCLIForeman::ListCommand.
[DEBUG 2020-09-08T14:56:10 HammerCLIForeman::CommandExtensions::Fields] Added predefined options for HammerCLIForeman::InfoCommand: [:fields]
[ INFO 2020-09-08T14:56:10 Extensions] Applied HammerCLIForeman::CommandExtensions::Fields for *all* except *nothing* on HammerCLIForeman::InfoCommand.
[DEBUG 2020-09-08T14:56:10 HammerCLIForeman::CommandExtensions::PuppetEnvironment] Added predefined options for HammerCLIForeman::AssociatingCommands::PuppetEnvironment::AddPuppetEnvironmentCommand:
[DEBUG 2020-09-08T14:56:10 HammerCLIForeman::CommandExtensions::PuppetEnvironment] Called option family block for HammerCLIForeman::AssociatingCommands::PuppetEnvironment::AddPuppetEnvironmentCommand:
	#<Proc:0x00007f96282f4ac0@/Library/Ruby/Gems/2.6.0/gems/hammer_cli_foreman-2.2.0/lib/hammer_cli_foreman/command_extensions/puppet_environment.rb:11>
[ INFO 2020-09-08T14:56:10 Extensions] Applied HammerCLIForeman::CommandExtensions::PuppetEnvironment for *all* except *nothing* on HammerCLIForeman::AssociatingCommands::PuppetEnvironment::AddPuppetEnvironmentCommand.
[DEBUG 2020-09-08T14:56:10 HammerCLIForeman::CommandExtensions::PuppetEnvironment] Added predefined options for HammerCLIForeman::AssociatingCommands::PuppetEnvironment::RemovePuppetEnvironmentCommand:
[DEBUG 2020-09-08T14:56:10 HammerCLIForeman::CommandExtensions::PuppetEnvironment] Called option family block for HammerCLIForeman::AssociatingCommands::PuppetEnvironment::RemovePuppetEnvironmentCommand:
	#<Proc:0x00007f96282f4ac0@/Library/Ruby/Gems/2.6.0/gems/hammer_cli_foreman-2.2.0/lib/hammer_cli_foreman/command_extensions/puppet_environment.rb:11>
[ INFO 2020-09-08T14:56:10 Extensions] Applied HammerCLIForeman::CommandExtensions::PuppetEnvironment for *all* except *nothing* on HammerCLIForeman::AssociatingCommands::PuppetEnvironment::RemovePuppetEnvironmentCommand.
[ INFO 2020-09-08T14:56:10 Modules] Extension module hammer_cli_foreman (2.2.0) loaded.
[DEBUG 2020-09-08T14:56:10 Init] Using locale 'en'
[DEBUG 2020-09-08T14:56:10 Init] 'mo' files for locale domain 'hammer-cli' loaded from '/Library/Ruby/Gems/2.6.0/gems/hammer_cli-2.2.1/locale'
[DEBUG 2020-09-08T14:56:10 Init] 'mo' files for locale domain 'hammer-cli-foreman' loaded from '/Library/Ruby/Gems/2.6.0/gems/hammer_cli_foreman-2.2.0/locale'
[ INFO 2020-09-08T14:56:10 HammerCLI::MainCommand] Called with options: {"option_debug"=>true}
[DEBUG 2020-09-08T14:56:10 HammerCLIForeman::CommandExtensions::PuppetEnvironment] Added predefined options for HammerCLIForeman::SmartClassParameter::ListCommand:
[DEBUG 2020-09-08T14:56:10 HammerCLIForeman::CommandExtensions::PuppetEnvironment] Called option family block for HammerCLIForeman::SmartClassParameter::ListCommand:
	#<Proc:0x00007f96282f4ac0@/Library/Ruby/Gems/2.6.0/gems/hammer_cli_foreman-2.2.0/lib/hammer_cli_foreman/command_extensions/puppet_environment.rb:11>
[ INFO 2020-09-08T14:56:10 Extensions] Applied HammerCLIForeman::CommandExtensions::PuppetEnvironment for *all* except *nothing* on HammerCLIForeman::SmartClassParameter::ListCommand.
[DEBUG 2020-09-08T14:56:10 HammerCLIForeman::CommandExtensions::PuppetEnvironment] Added predefined options for HammerCLIForeman::PuppetClass::ListCommand:
[DEBUG 2020-09-08T14:56:10 HammerCLIForeman::CommandExtensions::PuppetEnvironment] Called option family block for HammerCLIForeman::PuppetClass::ListCommand:
	#<Proc:0x00007f96282f4ac0@/Library/Ruby/Gems/2.6.0/gems/hammer_cli_foreman-2.2.0/lib/hammer_cli_foreman/command_extensions/puppet_environment.rb:11>
[ INFO 2020-09-08T14:56:10 Extensions] Applied HammerCLIForeman::CommandExtensions::PuppetEnvironment for *all* except *nothing* on HammerCLIForeman::PuppetClass::ListCommand.
[DEBUG 2020-09-08T14:56:10 HammerCLIForeman::CommandExtensions::PuppetEnvironment] Added predefined options for HammerCLIForeman::PuppetClass::InfoCommand:
[DEBUG 2020-09-08T14:56:10 HammerCLIForeman::CommandExtensions::PuppetEnvironment] Called option family block for HammerCLIForeman::PuppetClass::InfoCommand:
	#<Proc:0x00007f96282f4ac0@/Library/Ruby/Gems/2.6.0/gems/hammer_cli_foreman-2.2.0/lib/hammer_cli_foreman/command_extensions/puppet_environment.rb:11>
[ INFO 2020-09-08T14:56:10 Extensions] Applied HammerCLIForeman::CommandExtensions::PuppetEnvironment for *all* except *nothing* on HammerCLIForeman::PuppetClass::InfoCommand.
[DEBUG 2020-09-08T14:56:10 HammerCLIForeman::CommandExtensions::PuppetEnvironment] Added predefined options for HammerCLIForeman::Host::ListCommand:
[DEBUG 2020-09-08T14:56:10 HammerCLIForeman::CommandExtensions::PuppetEnvironment] Called option family block for HammerCLIForeman::Host::ListCommand:
	#<Proc:0x00007f96282f4ac0@/Library/Ruby/Gems/2.6.0/gems/hammer_cli_foreman-2.2.0/lib/hammer_cli_foreman/command_extensions/puppet_environment.rb:11>
[ INFO 2020-09-08T14:56:10 Extensions] Applied HammerCLIForeman::CommandExtensions::PuppetEnvironment for *all* except *nothing* on HammerCLIForeman::Host::ListCommand.
[DEBUG 2020-09-08T14:56:10 HammerCLIForeman::CommandExtensions::PuppetEnvironment] Added predefined options for HammerCLIForeman::Host::CreateCommand:
[DEBUG 2020-09-08T14:56:10 HammerCLIForeman::CommandExtensions::PuppetEnvironment] Called option family block for HammerCLIForeman::Host::CreateCommand:
	#<Proc:0x00007f96282f4ac0@/Library/Ruby/Gems/2.6.0/gems/hammer_cli_foreman-2.2.0/lib/hammer_cli_foreman/command_extensions/puppet_environment.rb:11>
[ INFO 2020-09-08T14:56:10 Extensions] Applied HammerCLIForeman::CommandExtensions::PuppetEnvironment for *all* except *nothing* on HammerCLIForeman::Host::CreateCommand.
[DEBUG 2020-09-08T14:56:10 HammerCLIForeman::CommandExtensions::Hosts::Help::Interfaces] Added predefined options for HammerCLIForeman::Host::CreateCommand:
[DEBUG 2020-09-08T14:56:10 HammerCLIForeman::CommandExtensions::Hosts::Help::Interfaces] Saved block for HammerCLIForeman::Host::CreateCommand help definition:
	#<Proc:0x00007f96283064f0@/Library/Ruby/Gems/2.6.0/gems/hammer_cli_foreman-2.2.0/lib/hammer_cli_foreman/command_extensions/hosts/help/interfaces.rb:6>
[ INFO 2020-09-08T14:56:10 Extensions] Applied HammerCLIForeman::CommandExtensions::Hosts::Help::Interfaces for *all* except *nothing* on HammerCLIForeman::Host::CreateCommand.
[DEBUG 2020-09-08T14:56:10 #<Class:0x00007f9627c4b638>] Added predefined options for HammerCLIForeman::Host::CreateCommand:
[DEBUG 2020-09-08T14:56:10 #<Class:0x00007f9627c4b638>] Saved block for HammerCLIForeman::Host::CreateCommand help definition:
	#<Proc:0x00007f9627c4b458@/Library/Ruby/Gems/2.6.0/gems/hammer_cli_foreman-2.2.0/lib/hammer_cli_foreman/command_extensions/hosts/help/compute_resources.rb:45>
[ INFO 2020-09-08T14:56:10 Extensions] Applied #<Class:0x00007f9627c4b638> for *all* except *nothing* on HammerCLIForeman::Host::CreateCommand.
[DEBUG 2020-09-08T14:56:10 HammerCLIForeman::CommandExtensions::PuppetEnvironment] Added predefined options for HammerCLIForeman::Host::UpdateCommand:
[DEBUG 2020-09-08T14:56:10 HammerCLIForeman::CommandExtensions::PuppetEnvironment] Called option family block for HammerCLIForeman::Host::UpdateCommand:
	#<Proc:0x00007f96282f4ac0@/Library/Ruby/Gems/2.6.0/gems/hammer_cli_foreman-2.2.0/lib/hammer_cli_foreman/command_extensions/puppet_environment.rb:11>
[ INFO 2020-09-08T14:56:10 Extensions] Applied HammerCLIForeman::CommandExtensions::PuppetEnvironment for *all* except *nothing* on HammerCLIForeman::Host::UpdateCommand.
[DEBUG 2020-09-08T14:56:10 HammerCLIForeman::CommandExtensions::Hosts::Help::Interfaces] Added predefined options for HammerCLIForeman::Host::UpdateCommand:
[DEBUG 2020-09-08T14:56:10 HammerCLIForeman::CommandExtensions::Hosts::Help::Interfaces] Saved block for HammerCLIForeman::Host::UpdateCommand help definition:
	#<Proc:0x00007f96283064f0@/Library/Ruby/Gems/2.6.0/gems/hammer_cli_foreman-2.2.0/lib/hammer_cli_foreman/command_extensions/hosts/help/interfaces.rb:6>
[ INFO 2020-09-08T14:56:10 Extensions] Applied HammerCLIForeman::CommandExtensions::Hosts::Help::Interfaces for *all* except *nothing* on HammerCLIForeman::Host::UpdateCommand.
[DEBUG 2020-09-08T14:56:10 #<Class:0x00007f9627ccaf28>] Added predefined options for HammerCLIForeman::Host::UpdateCommand:
[DEBUG 2020-09-08T14:56:10 #<Class:0x00007f9627ccaf28>] Saved block for HammerCLIForeman::Host::UpdateCommand help definition:
	#<Proc:0x00007f9627ccade8@/Library/Ruby/Gems/2.6.0/gems/hammer_cli_foreman-2.2.0/lib/hammer_cli_foreman/command_extensions/hosts/help/compute_resources.rb:45>
[ INFO 2020-09-08T14:56:10 Extensions] Applied #<Class:0x00007f9627ccaf28> for *all* except *nothing* on HammerCLIForeman::Host::UpdateCommand.
[DEBUG 2020-09-08T14:56:10 HammerCLIForeman::CommandExtensions::OptionSources] Called block for HammerCLIForeman::Command option sources:
	#<Proc:0x00007f962824ca28@/Library/Ruby/Gems/2.6.0/gems/hammer_cli_foreman-2.2.0/lib/hammer_cli_foreman/command_extensions/option_sources.rb:6>
[ INFO 2020-09-08T14:56:10 HammerCLIForeman::Host] Called with options: {}
Warning: Option --environment is deprecated. Use --puppet-environment[-id] instead
[DEBUG 2020-09-08T14:56:10 HammerCLIForeman::CommandExtensions::OptionSources] Called block for HammerCLIForeman::Command option sources:
	#<Proc:0x00007f962824ca28@/Library/Ruby/Gems/2.6.0/gems/hammer_cli_foreman-2.2.0/lib/hammer_cli_foreman/command_extensions/option_sources.rb:6>
[DEBUG 2020-09-08T14:56:10 HammerCLIForeman::CommandExtensions::PuppetEnvironment] Called block for HammerCLIForeman::Host::UpdateCommand option sources:
	#<Proc:0x00007f96282f4a98@/Library/Ruby/Gems/2.6.0/gems/hammer_cli_foreman-2.2.0/lib/hammer_cli_foreman/command_extensions/puppet_environment.rb:19>
[ INFO 2020-09-08T14:56:11 API] Server: https://foreman.example.org
[ INFO 2020-09-08T14:56:11 API] GET /api/environments
[DEBUG 2020-09-08T14:56:11 API] Params: {
      :search => "name = \"production\"",
    :per_page => 1000,
        :page => 1
}
[DEBUG 2020-09-08T14:56:11 API] Headers: {
    :params => {
          :search => "name = \"production\"",
        :per_page => 1000,
            :page => 1
    }
}
[DEBUG 2020-09-08T14:56:11 API] Using authenticator: HammerCLIForeman::Api::InteractiveBasicAuth
[DEBUG 2020-09-08T14:56:11 API] Response: {
       "total" => 7,
    "subtotal" => 1,
        "page" => 1,
    "per_page" => 1000,
      "search" => "name = \"production\"",
        "sort" => {
           "by" => nil,
        "order" => nil
    },
     "results" => [
        [0] {
            "created_at" => "2020-08-06 09:20:44 UTC",
            "updated_at" => "2020-08-06 09:20:44 UTC",
                  "name" => "production",
                    "id" => 2
        }
    ]
}
[DEBUG 2020-09-08T14:56:11 API] Response headers: {
                                 :date => "Tue, 08 Sep 2020 12:56:06 GMT",
                               :server => "Apache",
                      :foreman_version => "2.1.2",
                  :foreman_api_version => "2",
         :foreman_current_organization => "; ANY",
             :foreman_current_location => "; ANY",
                         :content_type => "application/json; charset=utf-8",
                      :apipie_checksum => "bec55004fe8d55c6195f1b56094d2f1ce2b5d2ac",
                                 :etag => "W/\"289862208e9cd55aedc4fc1330abe3d4-gzip\"",
                        :cache_control => "max-age=0, private, must-revalidate",
                         :x_request_id => "612d74c7-0614-48f8-ba7f-7e13d29e645a",
                            :x_runtime => "0.160734",
            :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 => [
        ...
    ],
                                  :via => "1.1 foreman.example.org",
                                 :vary => "Accept-Encoding",
                       :content_length => "184"
}
[ INFO 2020-09-08T14:56:11 API] Server: https://foreman.example.org
[ INFO 2020-09-08T14:56:11 API] GET /api/hosts
[DEBUG 2020-09-08T14:56:11 API] Params: {
      :search => "name = \"node.example.org\"",
    :per_page => 1000,
        :page => 1
}
[DEBUG 2020-09-08T14:56:11 API] Headers: {
    :params => {
          :search => "name = \"node.example.org\"",
        :per_page => 1000,
            :page => 1
    }
}
[DEBUG 2020-09-08T14:56:11 API] Using authenticator: HammerCLIForeman::Api::InteractiveBasicAuth
[DEBUG 2020-09-08T14:56:11 API] Response: {
       "total" => 15,
    "subtotal" => 1,
        "page" => 1,
    "per_page" => 1000,
      "search" => "name = \"node.example.org\"",
        "sort" => {
           "by" => nil,
        "order" => nil
    },
     "results" => [
        [0] {
                                    "ip" => "10.80.2.18",
                                   "ip6" => nil,
                        "environment_id" => 2,
                      "environment_name" => "production",
                           "last_report" => "2020-09-08 12:42:16 UTC",
                                   "mac" => "00:50:56:ba:b4:57",
                              "realm_id" => nil,
                            "realm_name" => nil,
                                "sp_mac" => nil,
                                 "sp_ip" => nil,
                               "sp_name" => nil,
                             "domain_id" => 1,
                           "domain_name" => "example.org",
                       "architecture_id" => 1,
                     "architecture_name" => "x86_64",
                    "operatingsystem_id" => 2,
                  "operatingsystem_name" => "RHEL Server 7.8",
                             "subnet_id" => nil,
                           "subnet_name" => nil,
                            "subnet6_id" => nil,
                          "subnet6_name" => nil,
                          "sp_subnet_id" => nil,
                             "ptable_id" => nil,
                           "ptable_name" => nil,
                             "medium_id" => nil,
                           "medium_name" => nil,
                            "pxe_loader" => nil,
                                 "build" => false,
                               "comment" => "",
                                  "disk" => nil,
                          "installed_at" => nil,
                              "model_id" => 5,
                          "hostgroup_id" => 18,
                              "owner_id" => 5,
                            "owner_name" => "John Doe",
                            "owner_type" => "User",
                               "enabled" => true,
                               "managed" => false,
                             "use_image" => nil,
                            "image_file" => "",
                                  "uuid" => nil,
                   "compute_resource_id" => nil,
                 "compute_resource_name" => nil,
                    "compute_profile_id" => nil,
                  "compute_profile_name" => nil,
                          "capabilities" => [
                [0] "build"
            ],
                      "provision_method" => "build",
                              "certname" => "node.example.org",
                              "image_id" => nil,
                            "image_name" => nil,
                            "created_at" => "2020-09-07 12:02:52 UTC",
                            "updated_at" => "2020-09-08 12:42:43 UTC",
                          "last_compile" => nil,
                         "global_status" => 2,
                   "global_status_label" => "Error",
                        "uptime_seconds" => 45956594,
                       "organization_id" => 1,
                     "organization_name" => "Default Organization",
                           "location_id" => 2,
                         "location_name" => "Default Location",
                         "puppet_status" => 12288,
                            "model_name" => "VMware Virtual Platform",
                  "configuration_status" => 12288,
            "configuration_status_label" => "Error",
                                  "name" => "node.example.org",
                                    "id" => 18,
                       "puppet_proxy_id" => nil,
                     "puppet_proxy_name" => nil,
                    "puppet_ca_proxy_id" => nil,
                  "puppet_ca_proxy_name" => nil,
                          "puppet_proxy" => nil,
                       "puppet_ca_proxy" => nil,
                        "hostgroup_name" => "hostgroup",
                       "hostgroup_title" => "hostgroup/level1"
        }
    ]
}
[DEBUG 2020-09-08T14:56:11 API] Response headers: {
                                 :date => "Tue, 08 Sep 2020 12:56:06 GMT",
                               :server => "Apache",
                      :foreman_version => "2.1.2",
                  :foreman_api_version => "2",
         :foreman_current_organization => "; ANY",
             :foreman_current_location => "; ANY",
                         :content_type => "application/json; charset=utf-8",
                      :apipie_checksum => "bec55004fe8d55c6195f1b56094d2f1ce2b5d2ac",
                                 :etag => "W/\"02e1a735531018622e84b7654b4b54f1-gzip\"",
                        :cache_control => "max-age=0, private, must-revalidate",
                         :x_request_id => "f714af94-2619-414d-803f-a902bd6eadd1",
                            :x_runtime => "0.193335",
            :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=c61c007a7cfa245b8887e64956f83ee0; path=/; secure; HttpOnly; SameSite=Lax"
    ],
                                  :via => "1.1 foreman.example.org",
                                 :vary => "Accept-Encoding",
                       :content_length => "782"
}
[ INFO 2020-09-08T14:56:11 HammerCLIForeman::Host::UpdateCommand] Called with options: {"option_volume_list"=>[], "option_interface_list"=>[], "option_name"=>"node.example.org", "option_environment_name"=>"production", "option_environment_id"=>2, "option_id"=>18}
[ INFO 2020-09-08T14:56:11 API] Server: https://foreman.example.org
[ INFO 2020-09-08T14:56:11 API] PUT /api/hosts/18
[DEBUG 2020-09-08T14:56:11 API] Params: {
    "host" => {
                      "name" => "node.example.org",
            "environment_id" => 2,
        "compute_attributes" => {}
    }
}
[DEBUG 2020-09-08T14:56:11 API] Headers: {}
[DEBUG 2020-09-08T14:56:11 API] Using authenticator: HammerCLIForeman::Api::InteractiveBasicAuth
[ERROR 2020-09-08T14:56:12 API] 500 Internal Server Error
[DEBUG 2020-09-08T14:56:12 API] {
    "error" => {
        "message" => "Internal Server Error: the server was unable to finish the request. This may be caused by unavailability of some required service, incorrect API call or a server-side bug. There may be more information in the server's logs."
    }
}
[DEBUG 2020-09-08T14:56:12 Exception] Using exception handler HammerCLIForeman::ExceptionHandler#handle_internal_error
[ERROR 2020-09-08T14:56:12 Exception] Internal Server Error: the server was unable to finish the request. This may be caused by unavailability of some required service, incorrect API call or a server-side bug. There may be more information in the server's logs.
Could not update the host:
  Internal Server Error: the server was unable to finish the request. This may be caused by unavailability of some required service, incorrect API call or a server-side bug. There may be more information in the server's logs.
[ERROR 2020-09-08T14:56:12 Exception]

RestClient::InternalServerError (500 Internal Server Error):
    /Library/Ruby/Gems/2.6.0/gems/rest-client-2.1.0/lib/restclient/abstract_response.rb:249:in `exception_with_response'
    /Library/Ruby/Gems/2.6.0/gems/rest-client-2.1.0/lib/restclient/abstract_response.rb:129:in `return!'
    /Library/Ruby/Gems/2.6.0/gems/apipie-bindings-0.4.0/lib/apipie_bindings/api.rb:353:in `block in rest_client_call_block'
    /Library/Ruby/Gems/2.6.0/gems/rest-client-2.1.0/lib/restclient/request.rb:834:in `process_result'
    /Library/Ruby/Gems/2.6.0/gems/rest-client-2.1.0/lib/restclient/request.rb:743:in `block in transmit'
    /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/net/http.rb:920:in `start'
    /Library/Ruby/Gems/2.6.0/gems/rest-client-2.1.0/lib/restclient/request.rb:727:in `transmit'
    /Library/Ruby/Gems/2.6.0/gems/rest-client-2.1.0/lib/restclient/request.rb:163:in `execute'
    /Library/Ruby/Gems/2.6.0/gems/rest-client-2.1.0/lib/restclient/request.rb:63:in `execute'
    /Library/Ruby/Gems/2.6.0/gems/rest-client-2.1.0/lib/restclient/resource.rb:79:in `put'
    /Library/Ruby/Gems/2.6.0/gems/apipie-bindings-0.4.0/lib/apipie_bindings/api.rb:327:in `call_client'
    /Library/Ruby/Gems/2.6.0/gems/apipie-bindings-0.4.0/lib/apipie_bindings/api.rb:240:in `http_call'
    /Library/Ruby/Gems/2.6.0/gems/apipie-bindings-0.4.0/lib/apipie_bindings/api.rb:190:in `call_action'
    /Library/Ruby/Gems/2.6.0/gems/apipie-bindings-0.4.0/lib/apipie_bindings/api.rb:185:in `call'
    /Library/Ruby/Gems/2.6.0/gems/apipie-bindings-0.4.0/lib/apipie_bindings/resource.rb:21:in `call'
    /Library/Ruby/Gems/2.6.0/gems/hammer_cli-2.2.1/lib/hammer_cli/apipie/command.rb:53:in `send_request'
    /Library/Ruby/Gems/2.6.0/gems/hammer_cli_foreman-2.2.0/lib/hammer_cli_foreman/commands.rb:188:in `send_request'
    /Library/Ruby/Gems/2.6.0/gems/hammer_cli-2.2.1/lib/hammer_cli/apipie/command.rb:34:in `execute'
    /Library/Ruby/Gems/2.6.0/gems/clamp-1.1.2/lib/clamp/command.rb:63:in `run'
    /Library/Ruby/Gems/2.6.0/gems/hammer_cli-2.2.1/lib/hammer_cli/abstract.rb:77:in `run'
    /Library/Ruby/Gems/2.6.0/gems/clamp-1.1.2/lib/clamp/subcommand/execution.rb:11:in `execute'
    /Library/Ruby/Gems/2.6.0/gems/clamp-1.1.2/lib/clamp/command.rb:63:in `run'
    /Library/Ruby/Gems/2.6.0/gems/hammer_cli-2.2.1/lib/hammer_cli/abstract.rb:77:in `run'
    /Library/Ruby/Gems/2.6.0/gems/clamp-1.1.2/lib/clamp/subcommand/execution.rb:11:in `execute'
    /Library/Ruby/Gems/2.6.0/gems/clamp-1.1.2/lib/clamp/command.rb:63:in `run'
    /Library/Ruby/Gems/2.6.0/gems/hammer_cli-2.2.1/lib/hammer_cli/abstract.rb:77:in `run'
    /Library/Ruby/Gems/2.6.0/gems/clamp-1.1.2/lib/clamp/command.rb:132:in `run'
    /Library/Ruby/Gems/2.6.0/gems/hammer_cli-2.2.1/bin/hammer:147:in `<top (required)>'
    /usr/local/bin/hammer:23:in `load'
    /usr/local/bin/hammer:23:in `<main>'

Foreman server logs

2020-09-08T15:18:19 [I|app|52d6cf08] Started PUT "/api/hosts/18" for 128.179.255.74 at 2020-09-08 15:18:19 +0200
2020-09-08T15:18:19 [I|app|52d6cf08] Processing by Api::V2::HostsController#update as JSON
2020-09-08T15:18:19 [I|app|52d6cf08]   Parameters: {"host"=>{"name"=>"bbpmon08.bbp.epfl.ch", "environment_id"=>2, "compute_attributes"=>{}}, "apiv"=>"v2", "id"=>"18"}
2020-09-08T15:18:19 [D|app|52d6cf08] Authenticated user admin against INTERNAL authentication source
2020-09-08T15:18:19 [D|app|52d6cf08] Post-login processing for admin
2020-09-08T15:18:19 [I|app|52d6cf08] Authorized user admin(Admin User)
2020-09-08T15:18:19 [D|app|52d6cf08] Post-login processing for admin
2020-09-08T15:18:19 [D|tax|52d6cf08] Current location set to none
2020-09-08T15:18:19 [D|tax|52d6cf08] Current organization set to none
2020-09-08T15:18:19 [D|tax|52d6cf08] Current location set to none
2020-09-08T15:18:19 [D|tax|52d6cf08] Current organization set to none
2020-09-08T15:18:19 [W|app|52d6cf08] Action failed
2020-09-08T15:18:19 [D|app|52d6cf08] Backtrace for 'Action failed' error (ActiveModel::UnknownAttributeError): unknown attribute 'compute_attributes' for Host::Managed.
/opt/theforeman/tfm/root/usr/share/gems/gems/activemodel-6.0.3.1/lib/active_model/attribute_assignment.rb:52:in `_assign_attribute'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.1/lib/active_record/attribute_assignment.rb:29:in `block in assign_nested_parameter_attributes'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.1/lib/active_record/attribute_assignment.rb:29:in `each'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.1/lib/active_record/attribute_assignment.rb:29:in `assign_nested_parameter_attributes'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.1/lib/active_record/attribute_assignment.rb:23:in `_assign_attributes'
/opt/theforeman/tfm/root/usr/share/gems/gems/activemodel-6.0.3.1/lib/active_model/attribute_assignment.rb:35:in `assign_attributes'
/usr/share/foreman/app/controllers/api/v2/hosts_controller.rb:157:in `update'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/abstract_controller/base.rb:195:in `process_action'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_controller/metal/rendering.rb:30:in `process_action'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:112:in `block in run_callbacks'
/usr/share/foreman/app/controllers/api/v2/base_controller.rb:163:in `disable_json_root'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
/usr/share/foreman/app/controllers/concerns/foreman/controller/timezone.rb:10:in `set_timezone'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
/usr/share/foreman/app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
/opt/theforeman/tfm/root/usr/share/gems/gems/audited-4.9.0/lib/audited/sweeper.rb:14:in `around'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
/opt/theforeman/tfm/root/usr/share/gems/gems/audited-4.9.0/lib/audited/sweeper.rb:14:in `around'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:139:in `run_callbacks'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/abstract_controller/callbacks.rb:41:in `process_action'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_controller/metal/rescue.rb:22:in `process_action'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_controller/metal/instrumentation.rb:33:in `block in process_action'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/notifications.rb:180:in `block in instrument'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/notifications.rb:180:in `instrument'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_controller/metal/instrumentation.rb:32:in `process_action'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_controller/metal/params_wrapper.rb:245:in `process_action'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.1/lib/active_record/railties/controller_runtime.rb:27:in `process_action'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/abstract_controller/base.rb:136:in `process'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionview-6.0.3.1/lib/action_view/rendering.rb:39:in `process'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_controller/metal.rb:190:in `dispatch'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_controller/metal.rb:254:in `dispatch'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_dispatch/routing/route_set.rb:33:in `serve'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_dispatch/routing/mapper.rb:18:in `block in <class:Constraints>'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_dispatch/routing/mapper.rb:48:in `serve'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_dispatch/journey/router.rb:49:in `block in serve'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_dispatch/journey/router.rb:32:in `each'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_dispatch/journey/router.rb:32:in `serve'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_dispatch/routing/route_set.rb:834:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/apipie-dsl-2.2.2/lib/apipie_dsl/static_dispatcher.rb:67:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/apipie-rails-0.5.17/lib/apipie/static_dispatcher.rb:66:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/apipie-rails-0.5.17/lib/apipie/extractor/recorder.rb:137:in `call'
/usr/share/foreman/lib/foreman/middleware/telemetry.rb:10:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/apipie-rails-0.5.17/lib/apipie/middleware/checksum_in_headers.rb:27:in `call'
/usr/share/foreman/lib/foreman/middleware/catch_json_parse_errors.rb:9:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.2/lib/rack/tempfile_reaper.rb:15:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.2/lib/rack/etag.rb:27:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.2/lib/rack/conditional_get.rb:40:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.2/lib/rack/head.rb:12:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_dispatch/http/content_security_policy.rb:18:in `call'
/usr/share/foreman/lib/foreman/middleware/logging_context_session.rb:22:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.2/lib/rack/session/abstract/id.rb:266:in `context'
/opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.2/lib/rack/session/abstract/id.rb:260:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_dispatch/middleware/cookies.rb:648:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:101:in `run_callbacks'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_dispatch/middleware/actionable_exceptions.rb:17:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_dispatch/middleware/debug_exceptions.rb:32:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/railties-6.0.3.1/lib/rails/rack/logger.rb:37:in `call_app'
/opt/theforeman/tfm/root/usr/share/gems/gems/railties-6.0.3.1/lib/rails/rack/logger.rb:28:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/sprockets-rails-3.2.1/lib/sprockets/rails/quiet_assets.rb:13:in `call'
/usr/share/foreman/lib/foreman/middleware/logging_context_request.rb:11:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_dispatch/middleware/request_id.rb:27:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.2/lib/rack/method_override.rb:24:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.2/lib/rack/runtime.rb:22:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_dispatch/middleware/executor.rb:14:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_dispatch/middleware/static.rb:126:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.2/lib/rack/sendfile.rb:110:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_dispatch/middleware/host_authorization.rb:76:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/secure_headers-6.3.0/lib/secure_headers/middleware.rb:11:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/railties-6.0.3.1/lib/rails/engine.rb:527:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/railties-6.0.3.1/lib/rails/railtie.rb:190:in `public_send'
/opt/theforeman/tfm/root/usr/share/gems/gems/railties-6.0.3.1/lib/rails/railtie.rb:190:in `method_missing'
/opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.2/lib/rack/urlmap.rb:74:in `block in call'
/opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.2/lib/rack/urlmap.rb:58:in `each'
/opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.2/lib/rack/urlmap.rb:58:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/puma-4.3.3/lib/puma/configuration.rb:228:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/puma-4.3.3/lib/puma/server.rb:682:in `handle_request'
/opt/theforeman/tfm/root/usr/share/gems/gems/puma-4.3.3/lib/puma/server.rb:472:in `process_client'
/opt/theforeman/tfm/root/usr/share/gems/gems/puma-4.3.3/lib/puma/server.rb:328:in `block in run'
/opt/theforeman/tfm/root/usr/share/gems/gems/puma-4.3.3/lib/puma/thread_pool.rb:134:in `block in spawn_thread'
/opt/theforeman/tfm/root/usr/share/gems/gems/logging-2.2.2/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'
2020-09-08T15:18:19 [I|app|52d6cf08]   Rendering api/v2/errors/custom_error.json.rabl within api/v2/layouts/error_layout
2020-09-08T15:18:19 [I|app|52d6cf08]   Rendered api/v2/errors/custom_error.json.rabl within api/v2/layouts/error_layout (Duration: 0.3ms | Allocations: 71)
2020-09-08T15:18:19 [I|app|52d6cf08] Completed 500 Internal Server Error in 147ms (Views: 1.1ms | ActiveRecord: 29.5ms | Allocations: 14197)
1 Like

Hi, @eugip8. Unfortunatelly I couldn’t reproduce the issue :frowning: Maybe @shiramax would have some insights.

Although passing an empty compute_attributes param shouldn’t have an impact in this case, I agree that it’s not 100% right.

I’ve opened an issue to fix that: Bug #30815: Stop sending empty compute_attributes param - Hammer CLI - Foreman

3 Likes

Maybe it has to do something with managed/unmanaged machines in Foreman (because of the Host::Managed missing attribute error and the machine being unmanaged)? Or maybe with compute_resource_id, compute_resource_name… being nil?

Thanks for opening the bug :slight_smile: . I tried to dig in the hammer code trying to see where thing was set but I’m not a ruby expert to debug this.

I wasn’t able to reproduce this error as well I tried both on managed host and unmanaged, @ofedoren as you said the compute_attributed shouldn’t cause this error.

@eugip8, I don’t believe that the error related the manage host, or that the compute_resource_id and compute_resource_name … is nil

can you please check if this happens every time you are trying to update the host? for example, try to rename the host, is it still happens?
also, on which provider you are trying to provision the host?

thanks!

1 Like

I’m just using foreman as an ENC, so we are not provisioning the hosts with Foreman. Maybe the :unattended: false I have in /etc/foreman/settings.yaml has something to do with the problem? It’s not the first time I’ve encountered problems with that option disabled.

And renaming the host doesn’t make a difference :frowning: