Skip to content

Commit

Permalink
Fixes #38128 - allow blank image mode digests
Browse files Browse the repository at this point in the history
  • Loading branch information
ianballou committed Jan 8, 2025
1 parent b551d41 commit 01404e2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/katello/host/content_facet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class ContentFacet < Katello::Model
validates_associated :content_view_environment_content_facets, :message => _("invalid: The content source must sync the lifecycle environment assigned to the host. See the logs for more information.")
validates :host, :presence => true, :allow_blank => false
validates :bootc_booted_digest, :bootc_available_digest, :bootc_staged_digest, :bootc_rollback_digest,
format: { with: /\Asha256:[A-Fa-f0-9]{64}\z/, message: "must be a valid sha256 digest", allow_nil: true }
format: { with: /\Asha256:[A-Fa-f0-9]{64}\z/, message: "must be a valid sha256 digest", allow_blank: true }

scope :with_environments, ->(lifecycle_environments) do
joins(:content_view_environment_content_facets => :content_view_environment).
Expand Down
7 changes: 7 additions & 0 deletions test/models/concerns/host_managed_extensions_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ def test_pools_expiring_in_days
assert_includes ::Host.search_for('pools_expiring_in_days = 30'), host_with_pool
end

def test_bootc_allow_blank
Support::HostSupport.attach_content_facet(@foreman_host, @view, @library)
@foreman_host.content_facet.update(bootc_booted_image: 'quay.io/salami/soup')
@foreman_host.content_facet.update(bootc_booted_digest: '')
assert @foreman_host.content_facet.image_mode_host?
end

def test_image_mode_search
host_no_image = FactoryBot.create(:host, :with_content, :with_subscription, :content_view => @library_view, :lifecycle_environment => @library)
Support::HostSupport.attach_content_facet(@foreman_host, @view, @library)
Expand Down

0 comments on commit 01404e2

Please sign in to comment.