Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #38128 - allow blank image mode digests #11275

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading