Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #35382 - Add rake task to refresh repos on all pulp proxies
Co-authored-by: Joniel Pasqualetto jpasqual@redhat.com
- Loading branch information
Showing
2 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace :katello do | ||
desc 'Refresh all repositories in all smart proxies and main server' | ||
task :refresh_repos => ["environment", "dynflow:client"] do | ||
User.current = User.anonymous_api_admin | ||
::ForemanTasks.async_task(::Actions::BulkAction, ::Actions::Pulp3::Orchestration::Repository::RefreshRepos, SmartProxy.all) | ||
puts _("Repos are being refreshed in the background.") | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
require 'katello_test_helper' | ||
require 'rake' | ||
|
||
module Katello | ||
class RefreshReposTest < ActiveSupport::TestCase | ||
def setup | ||
Rake.application.rake_require 'katello/tasks/refresh_repos' | ||
Rake::Task['katello:refresh_repos'].reenable | ||
Rake::Task.define_task(:environment) | ||
Rake::Task.define_task('dynflow:client') | ||
end | ||
|
||
def test_refresh_repos_on_smart_proxies | ||
::ForemanTasks.expects(:async_task).with(::Actions::BulkAction, ::Actions::Pulp3::Orchestration::Repository::RefreshRepos, SmartProxy.all) | ||
Rake.application.invoke_task('katello:refresh_repos') | ||
end | ||
end | ||
end |