Project

General

Profile

Actions

Bug #28899

closed

Host update deletes assigned puppet classes

Added by Dirk Götz about 5 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
High
Category:
Hosts
Target version:
-
Difficulty:
Triaged:
Yes
Team Backlog:
Fixed in Releases:
Found in Releases:
In Kanboard:

Description

We found hosts losing puppet classes when updating the owner via cli. After some investigation we could confirm that it is only caused by the update via cli and it is independent from the attribute changed.
In the logs we found the cli is sending an empty array for puppetclass_ids (in this case it was only an update of the comment intended). I think an empty hash for compute_attributes, content_facet_attributes and subscription_facet_attributes is also not good, but we have not seen any problem caused by this.

[ INFO 2020-01-30T12:23:20 HammerCLI::MainCommand] Called with options: {"option_debug"=>true}
[DEBUG 2020-01-30T12:23:20 HammerCLIForeman::CommandExtensions::OptionSources] Called block for HammerCLIForeman::Command option sources:
        #<Proc:0x00007f8bb2ad2740@/Users/d0294040/.rvm/gems/ruby-2.6.3/gems/hammer_cli_foreman-0.19.7/lib/hammer_cli_foreman/command_extensions/option_sources.rb:6>
[ INFO 2020-01-30T12:23:20 HammerCLIForeman::Host] Called with options: {}
[DEBUG 2020-01-30T12:23:20 HammerCLIForeman::CommandExtensions::OptionSources] Called block for HammerCLIForeman::Command option sources:
        #<Proc:0x00007f8bb2ad2740@/Users/d0294040/.rvm/gems/ruby-2.6.3/gems/hammer_cli_foreman-0.19.7/lib/hammer_cli_foreman/command_extensions/option_sources.rb:6>
[DEBUG 2020-01-30T12:23:20 HammerCLIForeman::CommandExtensions::PuppetEnvironment] Called block for HammerCLIForeman::Hostgroup::UpdateCommand option sources:
        #<Proc:0x00007f8bb2ac2ed0@/Users/d0294040/.rvm/gems/ruby-2.6.3/gems/hammer_cli_foreman-0.19.7/lib/hammer_cli_foreman/command_extensions/puppet_environment.rb:13>
[ INFO 2020-01-30T12:23:20 HammerCLIForeman::Host::UpdateCommand] Called with options: {"option_puppetclass_ids"=>[], "option_volume_list"=>[], "option_interface_list"=>[], "option_id"=>"30759", "option_comment"=>"test komment"}
[ INFO 2020-01-30T12:23:20 API] Server: https://foreman.dm-drogeriemarkt.com/
[ INFO 2020-01-30T12:23:20 API] PUT /api/hosts/30759
[DEBUG 2020-01-30T12:23:20 API] Params: {
    "host" => {
                      "puppetclass_ids" => [],
                              "comment" => "test komment",
                   "compute_attributes" => {},
             "content_facet_attributes" => {},
        "subscription_facet_attributes" => {}
    }
}

I marked this as priority high, because it causes hosts silently losing puppet class assignment which a user will only recognize when waiting for changes rolled out via puppet. If the user is not looking for it, it can cause problems like having puppet code not tested in staging environments and directly affecting production which was not updated via hammer like we experienced.

Actions

Also available in: Atom PDF