From c09028127f7049a432870e82daf58b14fed003d4 Mon Sep 17 00:00:00 2001 From: Oleh Fedorenko Date: Thu, 18 Jan 2024 16:18:01 +0000 Subject: [PATCH] Ruby 3 support --- .../actions/katello/capsule_content/sync.rb | 2 +- .../katello/capsule_content/sync_capsule.rb | 2 +- .../actions/katello/content_view/publish.rb | 4 +-- .../actions/katello/content_view/remove.rb | 2 +- .../katello/content_view_version/destroy.rb | 2 +- .../katello/content_view_version/export.rb | 2 +- app/lib/actions/katello/product/destroy.rb | 2 +- .../repository/bulk_metadata_generate.rb | 6 ++--- .../katello/repository/clone_contents.rb | 4 +-- .../katello/repository/import_upload.rb | 2 +- .../repository/multi_clone_contents.rb | 2 +- .../katello/repository/remove_content.rb | 2 +- app/lib/actions/katello/repository/sync.rb | 2 +- .../middleware/backend_services_check.rb | 11 ++++---- app/lib/actions/middleware/remote_action.rb | 4 +-- app/lib/actions/pulp3/capsule_content/sync.rb | 2 +- .../alternate_content_source/delete.rb | 2 +- .../repository/generate_metadata.rb | 2 +- .../orchestration/repository/import_upload.rb | 4 +-- .../orchestration/repository/remove_units.rb | 2 +- .../pulp3/orchestration/repository/sync.rb | 4 +-- app/lib/katello/lazy_accessor.rb | 12 ++++----- .../pulp3/content_view_version/export.rb | 6 ++--- katello.gemspec | 5 +++- test/actions/katello/activation_key_test.rb | 2 +- .../content_view_version/destroy_test.rb | 2 +- test/actions/katello/organization_test.rb | 4 +-- test/actions/katello/product_test.rb | 6 ++--- .../katello/repository/import_upload_test.rb | 2 +- .../repository/metadata_generate_test.rb | 10 +++---- test/actions/katello/repository_test.rb | 12 ++++----- .../export_repository_test.rb | 5 ++-- .../ansible_collection_sync_test.rb | 10 +++---- .../orchestration/copy_all_units_test.rb | 26 +++++++++---------- .../pulp3/orchestration/docker_sync_test.rb | 2 +- .../orchestration/file_remove_units_test.rb | 2 +- .../pulp3/orchestration/file_sync_test.rb | 12 ++++----- .../multi_copy_all_units_test.rb | 16 ++++++------ .../orchestration/remove_orphans_test.rb | 2 +- .../orchestration/rpm_remove_units_test.rb | 2 +- .../pulp3/orchestration/yum_sync_test.rb | 14 +++++----- .../controllers/api/v2/api_controller_test.rb | 4 +-- test/katello_test_helper.rb | 4 +-- .../activation_key_authorization_test.rb | 4 +-- ...ifecycle_environment_authorization_test.rb | 8 +++--- .../organization_authorization_test.rb | 8 +++--- .../product_authorization_test.rb | 4 +-- .../repository_authorization_test.rb | 8 +++--- .../content_view_package_group_filter_test.rb | 2 +- test/models/katello/ostree_test.rb | 2 +- test/services/katello/pulp3/deb_test.rb | 4 +-- .../services/katello/pulp3/docker_tag_test.rb | 10 +++---- test/services/katello/pulp3/erratum_test.rb | 4 +-- test/services/katello/pulp3/file_unit_test.rb | 4 +-- test/services/katello/pulp3/orphan_test.rb | 2 +- .../katello/pulp3/package_group_test.rb | 2 +- .../pulp3/repository/python/python_test.rb | 2 +- .../katello/pulp3/repository_list_test.rb | 2 +- test/services/katello/pulp3/rpm_test.rb | 4 +-- test/services/katello/pulp3/srpm_test.rb | 6 ++--- .../katello/registration_manager_test.rb | 20 +++++++------- test/support/controller_support.rb | 4 +-- test/support/pulp3_support.rb | 2 +- 63 files changed, 166 insertions(+), 161 deletions(-) diff --git a/app/lib/actions/katello/capsule_content/sync.rb b/app/lib/actions/katello/capsule_content/sync.rb index 88b8813ac36..09cfaa3a0c7 100644 --- a/app/lib/actions/katello/capsule_content/sync.rb +++ b/app/lib/actions/katello/capsule_content/sync.rb @@ -36,7 +36,7 @@ def plan(smart_proxy, options = {}) if smart_proxy.has_feature?(SmartProxy::PULP3_FEATURE) plan_action(Actions::Pulp3::ContentGuard::Refresh, smart_proxy) end - plan_action(SyncCapsule, smart_proxy, refresh_options) + plan_action(SyncCapsule, smart_proxy, **refresh_options) end plan_self(smart_proxy_id: smart_proxy.id) end diff --git a/app/lib/actions/katello/capsule_content/sync_capsule.rb b/app/lib/actions/katello/capsule_content/sync_capsule.rb index eb6f34bf728..23a4814635c 100644 --- a/app/lib/actions/katello/capsule_content/sync_capsule.rb +++ b/app/lib/actions/katello/capsule_content/sync_capsule.rb @@ -19,7 +19,7 @@ def plan(smart_proxy, options = {}) options[:repository_ids_list] = repos.pluck(:id) end if smart_proxy.has_feature?(SmartProxy::PULP3_FEATURE) - plan_action(Actions::Pulp3::Orchestration::Repository::RefreshRepos, smart_proxy, options) + plan_action(Actions::Pulp3::Orchestration::Repository::RefreshRepos, smart_proxy, **options) end repos.in_groups_of(Setting[:foreman_proxy_content_batch_size], false) do |repo_batch| diff --git a/app/lib/actions/katello/content_view/publish.rb b/app/lib/actions/katello/content_view/publish.rb index d41914c66f8..a6bca8af910 100644 --- a/app/lib/actions/katello/content_view/publish.rb +++ b/app/lib/actions/katello/content_view/publish.rb @@ -13,7 +13,7 @@ class Publish < Actions::EntryAction def plan(content_view, description = "", options = {importing: false, syncable: false}) # rubocop:disable Metrics/PerceivedComplexity action_subject(content_view) - content_view.check_ready_to_publish!(options.slice(:importing, :syncable)) + content_view.check_ready_to_publish!(**options.slice(:importing, :syncable)) unless options[:importing] || options[:syncable] ::Katello::Util::CandlepinRepositoryChecker.check_repositories_for_publish!(content_view) end @@ -57,7 +57,7 @@ def plan(content_view, description = "", options = {importing: false, syncable: separated_repo_map = separated_repo_mapping(repository_mapping, content_view.solve_dependencies) if options[:importing] - handle_import(version, options.slice(:path, :metadata)) + handle_import(version, **options.slice(:path, :metadata)) elsif separated_repo_map[:pulp3_yum_multicopy].keys.flatten.present? plan_action(Repository::MultiCloneToVersion, separated_repo_map[:pulp3_yum_multicopy], version) end diff --git a/app/lib/actions/katello/content_view/remove.rb b/app/lib/actions/katello/content_view/remove.rb index e56f4dc727e..86d50ebe71f 100644 --- a/app/lib/actions/katello/content_view/remove.rb +++ b/app/lib/actions/katello/content_view/remove.rb @@ -31,7 +31,7 @@ def plan(content_view, options) concurrence do all_cv_envs.each do |cv_env| if cv_env.hosts.any? || cv_env.activation_keys.any? - plan_action(ContentViewEnvironment::ReassignObjects, cv_env, options) + plan_action(ContentViewEnvironment::ReassignObjects, cv_env, **options) end end end diff --git a/app/lib/actions/katello/content_view_version/destroy.rb b/app/lib/actions/katello/content_view_version/destroy.rb index 2132b8b50dd..29e990db503 100644 --- a/app/lib/actions/katello/content_view_version/destroy.rb +++ b/app/lib/actions/katello/content_view_version/destroy.rb @@ -14,7 +14,7 @@ def plan(version, options = {}) repos.each do |repo| repo_options = options.clone repo_options[:docker_cleanup] = false - plan_action(Repository::Destroy, repo, repo_options) + plan_action(Repository::Destroy, repo, **repo_options) docker_cleanup ||= repo.docker? end end diff --git a/app/lib/actions/katello/content_view_version/export.rb b/app/lib/actions/katello/content_view_version/export.rb index bb6ad89a768..9aeba112bee 100644 --- a/app/lib/actions/katello/content_view_version/export.rb +++ b/app/lib/actions/katello/content_view_version/export.rb @@ -11,7 +11,7 @@ def plan(options) action_subject(options.fetch(:content_view_version)) sequence do - export_output = plan_action(::Actions::Pulp3::Orchestration::ContentViewVersion::Export, options).output + export_output = plan_action(::Actions::Pulp3::Orchestration::ContentViewVersion::Export, **options).output plan_self(export_history_id: export_output[:export_history_id], exported_file_checksum: export_output[:exported_file_checksum], diff --git a/app/lib/actions/katello/product/destroy.rb b/app/lib/actions/katello/product/destroy.rb index c49b8e1f7ed..db5ac6a1369 100644 --- a/app/lib/actions/katello/product/destroy.rb +++ b/app/lib/actions/katello/product/destroy.rb @@ -73,7 +73,7 @@ def plan_content_destruction(product, skip_environment_update) def plan_repo_destruction(product, options) product.repositories.in_default_view.each do |repo| repo_options = options.clone - plan_action(Katello::Repository::Destroy, repo, repo_options.merge(destroy_content: false)) + plan_action(Katello::Repository::Destroy, repo, **repo_options.merge(destroy_content: false)) end end diff --git a/app/lib/actions/katello/repository/bulk_metadata_generate.rb b/app/lib/actions/katello/repository/bulk_metadata_generate.rb index 91617f989ba..f251f3c77b8 100644 --- a/app/lib/actions/katello/repository/bulk_metadata_generate.rb +++ b/app/lib/actions/katello/repository/bulk_metadata_generate.rb @@ -4,9 +4,9 @@ module Repository class BulkMetadataGenerate < Actions::Base def plan(repos, options = {}) sequence do - plan_action(::Actions::BulkAction, ::Actions::Katello::Repository::MetadataGenerate, repos.in_default_view, options) if repos.in_default_view.any? - plan_action(::Actions::BulkAction, ::Actions::Katello::Repository::MetadataGenerate, repos.archived, options) if repos.archived.any? - plan_action(::Actions::BulkAction, ::Actions::Katello::Repository::MetadataGenerate, repos.in_published_environments, options) if repos.in_published_environments.any? + plan_action(::Actions::BulkAction, ::Actions::Katello::Repository::MetadataGenerate, repos.in_default_view, **options) if repos.in_default_view.any? + plan_action(::Actions::BulkAction, ::Actions::Katello::Repository::MetadataGenerate, repos.archived, **options) if repos.archived.any? + plan_action(::Actions::BulkAction, ::Actions::Katello::Repository::MetadataGenerate, repos.in_published_environments, **options) if repos.in_published_environments.any? end end end diff --git a/app/lib/actions/katello/repository/clone_contents.rb b/app/lib/actions/katello/repository/clone_contents.rb index 99eece0a757..054fc87e306 100644 --- a/app/lib/actions/katello/repository/clone_contents.rb +++ b/app/lib/actions/katello/repository/clone_contents.rb @@ -25,7 +25,7 @@ def plan(source_repositories, new_repository, options) index_options = {id: new_repository.id, force_index: true} index_options[:source_repository_id] = source_repositories.first.id if source_repositories.count == 1 && filters.empty? && rpm_filenames.nil? - plan_action(Katello::Repository::IndexContent, index_options) + plan_action(Katello::Repository::IndexContent, **index_options) end end @@ -38,7 +38,7 @@ def metadata_generate(source_repositories, new_repository, filters, rpm_filename metadata_options[:source_repository] = source_repositories.first end - plan_action(Katello::Repository::MetadataGenerate, new_repository, metadata_options) + plan_action(Katello::Repository::MetadataGenerate, new_repository, **metadata_options) unless source_repositories.first.saved_checksum_type == new_repository.saved_checksum_type plan_self(:source_checksum_type => source_repositories.first.saved_checksum_type, :target_repo_id => new_repository.id) diff --git a/app/lib/actions/katello/repository/import_upload.rb b/app/lib/actions/katello/repository/import_upload.rb index f6a91a47a69..98f8e0b08f8 100644 --- a/app/lib/actions/katello/repository/import_upload.rb +++ b/app/lib/actions/katello/repository/import_upload.rb @@ -43,7 +43,7 @@ def plan(repository, uploads, options = {}) action_class = ::Actions::Pulp3::Orchestration::Repository::ImportUpload end - import_upload = plan_action(action_class, repository, SmartProxy.pulp_primary, import_upload_args) + import_upload = plan_action(action_class, repository, SmartProxy.pulp_primary, **import_upload_args) plan_action(FinishUpload, repository, :import_upload_task => import_upload.output, generate_metadata: false, content_type: options[:content_type]) import_upload.output diff --git a/app/lib/actions/katello/repository/multi_clone_contents.rb b/app/lib/actions/katello/repository/multi_clone_contents.rb index 94eb294087a..6ed7c9e2a79 100644 --- a/app/lib/actions/katello/repository/multi_clone_contents.rb +++ b/app/lib/actions/katello/repository/multi_clone_contents.rb @@ -42,7 +42,7 @@ def metadata_generate(source_repositories, new_repository, filters, matching_con metadata_options[:source_repository] = source_repositories.first end - plan_action(Katello::Repository::MetadataGenerate, new_repository, metadata_options) + plan_action(Katello::Repository::MetadataGenerate, new_repository, **metadata_options) unless source_repositories.first.saved_checksum_type == new_repository.saved_checksum_type plan_self(:source_checksum_type => source_repositories.first.saved_checksum_type, :target_repo_id => new_repository.id) diff --git a/app/lib/actions/katello/repository/remove_content.rb b/app/lib/actions/katello/repository/remove_content.rb index a926c8e1cc7..552a1c9e5dd 100644 --- a/app/lib/actions/katello/repository/remove_content.rb +++ b/app/lib/actions/katello/repository/remove_content.rb @@ -32,7 +32,7 @@ def plan(repository, content_units, options = {}) repository.clear_smart_proxy_sync_histories pulp_action = plan_action( Pulp3::Orchestration::Repository::RemoveUnits, - repository, SmartProxy.pulp_primary, remove_content_args) + repository, SmartProxy.pulp_primary, **remove_content_args) return if pulp_action.error plan_self(:content_unit_class => content_units.first.class.name, :content_unit_ids => content_unit_ids) plan_action(CapsuleSync, repository) if sync_capsule diff --git a/app/lib/actions/katello/repository/sync.rb b/app/lib/actions/katello/repository/sync.rb index c5686b2af82..73c9cb8d8ec 100644 --- a/app/lib/actions/katello/repository/sync.rb +++ b/app/lib/actions/katello/repository/sync.rb @@ -42,7 +42,7 @@ def plan(repo, options = {}) sync_action = plan_action(Actions::Pulp3::Orchestration::Repository::Sync, repo, SmartProxy.pulp_primary, - pulp_sync_options) + **pulp_sync_options) output = sync_action.output plan_action(Katello::Repository::IndexContent, :id => repo.id, :force_index => skip_metadata_check) diff --git a/app/lib/actions/middleware/backend_services_check.rb b/app/lib/actions/middleware/backend_services_check.rb index 0a811f20fb1..16507382322 100644 --- a/app/lib/actions/middleware/backend_services_check.rb +++ b/app/lib/actions/middleware/backend_services_check.rb @@ -1,7 +1,7 @@ module Actions module Middleware class BackendServicesCheck < Dynflow::Middleware - def plan(*args) + def plan(*args, **kwargs) if Setting[:check_services_before_actions] #To prevent the ping from happening multiple times, keep track on the initial entry action #If capsule_id is passed as in args from an action, Katello::Ping checks the pulp server on the capsule @@ -10,7 +10,7 @@ def plan(*args) to_check = services - parent.input[:services_checked] if to_check.any? - result = User.as_anonymous_admin { ::Katello::Ping.ping(services: to_check, capsule_id: capsule_id(args))[:services] } + result = User.as_anonymous_admin { ::Katello::Ping.ping(services: to_check, capsule_id: capsule_id(args, kwargs))[:services] } to_check.each do |service| if result[service][:status] != ::Katello::Ping::OK_RETURN_CODE @@ -20,13 +20,14 @@ def plan(*args) parent.input[:services_checked].concat(to_check) end end - pass(*args) + pass(*args, **kwargs) end protected - def capsule_id(args) - capsule_id = nil + def capsule_id(args, kwargs) + capsule_id = kwargs[:capsule_id] || kwargs[:smart_proxy_id] + return capsule_id if capsule_id args.each do |arg| if arg.is_a? SmartProxy capsule_id = arg.id diff --git a/app/lib/actions/middleware/remote_action.rb b/app/lib/actions/middleware/remote_action.rb index f2f8b86d942..fefb32e189c 100644 --- a/app/lib/actions/middleware/remote_action.rb +++ b/app/lib/actions/middleware/remote_action.rb @@ -4,9 +4,9 @@ module Middleware # wraps the plan/run/finalize methods to include the info about the user # that triggered the action. class RemoteAction < Dynflow::Middleware - def plan(*args) + def plan(*args, **kwargs) fail "No current user is set. Please set User.current to perform a remote action" if User.current.nil? - pass(*args).tap do + pass(*args, **kwargs).tap do action.input[:remote_user] = User.remote_user action.input[:remote_cp_user] = User.remote_user end diff --git a/app/lib/actions/pulp3/capsule_content/sync.rb b/app/lib/actions/pulp3/capsule_content/sync.rb index 020583f5981..776dadc055b 100644 --- a/app/lib/actions/pulp3/capsule_content/sync.rb +++ b/app/lib/actions/pulp3/capsule_content/sync.rb @@ -7,7 +7,7 @@ def plan(repository, smart_proxy, options = {}) sequence do sync_task = plan_self(:repository_id => repository.id, :smart_proxy_id => smart_proxy.id, :options => options) options[:sync_task_output] = sync_task.output[:pulp_tasks] - plan_action(GenerateMetadata, repository, smart_proxy, options) + plan_action(GenerateMetadata, repository, smart_proxy, **options) end end diff --git a/app/lib/actions/pulp3/orchestration/alternate_content_source/delete.rb b/app/lib/actions/pulp3/orchestration/alternate_content_source/delete.rb index 4c64d7faf19..2ebc5333efc 100644 --- a/app/lib/actions/pulp3/orchestration/alternate_content_source/delete.rb +++ b/app/lib/actions/pulp3/orchestration/alternate_content_source/delete.rb @@ -6,7 +6,7 @@ class Delete < Pulp3::Abstract def plan(smart_proxy_acs, options = {}) sequence do plan_action(Actions::Pulp3::AlternateContentSource::Delete, smart_proxy_acs) - plan_action(Actions::Pulp3::AlternateContentSource::DeleteRemote, smart_proxy_acs, options) + plan_action(Actions::Pulp3::AlternateContentSource::DeleteRemote, smart_proxy_acs, **options) plan_self(smart_proxy_id: smart_proxy_acs.smart_proxy_id, smart_proxy_acs_id: smart_proxy_acs.id) end end diff --git a/app/lib/actions/pulp3/orchestration/repository/generate_metadata.rb b/app/lib/actions/pulp3/orchestration/repository/generate_metadata.rb index 8797bf8ea66..b49aec775bc 100644 --- a/app/lib/actions/pulp3/orchestration/repository/generate_metadata.rb +++ b/app/lib/actions/pulp3/orchestration/repository/generate_metadata.rb @@ -13,7 +13,7 @@ def plan(repository, smart_proxy, options = {}) if options[:source_repository] && publication_content_type plan_self(source_repository_id: options[:source_repository].id, target_repository_id: repository.id, smart_proxy_id: smart_proxy.id) elsif publication_content_type && (force_publication || repository.publication_href.nil? || !repository.using_mirrored_metadata?) - plan_action(Actions::Pulp3::Repository::CreatePublication, repository, smart_proxy, options) + plan_action(Actions::Pulp3::Repository::CreatePublication, repository, smart_proxy, **options) elsif !publication_content_type plan_self(target_repository_id: repository.id, contents_changed: options[:contents_changed], skip_publication: true) end diff --git a/app/lib/actions/pulp3/orchestration/repository/import_upload.rb b/app/lib/actions/pulp3/orchestration/repository/import_upload.rb index c5ccf97e23c..784fba93e24 100644 --- a/app/lib/actions/pulp3/orchestration/repository/import_upload.rb +++ b/app/lib/actions/pulp3/orchestration/repository/import_upload.rb @@ -16,7 +16,7 @@ def plan(repository, smart_proxy, args) smart_proxy, args).output plan_self(:commit_output => tag_manifest_output[:pulp_tasks]) - plan_action(Pulp3::Repository::SaveVersion, repository, {force_fetch_version: true, tasks: tag_manifest_output[:pulp_tasks]}) + plan_action(Pulp3::Repository::SaveVersion, repository, force_fetch_version: true, tasks: tag_manifest_output[:pulp_tasks]) else if content_unit_href artifact_output = { :content_unit_href => content_unit_href } @@ -33,7 +33,7 @@ def plan(repository, smart_proxy, args) repository, smart_proxy, commit_output[:pulp_tasks], - args.dig(:unit_type_id), args).output + args.dig(:unit_type_id), **args).output end plan_self(:commit_output => commit_output[:pulp_tasks], :artifact_output => artifact_output) diff --git a/app/lib/actions/pulp3/orchestration/repository/remove_units.rb b/app/lib/actions/pulp3/orchestration/repository/remove_units.rb index fd3512d1bf2..2c0f74033e8 100644 --- a/app/lib/actions/pulp3/orchestration/repository/remove_units.rb +++ b/app/lib/actions/pulp3/orchestration/repository/remove_units.rb @@ -7,7 +7,7 @@ class RemoveUnits < Pulp3::Abstract def plan(repository, smart_proxy, options) sequence do - action_output = plan_action(Actions::Pulp3::Repository::RemoveUnits, repository, smart_proxy, options).output + action_output = plan_action(Actions::Pulp3::Repository::RemoveUnits, repository, smart_proxy, **options).output plan_action(Pulp3::Repository::SaveVersion, repository, tasks: action_output[:pulp_tasks]) end end diff --git a/app/lib/actions/pulp3/orchestration/repository/sync.rb b/app/lib/actions/pulp3/orchestration/repository/sync.rb index 645c8a1cdef..b47a4c58562 100644 --- a/app/lib/actions/pulp3/orchestration/repository/sync.rb +++ b/app/lib/actions/pulp3/orchestration/repository/sync.rb @@ -4,10 +4,10 @@ module Orchestration module Repository class Sync < Pulp3::Abstract include Actions::Helpers::OutputPropagator - def plan(repository, smart_proxy, options) + def plan(repository, smart_proxy, **options) sequence do plan_action(Actions::Pulp3::Repository::RefreshRemote, repository, smart_proxy) - action_output = plan_action(Actions::Pulp3::Repository::Sync, repository, smart_proxy, options).output + action_output = plan_action(Actions::Pulp3::Repository::Sync, repository, smart_proxy, **options).output force_fetch_version = true if options[:optimize] == false version_output = plan_action(Pulp3::Repository::SaveVersion, repository, tasks: action_output[:pulp_tasks], :force_fetch_version => force_fetch_version).output diff --git a/app/lib/katello/lazy_accessor.rb b/app/lib/katello/lazy_accessor.rb index ed6821cd35b..7dd454aba32 100644 --- a/app/lib/katello/lazy_accessor.rb +++ b/app/lib/katello/lazy_accessor.rb @@ -56,21 +56,21 @@ def changed_remote_attributes=(val) @changed_remote_attributes = val end - def save(*) - if (status = super) + def save(...) + if (status = super(...)) changed_remote_attributes.clear end status end - def save!(*) - super.tap do + def save!(...) + super(...).tap do changed_remote_attributes.clear end end - def reload(*) - super.tap do + def reload(...) + super(...).tap do changed_remote_attributes.clear end end diff --git a/app/services/katello/pulp3/content_view_version/export.rb b/app/services/katello/pulp3/content_view_version/export.rb index aca1565f409..95df4bb0475 100644 --- a/app/services/katello/pulp3/content_view_version/export.rb +++ b/app/services/katello/pulp3/content_view_version/export.rb @@ -8,11 +8,11 @@ class Export FORMATS = [SYNCABLE, IMPORTABLE].freeze attr_reader :smart_proxy, :content_view_version, :destination_server, :from_content_view_version, :repository, :base_path - def self.create(options) + def self.create(**options) if options.delete(:format) == SYNCABLE - SyncableFormatExport.new(options) + SyncableFormatExport.new(**options) else - self.new(options) + self.new(**options) end end diff --git a/katello.gemspec b/katello.gemspec index 5b23fc1f33f..80bd130a966 100644 --- a/katello.gemspec +++ b/katello.gemspec @@ -13,7 +13,7 @@ Gem::Specification.new do |gem| gem.homepage = "http://www.katello.org" gem.summary = "Content and Subscription Management plugin for Foreman" gem.description = "Katello adds Content and Subscription Management to Foreman. For this it relies on Candlepin and Pulp." - gem.required_ruby_version = '~> 2.5' + gem.required_ruby_version = '>= 2.7', '< 3.1' gem.files = Dir["{app,webpack,vendor,lib,db,ca,config,locale}/**/*"] + Dir['LICENSE.txt', 'README.md', 'package.json'] @@ -49,6 +49,9 @@ Gem::Specification.new do |gem| # Pulp gem.add_dependency "anemone" + # required by anemone: https://github.com/chriskite/anemone/blob/next/lib/anemone/page.rb#L3 + # webrick is no longer a part of Ruby's stdlib: https://bugs.ruby-lang.org/issues/17303 + gem.add_dependency "webrick" #pulp3 gem.add_dependency "pulpcore_client", ">= 3.39.0", "< 3.40.0" diff --git a/test/actions/katello/activation_key_test.rb b/test/actions/katello/activation_key_test.rb index cfdd9b7c543..419f59900c9 100644 --- a/test/actions/katello/activation_key_test.rb +++ b/test/actions/katello/activation_key_test.rb @@ -29,7 +29,7 @@ class CreateTest < TestBase plan_action action, activation_key, service_level: 'Self-support' - assert_action_planned_with(action, ::Actions::Candlepin::ActivationKey::Create, candlepin_input) + assert_action_planned_with(action, ::Actions::Candlepin::ActivationKey::Create, **candlepin_input) end it 'raises error when validation fails' do diff --git a/test/actions/katello/content_view_version/destroy_test.rb b/test/actions/katello/content_view_version/destroy_test.rb index f463fca68f4..120ee407119 100644 --- a/test/actions/katello/content_view_version/destroy_test.rb +++ b/test/actions/katello/content_view_version/destroy_test.rb @@ -20,7 +20,7 @@ class DestroyTest < ActiveSupport::TestCase plan_action(action, @version, options) @version.repositories.each do |repo| - assert_action_planned_with(action, Actions::Katello::Repository::Destroy, repo, options) + assert_action_planned_with(action, Actions::Katello::Repository::Destroy, repo, **options) end end end diff --git a/test/actions/katello/organization_test.rb b/test/actions/katello/organization_test.rb index 9a5dcf808b8..82883a20b26 100644 --- a/test/actions/katello/organization_test.rb +++ b/test/actions/katello/organization_test.rb @@ -218,7 +218,7 @@ class ManifestImportTest < TestBase ::Actions::Candlepin::Owner::ImportProducts, organization_id: organization.id ) - assert_action_planned_with(action, ::Actions::Katello::Repository::RefreshRepository) do |args| + assert_action_planned_with(action, ::Actions::Katello::Repository::RefreshRepository) do |*args| assert args.first.library_instance? end end @@ -298,7 +298,7 @@ class ManifestDeleteTest < TestBase ::Actions::Candlepin::Owner::DestroyImports, label: organization.label ) - assert_action_planned_with(action, ::Actions::Katello::Repository::RefreshRepository) do |args| + assert_action_planned_with(action, ::Actions::Katello::Repository::RefreshRepository) do |*args| assert args.first.library_instance? end end diff --git a/test/actions/katello/product_test.rb b/test/actions/katello/product_test.rb index 1fa59e26403..2d0657b2272 100644 --- a/test/actions/katello/product_test.rb +++ b/test/actions/katello/product_test.rb @@ -203,11 +203,11 @@ class DestroyTest < TestBase assert_action_planned_with(action, candlepin_destroy_class, cp_id: product.cp_id, owner: product.organization.label) assert_action_planned_with(action, ::Actions::Katello::Product::ContentDestroy) do |root| - root.first.repositories.where.not(id: root.first.repositories.first.id).empty? - !root.first.repositories.first.redhat? + root.repositories.where.not(id: root.repositories.first.id).empty? + !root.repositories.first.redhat? end assert_action_planned_with(action, ::Actions::Katello::Repository::Destroy) do |repo| - default_view_repos.include?(repo.first.id) + default_view_repos.include?(repo.id) end assert_action_planned_with(action, diff --git a/test/actions/katello/repository/import_upload_test.rb b/test/actions/katello/repository/import_upload_test.rb index abf2f831cd3..319eba790d7 100644 --- a/test/actions/katello/repository/import_upload_test.rb +++ b/test/actions/katello/repository/import_upload_test.rb @@ -26,7 +26,7 @@ module Actions assert_action_planned_with(action, pulp3_import_class, repo, SmartProxy.pulp_primary, - import_upload_args) + **import_upload_args) end end end diff --git a/test/actions/katello/repository/metadata_generate_test.rb b/test/actions/katello/repository/metadata_generate_test.rb index cef033a6189..9bee1d9780a 100644 --- a/test/actions/katello/repository/metadata_generate_test.rb +++ b/test/actions/katello/repository/metadata_generate_test.rb @@ -23,7 +23,7 @@ module Actions plan_action(action, yum_repo) assert_action_planned_with(action, pulp_metadata_generate_class, yum_repo, SmartProxy.pulp_primary, - action_options) + **action_options) end it 'plans a yum refresh in other location' do @@ -34,7 +34,7 @@ module Actions plan_action(action, yum_repo) assert_action_planned_with(action, pulp_metadata_generate_class, yum_repo, SmartProxy.pulp_primary, - action_options) + **action_options) ensure Location.current = old_location end @@ -47,7 +47,7 @@ module Actions yum_action_options[:source_repository] = yum_repo2 assert_action_planned_with(action, pulp_metadata_generate_class, yum_repo, SmartProxy.pulp_primary, - yum_action_options) + **yum_action_options) end it 'plans a yum refresh with matching content true' do @@ -57,7 +57,7 @@ module Actions yum_action_options = action_options.clone yum_action_options[:matching_content] = true assert_action_planned_with(action, pulp_metadata_generate_class, yum_repo, SmartProxy.pulp_primary, - yum_action_options) + **yum_action_options) end it 'plans a yum refresh with matching content set to some deferred object' do @@ -68,7 +68,7 @@ module Actions yum_action_options = action_options.clone yum_action_options[:matching_content] = not_falsey assert_action_planned_with(action, pulp_metadata_generate_class, yum_repo, SmartProxy.pulp_primary, - yum_action_options) + **yum_action_options) end end end diff --git a/test/actions/katello/repository_test.rb b/test/actions/katello/repository_test.rb index 93609284e24..c3bfd3ae800 100644 --- a/test/actions/katello/repository_test.rb +++ b/test/actions/katello/repository_test.rb @@ -590,7 +590,7 @@ class UploadDockerTest < TestBase } assert_action_planned_with(action, ::Actions::Pulp3::Orchestration::Repository::ImportUpload, docker_repository, SmartProxy.pulp_primary, - import_upload_args + **import_upload_args ) end @@ -616,7 +616,7 @@ class UploadDockerTest < TestBase } assert_action_planned_with(action, ::Actions::Pulp3::Orchestration::Repository::ImportUpload, docker_repository, SmartProxy.pulp_primary, - import_upload_args + **import_upload_args ) end end @@ -662,8 +662,8 @@ class SyncTest < TestBase it 'plans pulp3 orchestration actions with file repo' do action = create_action pulp3_action_class action.stubs(:action_subject).with(repository_pulp3) - plan_action action, repository_pulp3, proxy, {} - assert_action_planned_with(action, ::Actions::Pulp3::Repository::Sync, repository_pulp3, proxy, {}) + plan_action action, repository_pulp3, proxy + assert_action_planned_with(action, ::Actions::Pulp3::Repository::Sync, repository_pulp3, proxy) assert_action_planed action, ::Actions::Pulp3::Repository::SaveVersion assert_action_planed action, ::Actions::Pulp3::Orchestration::Repository::GenerateMetadata end @@ -679,8 +679,8 @@ class SyncTest < TestBase it 'plans pulp3 orchestration actions with apt repo' do action = create_action pulp3_action_class action.stubs(:action_subject).with(repository_apt_pulp3) - plan_action action, repository_apt_pulp3, proxy, {} - assert_action_planned_with(action, ::Actions::Pulp3::Repository::Sync, repository_apt_pulp3, proxy, {}) + plan_action action, repository_apt_pulp3, proxy + assert_action_planned_with(action, ::Actions::Pulp3::Repository::Sync, repository_apt_pulp3, proxy) assert_action_planed action, ::Actions::Pulp3::Repository::SaveVersion assert_action_planed action, ::Actions::Pulp3::Orchestration::Repository::GenerateMetadata end diff --git a/test/actions/pulp3/content_view_version/export_repository_test.rb b/test/actions/pulp3/content_view_version/export_repository_test.rb index f46ba5372f2..bb0ca61e22a 100644 --- a/test/actions/pulp3/content_view_version/export_repository_test.rb +++ b/test/actions/pulp3/content_view_version/export_repository_test.rb @@ -28,13 +28,14 @@ class ExportRepositoryTest < ActiveSupport::TestCase action_class.any_instance.expects(:action_subject).with(repository) plan_action(action, repository) - assert_action_planned_with(action, ::Actions::Katello::ContentView::Publish) do |content_view, _| + assert_action_planned_with(action, ::Actions::Katello::ContentView::Publish) do |*args| + content_view = args.first assert_equal content_view.name, "Export-#{repository.label}-#{repository.id}" assert_equal content_view.repository_ids.sort, [repository.id] assert content_view.generated_for_repository? end - assert_action_planned_with(action, Actions::Katello::ContentViewVersion::Export) do |**options| + assert_action_planned_with(action, Actions::Katello::ContentViewVersion::Export) do |_, **options| assert_equal version, options[:content_view_version] end end diff --git a/test/actions/pulp3/orchestration/ansible_collection_sync_test.rb b/test/actions/pulp3/orchestration/ansible_collection_sync_test.rb index 449425aa5cb..0730ecc8200 100644 --- a/test/actions/pulp3/orchestration/ansible_collection_sync_test.rb +++ b/test/actions/pulp3/orchestration/ansible_collection_sync_test.rb @@ -30,7 +30,7 @@ def teardown def test_sync sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) @repo.reload refute_equal @repo.version_href, @repo_version_href repository_reference = Katello::Pulp3::RepositoryReference.find_by( @@ -42,7 +42,7 @@ def test_sync def test_sync_mirror_false sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) @repo.reload repository_reference = Katello::Pulp3::RepositoryReference.find_by( :root_repository_id => @repo.root.id, @@ -60,7 +60,7 @@ def test_sync_mirror_false @repo, @primary) - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) @repo.reload @repo.index_content post_content = ::Katello::RepositoryAnsibleCollection.where(:repository_id => @repo.id) @@ -75,7 +75,7 @@ def test_sync_mirror_false def test_sync_mirror_true sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) @repo.reload @repo.index_content pre_content = ::Katello::RepositoryAnsibleCollection.where(:repository_id => @repo.id) @@ -88,7 +88,7 @@ def test_sync_mirror_true @repo, @primary) - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) @repo.reload @repo.index_content diff --git a/test/actions/pulp3/orchestration/copy_all_units_test.rb b/test/actions/pulp3/orchestration/copy_all_units_test.rb index ab13d06caa4..46f1cbb6176 100644 --- a/test/actions/pulp3/orchestration/copy_all_units_test.rb +++ b/test/actions/pulp3/orchestration/copy_all_units_test.rb @@ -36,7 +36,7 @@ def setup def test_inclusion_docker_filters sync_args = {:smart_proxy_id => @primary.id, :repo_id => @docker_repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @docker_repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @docker_repo, @primary, **sync_args) index_args = {:id => @docker_repo.id} ForemanTasks.sync_task(::Actions::Katello::Repository::IndexContent, index_args) @docker_repo.reload @@ -67,7 +67,7 @@ def test_inclusion_docker_filters def test_exclusion_docker_filters sync_args = {:smart_proxy_id => @primary.id, :repo_id => @docker_repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @docker_repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @docker_repo, @primary, **sync_args) index_args = {:id => @docker_repo.id} ForemanTasks.sync_task(::Actions::Katello::Repository::IndexContent, index_args) @docker_repo.reload @@ -107,7 +107,7 @@ def setup create_repo(@repo_clone, @primary) sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) index_args = {:id => @repo.id} ForemanTasks.sync_task(::Actions::Katello::Repository::IndexContent, index_args) @@ -191,13 +191,13 @@ def test_copy_duplicated_errata ::Katello::Pulp3::Repository::Yum.any_instance.stubs(:generate_backend_object_name).returns(@repo.pulp_id) sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) ::Katello::Pulp3::Repository::Yum.any_instance.stubs(:generate_backend_object_name).returns(repo2.pulp_id) sync_args = {:smart_proxy_id => @primary.id, :repo_id => repo2.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, repo2, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, repo2, @primary, **sync_args) ::Katello::Pulp3::Repository::Yum.any_instance.stubs(:generate_backend_object_name).returns(repo3.pulp_id) sync_args = {:smart_proxy_id => @primary.id, :repo_id => repo3.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, repo3, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, repo3, @primary, **sync_args) index_args = {:id => @repo.id} ForemanTasks.sync_task(::Actions::Katello::Repository::IndexContent, index_args) @@ -405,7 +405,7 @@ def setup create_repo(@repo_clone, @primary) sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) index_args = {:id => @repo.id} ForemanTasks.sync_task(::Actions::Katello::Repository::IndexContent, index_args) @@ -446,7 +446,7 @@ def setup create_repo(@repo_clone, @primary) sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) index_args = {:id => @repo.id} ForemanTasks.sync_task(::Actions::Katello::Repository::IndexContent, index_args) @@ -536,7 +536,7 @@ def setup create_repo(@repo_clone, @primary) sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) index_args = {:id => @repo.id} ForemanTasks.sync_task(::Actions::Katello::Repository::IndexContent, index_args) @@ -644,7 +644,7 @@ def setup create_repo(@repo_clone, @primary) sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) index_args = {:id => @repo.id} ForemanTasks.sync_task(::Actions::Katello::Repository::IndexContent, index_args) @@ -702,7 +702,7 @@ def setup create_repo(@repo_clone, @primary) sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) index_args = {:id => @repo.id} ForemanTasks.sync_task(::Actions::Katello::Repository::IndexContent, index_args) @@ -766,7 +766,7 @@ def setup create_repo(@repo_clone, @primary) sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) index_args = {:id => @repo.id} ForemanTasks.sync_task(::Actions::Katello::Repository::IndexContent, index_args) @@ -810,7 +810,7 @@ def setup create_repo(@repo_clone, @primary) sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) index_args = {:id => @repo.id} ForemanTasks.sync_task(::Actions::Katello::Repository::IndexContent, index_args) diff --git a/test/actions/pulp3/orchestration/docker_sync_test.rb b/test/actions/pulp3/orchestration/docker_sync_test.rb index b2dd3f436f4..52c04449764 100644 --- a/test/actions/pulp3/orchestration/docker_sync_test.rb +++ b/test/actions/pulp3/orchestration/docker_sync_test.rb @@ -29,7 +29,7 @@ def teardown def test_sync sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) @repo.reload refute_equal @repo.version_href, @repo_version_href repository_reference = Katello::Pulp3::RepositoryReference.find_by( diff --git a/test/actions/pulp3/orchestration/file_remove_units_test.rb b/test/actions/pulp3/orchestration/file_remove_units_test.rb index 0a229434a03..2c0970254df 100644 --- a/test/actions/pulp3/orchestration/file_remove_units_test.rb +++ b/test/actions/pulp3/orchestration/file_remove_units_test.rb @@ -17,7 +17,7 @@ def create_and_sync_repo(repo, proxy) ::Actions::Katello::Repository::MetadataGenerate, repo) sync_args = {:smart_proxy_id => proxy.id, :repo_id => repo.id} sync_action = ForemanTasks.sync_task( - ::Actions::Pulp3::Orchestration::Repository::Sync, repo, proxy, sync_args) + ::Actions::Pulp3::Orchestration::Repository::Sync, repo, proxy, **sync_args) contents_changed = sync_action.output[:contents_changed] ForemanTasks.sync_task( ::Actions::Katello::Repository::IndexContent, diff --git a/test/actions/pulp3/orchestration/file_sync_test.rb b/test/actions/pulp3/orchestration/file_sync_test.rb index 2ffc3c48340..5e0e32d521c 100644 --- a/test/actions/pulp3/orchestration/file_sync_test.rb +++ b/test/actions/pulp3/orchestration/file_sync_test.rb @@ -29,7 +29,7 @@ def teardown def test_sync sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) @repo.reload refute_equal @repo.version_href, @repo_version_href repository_reference = Katello::Pulp3::RepositoryReference.find_by( @@ -50,7 +50,7 @@ def test_sync_with_pagination ::Setting[:bulk_load_size] = 10 sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) begin @repo.reload @@ -65,7 +65,7 @@ def test_sync_with_pagination def test_sync_with_mirror_false sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) @repo.reload @repo.index_content pre_count_content = ::Katello::RepositoryFileUnit.where(:repository_id => @repo.id).count @@ -76,7 +76,7 @@ def test_sync_with_mirror_false @repo, @primary) - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) @repo.reload @repo.index_content post_count_content = ::Katello::RepositoryFileUnit.where(:repository_id => @repo.id).count @@ -85,7 +85,7 @@ def test_sync_with_mirror_false def test_sync_with_mirror_true sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) @repo.reload @repo.index_content pre_count_content = ::Katello::RepositoryFileUnit.where(:repository_id => @repo.id).count @@ -96,7 +96,7 @@ def test_sync_with_mirror_true @repo, @primary) - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) @repo.reload @repo.index_content post_count_content = ::Katello::RepositoryFileUnit.where(:repository_id => @repo.id).count diff --git a/test/actions/pulp3/orchestration/multi_copy_all_units_test.rb b/test/actions/pulp3/orchestration/multi_copy_all_units_test.rb index 30cf588ddd5..19667ec220a 100644 --- a/test/actions/pulp3/orchestration/multi_copy_all_units_test.rb +++ b/test/actions/pulp3/orchestration/multi_copy_all_units_test.rb @@ -20,7 +20,7 @@ def setup create_repo(@repo_clone, @primary) sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) index_args = {:id => @repo.id} ForemanTasks.sync_task(::Actions::Katello::Repository::IndexContent, index_args) @@ -293,7 +293,7 @@ def setup create_repo(@repo_clone, @primary) sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) index_args = {:id => @repo.id} ForemanTasks.sync_task(::Actions::Katello::Repository::IndexContent, index_args) @@ -336,7 +336,7 @@ def setup create_repo(@repo_clone, @primary) sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) index_args = {:id => @repo.id} ForemanTasks.sync_task(::Actions::Katello::Repository::IndexContent, index_args) @@ -429,7 +429,7 @@ def setup create_repo(@repo_clone, @primary) sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) index_args = {:id => @repo.id} ForemanTasks.sync_task(::Actions::Katello::Repository::IndexContent, index_args) @@ -517,7 +517,7 @@ def setup create_repo(@repo_clone, @primary) sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) index_args = {:id => @repo.id} ForemanTasks.sync_task(::Actions::Katello::Repository::IndexContent, index_args) @@ -605,7 +605,7 @@ def setup create_repo(@repo_clone, @primary) sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) index_args = {:id => @repo.id} ForemanTasks.sync_task(::Actions::Katello::Repository::IndexContent, index_args) @@ -671,7 +671,7 @@ def setup create_repo(@repo_clone, @primary) sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) index_args = {:id => @repo.id} ForemanTasks.sync_task(::Actions::Katello::Repository::IndexContent, index_args) @@ -717,7 +717,7 @@ def setup create_repo(@repo_clone, @primary) sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) index_args = {:id => @repo.id} ForemanTasks.sync_task(::Actions::Katello::Repository::IndexContent, index_args) diff --git a/test/actions/pulp3/orchestration/remove_orphans_test.rb b/test/actions/pulp3/orchestration/remove_orphans_test.rb index 8bdcc51b577..e282ed098d1 100644 --- a/test/actions/pulp3/orchestration/remove_orphans_test.rb +++ b/test/actions/pulp3/orchestration/remove_orphans_test.rb @@ -14,7 +14,7 @@ def sync_and_reload_repo(repo, smart_proxy) sync_args = {:smart_proxy_id => smart_proxy.id, :repo_id => repo.id} ForemanTasks.sync_task( ::Actions::Pulp3::Orchestration::Repository::Sync, - repo, smart_proxy, sync_args) + repo, smart_proxy, **sync_args) end def repo_reference(repo) diff --git a/test/actions/pulp3/orchestration/rpm_remove_units_test.rb b/test/actions/pulp3/orchestration/rpm_remove_units_test.rb index 1ee1e867e71..f133e1f59e3 100644 --- a/test/actions/pulp3/orchestration/rpm_remove_units_test.rb +++ b/test/actions/pulp3/orchestration/rpm_remove_units_test.rb @@ -23,7 +23,7 @@ def create_and_sync_repo(repo, proxy) sync_args = { :smart_proxy_id => proxy.id, :repo_id => repo.id, :full_index => true } sync_action = ForemanTasks.sync_task( - ::Actions::Pulp3::Orchestration::Repository::Sync, repo, proxy, sync_args) + ::Actions::Pulp3::Orchestration::Repository::Sync, repo, proxy, **sync_args) contents_changed = sync_action.output[:contents_changed] ForemanTasks.sync_task( diff --git a/test/actions/pulp3/orchestration/yum_sync_test.rb b/test/actions/pulp3/orchestration/yum_sync_test.rb index 3d3260ef2ad..382a6294a57 100644 --- a/test/actions/pulp3/orchestration/yum_sync_test.rb +++ b/test/actions/pulp3/orchestration/yum_sync_test.rb @@ -33,7 +33,7 @@ def teardown def test_sync sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} @repo.update(publication_href: nil, version_href: nil) #validate that sync populates these - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) @repo.reload refute_equal @repo.version_href, @repo_version_href repository_reference = Katello::Pulp3::RepositoryReference.find_by( @@ -49,7 +49,7 @@ def test_sync_mirror_false sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} @repo.root.update(mirroring_policy: ::Katello::RootRepository::MIRRORING_POLICY_ADDITIVE) @repo.update(publication_href: nil, version_href: nil) #validate that sync populates these - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) @repo.reload refute_equal @repo.version_href, @repo_version_href repository_reference = Katello::Pulp3::RepositoryReference.find_by( @@ -64,7 +64,7 @@ def test_sync_mirror_false def test_optimize_false SETTINGS[:katello][:katello_applicability] = true sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) @repo.reload old_url = @repo.version_href @@ -88,7 +88,7 @@ def test_optimize_false def test_index_erratum_href sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) @repo.reload @repo.index_content @repo.reload @@ -100,7 +100,7 @@ def test_index_erratum_href def test_reindex_outdated_erratum sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) @repo.reload @repo.index_content @repo.reload @@ -118,7 +118,7 @@ def test_incompatible_mirror_repo_error @repo.reload sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} assert_raises ForemanTasks::TaskError do - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) end end @@ -140,7 +140,7 @@ def test_sync_with_acs ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::AlternateContentSource::Refresh, smart_proxy_acs) sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) @repo.reload repository_reference = Katello::Pulp3::RepositoryReference.find_by( :root_repository_id => @repo.root.id, diff --git a/test/controllers/api/v2/api_controller_test.rb b/test/controllers/api/v2/api_controller_test.rb index ba60a39bb98..41ee6a3e5f6 100644 --- a/test/controllers/api/v2/api_controller_test.rb +++ b/test/controllers/api/v2/api_controller_test.rb @@ -73,8 +73,8 @@ def test_with_reduced_perms User.current = users(:restricted) key = katello_activation_keys(:simple_key) - setup_current_user_with_permissions(:name => "view_activation_keys", - :search => "environment = #{key.environment}") + setup_current_user_with_permissions({ :name => "view_activation_keys", + :search => "environment = #{key.environment}" }) @options = { :resource_class => Katello::ActivationKey } keys = @controller.scoped_search(ActivationKey.readable, @default_sort[0], @default_sort[1], @options) diff --git a/test/katello_test_helper.rb b/test/katello_test_helper.rb index 349e9235ab3..9ca57475aa6 100644 --- a/test/katello_test_helper.rb +++ b/test/katello_test_helper.rb @@ -172,8 +172,8 @@ def assert_response(type, message = nil) module DynflowFullTreePlanning IGNORED_INPUT = [:remote_user, :remote_cp_user].freeze - def plan_action_tree(action_class, *args) - Rails.application.dynflow.world.plan(action_class, *args) + def plan_action_tree(action_class, *args, **kwargs) + Rails.application.dynflow.world.plan(action_class, *args, **kwargs) end def assert_tree_planned_steps(execution_plan, action_class) diff --git a/test/models/authorization/activation_key_authorization_test.rb b/test/models/authorization/activation_key_authorization_test.rb index 077fa362b54..03fd3f33f12 100644 --- a/test/models/authorization/activation_key_authorization_test.rb +++ b/test/models/authorization/activation_key_authorization_test.rb @@ -83,8 +83,8 @@ def test_all_editable? clause = keys.map { |key| "name=\"#{key.name}\"" }.join(" or ") - setup_current_user_with_permissions(:name => "edit_activation_keys", - :search => clause) + setup_current_user_with_permissions({ :name => "edit_activation_keys", + :search => clause }) assert ActivationKey.all_editable?(ak.content_view, ak.environment) end end diff --git a/test/models/authorization/lifecycle_environment_authorization_test.rb b/test/models/authorization/lifecycle_environment_authorization_test.rb index 53fe99434e9..7b345cbe7e8 100644 --- a/test/models/authorization/lifecycle_environment_authorization_test.rb +++ b/test/models/authorization/lifecycle_environment_authorization_test.rb @@ -75,8 +75,8 @@ def setup def test_readables environment = katello_environments(:staging_path1) - setup_current_user_with_permissions(:name => "view_lifecycle_environments", - :search => "name=\"#{environment.name}\"") + setup_current_user_with_permissions({ :name => "view_lifecycle_environments", + :search => "name=\"#{environment.name}\"" }) assert_equal([environment.id], KTEnvironment.readable.pluck(:id)) assert environment.readable? refute environment.prior.readable? @@ -84,8 +84,8 @@ def test_readables def test_promotables environment = katello_environments(:staging_path1) - setup_current_user_with_permissions(:name => "promote_or_remove_content_views_to_environments", - :search => "name=\"#{environment.name}\"") + setup_current_user_with_permissions({ :name => "promote_or_remove_content_views_to_environments", + :search => "name=\"#{environment.name}\"" }) assert_equal([environment.id], KTEnvironment.promotable.pluck(:id)) assert environment.promotable_or_removable? refute environment.prior.promotable_or_removable? diff --git a/test/models/authorization/organization_authorization_test.rb b/test/models/authorization/organization_authorization_test.rb index 1d1eb815f9d..386a075f19a 100644 --- a/test/models/authorization/organization_authorization_test.rb +++ b/test/models/authorization/organization_authorization_test.rb @@ -42,8 +42,8 @@ def test_read_promotion_paths def test_read_promotion_paths_one environment = katello_environments(:staging_path1) - setup_current_user_with_permissions(:name => "view_lifecycle_environments", - :search => "name=\"#{environment.name}\"") + setup_current_user_with_permissions({ :name => "view_lifecycle_environments", + :search => "name=\"#{environment.name}\"" }) refute_equal(@org.promotion_paths, @org.readable_promotion_paths) assert_equal(1, @org.readable_promotion_paths.size) @@ -51,8 +51,8 @@ def test_read_promotion_paths_one def test_promotable_promotion_paths_one environment = katello_environments(:staging_path1) - setup_current_user_with_permissions(:name => "promote_or_remove_content_views_to_environments", - :search => "name=\"#{environment.name}\"") + setup_current_user_with_permissions({ :name => "promote_or_remove_content_views_to_environments", + :search => "name=\"#{environment.name}\"" }) refute_equal(@org.promotion_paths, @org.promotable_promotion_paths) assert_equal(1, @org.promotable_promotion_paths.size) diff --git a/test/models/authorization/product_authorization_test.rb b/test/models/authorization/product_authorization_test.rb index 24419cc3156..c47c92c4129 100644 --- a/test/models/authorization/product_authorization_test.rb +++ b/test/models/authorization/product_authorization_test.rb @@ -101,8 +101,8 @@ def test_readable_repositories_with_ids def test_readable_repositories_with_search repo = @fedora_17_x86_64 - setup_current_user_with_permissions(:name => "view_products", - :search => "name=\"#{repo.product.name}\"") + setup_current_user_with_permissions({ :name => "view_products", + :search => "name=\"#{repo.product.name}\"" }) assert_equal([repo], Product.readable_repositories([repo.id])) assert_empty(Product.readable_repositories( diff --git a/test/models/authorization/repository_authorization_test.rb b/test/models/authorization/repository_authorization_test.rb index 4d0ab927af2..16411045eb8 100644 --- a/test/models/authorization/repository_authorization_test.rb +++ b/test/models/authorization/repository_authorization_test.rb @@ -100,25 +100,25 @@ def test_readable def test_readable_with_product refute_includes Repository.readable, @fedora_17_x86_64 - setup_current_user_with_permissions(:name => "view_products", :search => nil) + setup_current_user_with_permissions({ :name => "view_products", :search => nil }) assert_includes Repository.readable, @fedora_17_x86_64 end def test_readable_with_content_view refute_includes Repository.readable, @fedora_17_x86_64 - setup_current_user_with_permissions(:name => "view_content_views", :search => nil) + setup_current_user_with_permissions({ :name => "view_content_views", :search => nil }) assert_includes Repository.readable, @fedora_17_x86_64 end def test_readable_with_versions refute_includes Repository.readable, @fedora_17_x86_64_dev - setup_current_user_with_permissions(:name => "view_content_views", :search => "name = \"#{@fedora_17_x86_64_dev.content_view_version.content_view.name}\"") + setup_current_user_with_permissions({ :name => "view_content_views", :search => "name = \"#{@fedora_17_x86_64_dev.content_view_version.content_view.name}\"" }) assert_includes Repository.readable, @fedora_17_x86_64_dev end def test_readable_with_environment refute_includes Repository.readable, @fedora_17_x86_64 - setup_current_user_with_permissions(:name => "view_lifecycle_environments", :search => "name = \"#{@fedora_17_x86_64.environment.name}\"") + setup_current_user_with_permissions({ :name => "view_lifecycle_environments", :search => "name = \"#{@fedora_17_x86_64.environment.name}\"" }) repos = Repository.readable refute_empty repos assert repos.all? { |repo| repo.environment_id == @fedora_17_x86_64.environment_id } diff --git a/test/models/content_view_package_group_filter_test.rb b/test/models/content_view_package_group_filter_test.rb index e70e5c31d73..cfbf93c7cd5 100644 --- a/test/models/content_view_package_group_filter_test.rb +++ b/test/models/content_view_package_group_filter_test.rb @@ -26,7 +26,7 @@ def test_content_unit_pulp_ids_returns_pulp_hrefs repository_creation: true) @repo.reload sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) @repo.reload @repo.index_content Katello::PackageGroup.import_for_repository(@repo) diff --git a/test/models/katello/ostree_test.rb b/test/models/katello/ostree_test.rb index 22ee451fbbc..723e6de3eea 100644 --- a/test/models/katello/ostree_test.rb +++ b/test/models/katello/ostree_test.rb @@ -28,7 +28,7 @@ def test_index_on_sync skip "TODO: Until the ostree support is present in pulp packaging" Katello::GenericContentUnit.destroy_all sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) index_args = {:id => @repo.id, :contents_changed => true} ForemanTasks.sync_task(::Actions::Katello::Repository::IndexContent, index_args) @repo.reload diff --git a/test/services/katello/pulp3/deb_test.rb b/test/services/katello/pulp3/deb_test.rb index 4ed9c47fbc1..18f0a49ccd2 100644 --- a/test/services/katello/pulp3/deb_test.rb +++ b/test/services/katello/pulp3/deb_test.rb @@ -18,7 +18,7 @@ def setup def test_index_model Katello::Deb.destroy_all sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) @repo.reload @repo.index_content post_unit_count = Katello::Deb.all.count @@ -31,7 +31,7 @@ def test_index_model def test_index_on_sync Katello::Deb.destroy_all sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) index_args = {:id => @repo.id, :contents_changed => true} ForemanTasks.sync_task(::Actions::Katello::Repository::IndexContent, index_args) @repo.reload diff --git a/test/services/katello/pulp3/docker_tag_test.rb b/test/services/katello/pulp3/docker_tag_test.rb index 78c46f74e1d..8e3c3eeafac 100644 --- a/test/services/katello/pulp3/docker_tag_test.rb +++ b/test/services/katello/pulp3/docker_tag_test.rb @@ -18,7 +18,7 @@ def setup def test_index_model Katello::DockerTag.destroy_all sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) @repo.reload @repo.index_content assert_equal @repo, ::Katello::Repository.find_by(:id => ::Katello::RepositoryDockerTag.first.repository_id) @@ -35,7 +35,7 @@ def test_copy_units_rewrites_missing_content_error def test_index_on_sync Katello::DockerTag.destroy_all sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) index_args = {:id => @repo.id, :contents_changed => true} ForemanTasks.sync_task(::Actions::Katello::Repository::IndexContent, index_args) @repo.reload @@ -50,7 +50,7 @@ def test_index_with_oci_tagged_manifest @repo.root.update(url: 'https://quay.io', docker_upstream_name: 'ansible/ansible-runner') Katello::DockerTag.destroy_all sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) index_args = {:id => @repo.id, :contents_changed => true} # Test that indexing works @@ -61,7 +61,7 @@ def test_resync_limit_tags_deletes_proper_repo_association_meta_tags # https://projects.theforeman.org/issues/34257 Katello::DockerTag.destroy_all sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) index_args = {:id => @repo.id, :contents_changed => true} ForemanTasks.sync_task(::Actions::Katello::Repository::IndexContent, index_args) @repo.reload @@ -75,7 +75,7 @@ def test_resync_limit_tags_deletes_proper_repo_association_meta_tags @repo.root.update(:include_tags => ['doesntexist']) @repo.backend_service(SmartProxy.pulp_primary).refresh_if_needed sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) index_args = {:id => @repo.id, :contents_changed => true} ForemanTasks.sync_task(::Actions::Katello::Repository::IndexContent, index_args) @repo.reload diff --git a/test/services/katello/pulp3/erratum_test.rb b/test/services/katello/pulp3/erratum_test.rb index ccc13698c61..908e0cfbde4 100644 --- a/test/services/katello/pulp3/erratum_test.rb +++ b/test/services/katello/pulp3/erratum_test.rb @@ -27,7 +27,7 @@ def teardown def test_index_model Katello::Erratum.destroy_all sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) @repo.reload @repo.index_content post_unit_count = Katello::Erratum.all.count @@ -40,7 +40,7 @@ def test_index_model def test_index_on_sync Katello::Erratum.destroy_all sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) index_args = {:id => @repo.id, :contents_changed => true} ForemanTasks.sync_task(::Actions::Katello::Repository::IndexContent, index_args) @repo.reload diff --git a/test/services/katello/pulp3/file_unit_test.rb b/test/services/katello/pulp3/file_unit_test.rb index 054675d42d8..16ce5f539f1 100644 --- a/test/services/katello/pulp3/file_unit_test.rb +++ b/test/services/katello/pulp3/file_unit_test.rb @@ -19,7 +19,7 @@ def setup def test_index_model Katello::FileUnit.destroy_all sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) @repo.reload @repo.index_content post_unit_count = Katello::FileUnit.all.count @@ -32,7 +32,7 @@ def test_index_model def test_index_on_sync Katello::FileUnit.destroy_all sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) index_args = {:id => @repo.id, :contents_changed => true} ForemanTasks.sync_task(::Actions::Katello::Repository::IndexContent, index_args) @repo.reload diff --git a/test/services/katello/pulp3/orphan_test.rb b/test/services/katello/pulp3/orphan_test.rb index 7bb177c8560..f52664080c7 100644 --- a/test/services/katello/pulp3/orphan_test.rb +++ b/test/services/katello/pulp3/orphan_test.rb @@ -17,7 +17,7 @@ def sync_and_reload_repo(repo, smart_proxy) sync_args = {:smart_proxy_id => smart_proxy.id, :repo_id => repo.id} ForemanTasks.sync_task( ::Actions::Pulp3::Orchestration::Repository::Sync, - repo, smart_proxy, sync_args) + repo, smart_proxy, **sync_args) end def assert_version(repo, version) diff --git a/test/services/katello/pulp3/package_group_test.rb b/test/services/katello/pulp3/package_group_test.rb index 88834a8fa12..f3709b9344a 100644 --- a/test/services/katello/pulp3/package_group_test.rb +++ b/test/services/katello/pulp3/package_group_test.rb @@ -21,7 +21,7 @@ def setup repository_creation: true) @repo.reload sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) @repo.reload Katello::PackageGroup.import_for_repository(@repo) @repo.reload diff --git a/test/services/katello/pulp3/repository/python/python_test.rb b/test/services/katello/pulp3/repository/python/python_test.rb index 5fd8760cdd4..ff2717963d2 100644 --- a/test/services/katello/pulp3/repository/python/python_test.rb +++ b/test/services/katello/pulp3/repository/python/python_test.rb @@ -43,7 +43,7 @@ def test_delete def test_index_on_sync Katello::GenericContentUnit.destroy_all sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) index_args = {:id => @repo.id, :contents_changed => true} ForemanTasks.sync_task(::Actions::Katello::Repository::IndexContent, index_args) @repo.reload diff --git a/test/services/katello/pulp3/repository_list_test.rb b/test/services/katello/pulp3/repository_list_test.rb index 5c43c3ce900..68ebebf63da 100644 --- a/test/services/katello/pulp3/repository_list_test.rb +++ b/test/services/katello/pulp3/repository_list_test.rb @@ -16,7 +16,7 @@ def sync_and_reload_repo(repo, smart_proxy) sync_args = {:smart_proxy_id => smart_proxy.id, :repo_id => repo.id} ForemanTasks.sync_task( ::Actions::Pulp3::Orchestration::Repository::Sync, - repo, smart_proxy, sync_args) + repo, smart_proxy, **sync_args) end def test_list_with_pagination diff --git a/test/services/katello/pulp3/rpm_test.rb b/test/services/katello/pulp3/rpm_test.rb index 7b781c66a40..6160605b8ff 100644 --- a/test/services/katello/pulp3/rpm_test.rb +++ b/test/services/katello/pulp3/rpm_test.rb @@ -20,7 +20,7 @@ def setup def test_index_model Katello::Rpm.destroy_all sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) @repo.reload @repo.index_content post_unit_count = Katello::Rpm.all.count @@ -35,7 +35,7 @@ def test_index_model def test_index_on_sync Katello::Rpm.destroy_all sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) index_args = {:id => @repo.id, :contents_changed => true} ForemanTasks.sync_task(::Actions::Katello::Repository::IndexContent, index_args) @repo.reload diff --git a/test/services/katello/pulp3/srpm_test.rb b/test/services/katello/pulp3/srpm_test.rb index e30fc64bd9a..55bb264677b 100644 --- a/test/services/katello/pulp3/srpm_test.rb +++ b/test/services/katello/pulp3/srpm_test.rb @@ -31,7 +31,7 @@ class SrpmVcrTest < SrpmTestBase def setup super sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) @repo.reload Katello::Srpm.import_for_repository(@repo) @repo.reload @@ -55,7 +55,7 @@ class SrpmVcrInitialSyncTest < SrpmTestBase def test_sync_skipped_srpm sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} @repo.root.update!(ignorable_content: ["srpm"]) - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) @repo.reload Katello::Srpm.import_for_repository(@repo) @repo.reload @@ -66,7 +66,7 @@ def test_sync_skipped_srpm def test_sync_skipped_treeinfo sync_args = {:smart_proxy_id => @primary.id, :repo_id => @repo.id} @repo.root.update!(ignorable_content: ["treeinfo"]) - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, @repo, @primary, **sync_args) end end diff --git a/test/services/katello/registration_manager_test.rb b/test/services/katello/registration_manager_test.rb index ab71df39461..32564df0db7 100644 --- a/test/services/katello/registration_manager_test.rb +++ b/test/services/katello/registration_manager_test.rb @@ -42,14 +42,14 @@ def setup def test_different_org org2 = taxonomies(:organization2) - error = assert_raises(Katello::Errors::RegistrationError) { @klass.validate_hosts(hosts, org2, nil, host_uuid_overridden: nil) } + error = assert_raises(Katello::Errors::RegistrationError) { @klass.validate_hosts(hosts, org2, nil, nil) } assert_match(/different org/, error.message) end def test_multiple_hosts assert ::Host.all.size > 1 - error = assert_raises(Katello::Errors::RegistrationError) { @klass.validate_hosts(::Host.all, @org, nil, host_uuid_overridden: nil) } + error = assert_raises(Katello::Errors::RegistrationError) { @klass.validate_hosts(::Host.all, @org, nil, nil) } assert_match(/matches other registered/, error.message) end @@ -57,7 +57,7 @@ def test_new_host_existing_uuid existing_uuid = 'existing_system_uuid' @host.subscription_facet.update(dmi_uuid: existing_uuid) - error = assert_raises(Katello::Errors::RegistrationError) { @klass.validate_hosts(hosts, @org, 'new_host_name', host_uuid_overridden: existing_uuid) } + error = assert_raises(Katello::Errors::RegistrationError) { @klass.validate_hosts(hosts, @org, 'new_host_name', existing_uuid) } assert_match(/matches other registered/, error.message) end @@ -65,7 +65,7 @@ def test_existing_host_mismatch_uuid @host.subscription_facet.update(dmi_uuid: 'existing_system_uuid') Setting[:host_profile_assume] = false - error = assert_raises(Katello::Errors::RegistrationError) { @klass.validate_hosts(hosts, @org, @host.name, host_uuid_overridden: 'different-uuid') } + error = assert_raises(Katello::Errors::RegistrationError) { @klass.validate_hosts(hosts, @org, @host.name, 'different-uuid') } assert_match(/DMI UUID that differs/, error.message) # if a registering client is matched by hostname to an existing profile @@ -80,7 +80,7 @@ def test_host_profile_assume_build_mode_only_not_in_build Setting[:host_profile_assume] = false Setting[:host_profile_assume_build_can_change] = true refute @host.build - error = assert_raises(Katello::Errors::RegistrationError) { @klass.validate_hosts(hosts, @org, @host.name, host_uuid_overridden: 'different-uuid') } + error = assert_raises(Katello::Errors::RegistrationError) { @klass.validate_hosts(hosts, @org, @host.name, 'different-uuid') } assert_match(/DMI UUID that differs/, error.message) end @@ -92,7 +92,7 @@ def test_host_profile_assume_build_mode_only_in_build # if a registering client is matched by hostname to an existing profile # but its UUID has changed *and* is still unique, also it is in build mode # then allow the registration when enabled - assert @klass.validate_hosts(hosts, @org, @host.name, host_uuid_overridden: 'different-uuid') + assert @klass.validate_hosts(hosts, @org, @host.name, 'different-uuid') end def test_re_register_build_mode @@ -101,11 +101,11 @@ def test_re_register_build_mode refute @host.build Setting[:host_re_register_build_only] = true - error = assert_raises(Katello::Errors::RegistrationError) { @klass.validate_hosts(hosts, @org, @host.name, host_uuid_overridden: nil) } + error = assert_raises(Katello::Errors::RegistrationError) { @klass.validate_hosts(hosts, @org, @host.name, nil) } assert_match(/currently registered/, error.message) @host.update(build: true) - assert @klass.validate_hosts(hosts, @org, @host.name, host_uuid_overridden: 'existing_system_uuid') + assert @klass.validate_hosts(hosts, @org, @host.name, 'existing_system_uuid') end def test_existing_uuid_and_name @@ -118,7 +118,7 @@ def test_build_matching_hostname_new_uuid @host = FactoryBot.create(:host, :with_subscription, :managed, organization: @org, build: true) @host.subscription_facet.update(dmi_uuid: SecureRandom.uuid) - assert @klass.validate_hosts(hosts, @org, @host.name, host_uuid_overridden: 'different-uuid') + assert @klass.validate_hosts(hosts, @org, @host.name, 'different-uuid') end def test_existing_host_null_uuid @@ -126,7 +126,7 @@ def test_existing_host_null_uuid # and *then* registers to it with subscription-manager assert_empty @host.fact_values - assert @klass.validate_hosts(hosts, @org, @host.name, host_uuid_overridden: 'different-uuid') + assert @klass.validate_hosts(hosts, @org, @host.name, 'different-uuid') end end diff --git a/test/support/controller_support.rb b/test/support/controller_support.rb index 7cb205921d4..dea1a1f1d30 100644 --- a/test/support/controller_support.rb +++ b/test/support/controller_support.rb @@ -67,11 +67,11 @@ def assert_protected_object(action_name, allowed_perms, denied_perms = [], def assert_authorized(params) check_params = params.merge(authorized: true) - check_permission(check_params) + check_permission(**check_params) end def refute_authorized(params) check_params = params.merge(authorized: false) - check_permission(check_params) + check_permission(**check_params) end end diff --git a/test/support/pulp3_support.rb b/test/support/pulp3_support.rb index 9b0e057bbb2..a67b7fc1673 100644 --- a/test/support/pulp3_support.rb +++ b/test/support/pulp3_support.rb @@ -90,7 +90,7 @@ def create_and_sync(repo, smart_proxy) refute_empty repository_reference.repository_href refute_empty Katello::Pulp3::DistributionReference.where(repository_id: repo.id) sync_args = {:smart_proxy_id => smart_proxy.id, :repo_id => repo.id} - ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, repo, smart_proxy, sync_args) + ForemanTasks.sync_task(::Actions::Pulp3::Orchestration::Repository::Sync, repo, smart_proxy, **sync_args) repo end end