app/lib/actions/pulp/repository/refresh.rb in katello-3.1.0.1 vs app/lib/actions/pulp/repository/refresh.rb in katello-3.2.0.rc1

- old
+ new

@@ -37,11 +37,12 @@ end def update_or_associate_distributors(capsule_id, repository, repository_details) concurrence do existing_distributors = repository_details["distributors"] - repository.generate_distributors(capsule_id.present?).each do |distributor| + capsule = capsule_id ? SmartProxy.find(capsule_id) : nil + repository.generate_distributors(capsule).each do |distributor| found = existing_distributors.find { |i| i['distributor_type_id'] == distributor.type_id } if found plan_action(::Actions::Pulp::Repository::RefreshDistributor, :repo_id => repository.pulp_id, :id => found['id'], @@ -62,10 +63,11 @@ end def remove_unnecessary_distributors(capsule_id, repository, repository_details) concurrence do existing_distributors = repository_details["distributors"] - generated_distributors = repository.generate_distributors(capsule_id.present?) + capsule = capsule_id ? SmartProxy.find(capsule_id) : nil + generated_distributors = repository.generate_distributors(capsule) existing_distributors.each do |distributor| found = generated_distributors.find { |dist| dist.type_id == distributor['distributor_type_id'] } unless found plan_action(Pulp::Repository::DeleteDistributor, :repo_id => repository.pulp_id, :distributor_id => distributor['id'],