Project

General

Profile

Actions

Bug #37518

closed

Kickstart Repository association is not deleted from a host when it is unregistered

Added by Ian Ballou 6 months ago. Updated 6 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Hosts
Target version:
Difficulty:
Triaged:
Yes
Fixed in Releases:
Found in Releases:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=2277133

Description of problem:

Continuing from https://bugzilla.redhat.com/show_bug.cgi?id=2277130 , If we look at the unregistered host from UI as well as the database, It will still have a Kickstart repository ID associated.

Now, due to the lack of CV and LCE associations, When someone tries to directly just rebuild that stale entry, The kickstart template will be generated just with the BaseOS kickstart repo and will miss the Appstream repo, leading to failures during provisioning process.

Version-Release number of selected component (if applicable):

Any version

How reproducible:

Always

Steps to Reproduce:

Exact same as https://bugzilla.redhat.com/show_bug.cgi?id=2277130

Actual results:

Same as https://bugzilla.redhat.com/show_bug.cgi?id=2277130

Additionally, if we look at the content_facet of the host, It will still have kickstart repository ID associated.

Before:

irb(main):022:0> pp h.content_facet
#<Katello::Host::ContentFacet:0x000055d6e788d920
id: 21,
host_id: 28,
uuid: "8d81043f-a295-4ba3-8ed1-37e1b50b20ea",
kickstart_repository_id: 278,
content_source_id: 1,
installable_security_errata_count: 0,
installable_enhancement_errata_count: 0,
installable_bugfix_errata_count: 0,
applicable_rpm_count: 16,
upgradable_rpm_count: 0,
applicable_module_stream_count: 0,
upgradable_module_stream_count: 0,
applicable_deb_count: 0,
upgradable_deb_count: 0>

After:

irb(main):004:0> pp h.content_facet
#<Katello::Host::ContentFacet:0x0000559762f3e900
id: 21,
host_id: 28,
uuid: nil,
kickstart_repository_id: 278,
content_source_id: 1,
installable_security_errata_count: 0,
installable_enhancement_errata_count: 0,
installable_bugfix_errata_count: 0,
applicable_rpm_count: 16,
upgradable_rpm_count: 0,
applicable_module_stream_count: 0,
upgradable_module_stream_count: 0,
applicable_deb_count: 0,
upgradable_deb_count: 0>

The same would be visible in UI , when editing the host.

If we put the Host in Build mode, satellite allows doing so and just with the BaseOS kickstart repo URL which eventually leads to failed kickstart deployment, due to missing packages [ i.e. missing appstream kickstart repo ].

Expected results:

When registering a host, The kickstart_repository association should be removed from the host as well.

So that when a user mistakenly tries to rebuild the host, It would show some sort of error with template rendering thus forcing the user to edit the host and select all relevant values and the save them, before retrying the build action.

Additional info:

If i combine https://github.com/Katello/katello/pull/10797/files with host.content_facet.kickstart_repository = nil i.e.

  1. git diff
    diff --git a/app/services/katello/registration_manager.rb b/app/services/katello/registration_manager.rb
    index e3add5b..9f93757 100644
    --- a/app/services/katello/registration_manager.rb
    ++ b/app/services/katello/registration_manager.rb
    @ -316,6 +316,8 @ module Katello
    host.content_facet.applicable_errata = []
    host.content_facet.uuid = nil
    host.content_facet.content_view_environments = []
    host.content_facet.content_source = ::SmartProxy.pulp_primary
    + host.content_facet.kickstart_repository = nil
    host.content_facet.save!
    Rails.logger.debug "remove_host_artifacts: marking CVEs unchanged to prevent backend update"
    host.content_facet.mark_cves_unchanged

It does the job at database level and also does not allow putting the host in build mode.

But if I edit the host, And go to OS tab, I can still see the repository there. So I guess some additional UI level fix would be needed to maintain consistency.

Actions #1

Updated by The Foreman Bot 6 months ago

  • Status changed from New to Ready For Testing
  • Assignee set to Ian Ballou
  • Pull request https://github.com/Katello/katello/pull/11011 added
Actions #2

Updated by Partha Aji 6 months ago

  • Subject changed from Kickstart Repository association is not deleted from a host when it is unregistered to Kickstart Repository association is not deleted from a host when it is unregistered
  • Triaged changed from No to Yes
Actions #3

Updated by The Foreman Bot 6 months ago

  • Fixed in Releases Katello 4.14.0 added
Actions #4

Updated by Ian Ballou 6 months ago

  • Status changed from Ready For Testing to Closed
Actions

Also available in: Atom PDF