Project

General

Profile

Actions

Bug #28899

closed

Host update deletes assigned puppet classes

Added by Dirk Götz almost 5 years ago. Updated over 4 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 #1

Updated by Dirk Götz almost 5 years ago

  • Subject changed from Host update deletes asigned puppet classes to Host update deletes assigned puppet classes
Actions #2

Updated by Oleh Fedorenko almost 5 years ago

  • Status changed from New to Assigned
  • Assignee set to Oleh Fedorenko
  • Triaged changed from No to Yes

This is reproducible. Unfortunatelly we haven't found that before because if a host is in a host group with puppet classes assigned, then after 'hammer host update' the removed (by mistake) classes are still there inherited from the host group.

Working on fix, thanks!

Actions #3

Updated by The Foreman Bot almost 5 years ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/hammer-cli-foreman/pull/490 added
Actions #4

Updated by Dirk Götz almost 5 years ago

laugmanuel tested for me and commented in the PR that the problem is fixed. Thanks for the fast fix!

Actions #5

Updated by The Foreman Bot almost 5 years ago

  • Fixed in Releases hammer-cli-foreman-0.20.0 added
Actions #6

Updated by Oleh Fedorenko almost 5 years ago

  • Status changed from Ready For Testing to Closed
Actions #7

Updated by The Foreman Bot almost 5 years ago

  • Pull request https://github.com/theforeman/hammer-cli-foreman/pull/492 added
Actions #8

Updated by Oleh Fedorenko over 4 years ago

  • Pull request deleted (https://github.com/theforeman/hammer-cli-foreman/pull/492)
Actions

Also available in: Atom PDF