Project

General

Profile

Bug #28899

Host update deletes assigned puppet classes

Added by Dirk Götz 4 months ago. Updated 3 months ago.

Status:
Closed
Priority:
High
Category:
Hosts
Target version:
-
Difficulty:
Triaged:
Yes
Bugzilla link:
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.

Associated revisions

Revision 2686ffca (diff)
Added by Oleh Fedorenko 4 months ago

Fixes #28899 - Host update doesn't delete assigned puppet classes

History

#1 Updated by Dirk Götz 4 months ago

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

#2 Updated by Oleh Fedorenko 4 months ago

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

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!

#3 Updated by The Foreman Bot 4 months ago

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

#4 Updated by Dirk Götz 4 months ago

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

#5 Updated by The Foreman Bot 4 months ago

  • Fixed in Releases hammer-cli-foreman-0.20.0 added

#6 Updated by Oleh Fedorenko 4 months ago

  • Status changed from Ready For Testing to Closed

#7 Updated by The Foreman Bot 4 months ago

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

#8 Updated by Oleh Fedorenko 3 months ago

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

Also available in: Atom PDF