Class: ForemanAnsibleDirector::Actions::ConsistencyCheck::Check::CollectionRemotes
Instance Method Summary
collapse
#humanized_name, #queue, #task_output
Instance Method Details
#plan(*_args) ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'app/lib/foreman_ansible_director/actions/consistency_check/check/collection_remotes.rb', line 15
def plan(*_args)
all_referenced_collection_remote_hrefs = Set.new
all_referenced_collection_remote_hrefs.merge(
::ForemanAnsibleDirector::ContentUnitVersion.unscoped.where(
versionable_type: 'ForemanAnsibleDirector::AnsibleCollection',
source_type: 'galaxy'
).all.pluck(:pulp_remote_href)
)
collection_remote_list_action = plan_action(
::ForemanAnsibleDirector::Actions::Pulp3::Ansible::Remote::Collection::ListAll
)
plan_self(
all_referenced_collection_remote_hrefs: all_referenced_collection_remote_hrefs.to_a,
collection_remote_list_action: collection_remote_list_action.output
)
end
|
#run ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'app/lib/foreman_ansible_director/actions/consistency_check/check/collection_remotes.rb', line 33
def run
all_referenced_collection_remote_hrefs = Set.new(input[:all_referenced_collection_remote_hrefs])
all_pulp_collection_remote_hrefs = input[:collection_remote_list_action][:collection_remote_list_response]
unreferenced_collection_remote_hrefs = []
all_pulp_collection_remote_hrefs.each do |collection_remote|
pulp_href = collection_remote[:pulp_href]
unless all_referenced_collection_remote_hrefs.include?(pulp_href)
unreferenced_collection_remote_hrefs << pulp_href
end
end
output.update(unreferenced_collection_remote_hrefs: unreferenced_collection_remote_hrefs)
end
|