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 #36625 - allow verify checksum for all repo types #10671

Merged
Merged
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
4 changes: 1 addition & 3 deletions app/lib/actions/katello/repository/sync.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ def plan(repo, options = {})

validate_repo!(repo: repo,
source_url: source_url,
validate_contents: validate_contents,
skip_metadata_check: skip_metadata_check,
skip_candlepin_check: options.fetch(:skip_candlepin_check, false))

Expand Down Expand Up @@ -81,9 +80,8 @@ def humanized_name
end
end

def validate_repo!(repo:, source_url:, validate_contents:, skip_metadata_check:, skip_candlepin_check:)
def validate_repo!(repo:, source_url:, skip_metadata_check:, skip_candlepin_check:)
fail ::Katello::Errors::InvalidActionOptionError, _("Unable to sync repo. This repository does not have a feed url.") if repo.url.blank? && source_url.blank?
fail ::Katello::Errors::InvalidActionOptionError, _("Cannot validate contents on non-yum/deb repositories.") if validate_contents && !repo.yum? && !repo.deb?
fail ::Katello::Errors::InvalidActionOptionError, _("Cannot skip metadata check on non-yum/deb repositories.") if skip_metadata_check && !repo.yum? && !repo.deb?
::Katello::Util::CandlepinRepositoryChecker.check_repository_for_sync!(repo) if repo.yum? && !skip_candlepin_check
end
Expand Down
12 changes: 2 additions & 10 deletions app/lib/actions/katello/repository/verify_checksum.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,11 @@ class VerifyChecksum < Actions::EntryAction

def plan(repo)
action_subject(repo)

if SmartProxy.pulp_primary.pulp3_support?(repo)
plan_action(Actions::Pulp3::Repository::Repair, repo.id, SmartProxy.pulp_primary)
else
options = {}
options[:validate_contents] = true
plan_action(Actions::Katello::Repository::Sync, repo, options)
end
plan_action(Actions::Pulp3::Repository::Repair, repo.id, SmartProxy.pulp_primary)
end

def presenter
found = all_planned_actions(Katello::Repository::Sync)
found = all_planned_actions(Pulp3::Repository::Repair) if found.empty?
found = all_planned_actions(Pulp3::Repository::Repair)
Helpers::Presenter::Delegated.new(self, found)
end
end
Expand Down
Loading