Class: ForemanAnsibleDirector::Actions::ConsistencyCheck::Check::GitRemotes
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
32
33
|
# File 'app/lib/foreman_ansible_director/actions/consistency_check/check/git_remotes.rb', line 15
def plan(*_args)
all_referenced_git_remote_hrefs = Set.new
all_referenced_git_remote_hrefs.merge(
::ForemanAnsibleDirector::ContentUnitVersion.unscoped.where(
source_type: 'git'
).all.pluck(:pulp_remote_href)
)
all_referenced_git_remote_hrefs.merge(
::ForemanAnsibleDirector::ContentUnitRevision.unscoped.all.pluck(:pulp_remote_href)
)
git_remote_list_action = plan_action(
::ForemanAnsibleDirector::Actions::Pulp3::Ansible::Remote::Git::ListAll
)
plan_self(
all_referenced_git_remote_hrefs: all_referenced_git_remote_hrefs.to_a,
git_remote_list_action: git_remote_list_action.output
)
end
|
#run ⇒ Object
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'app/lib/foreman_ansible_director/actions/consistency_check/check/git_remotes.rb', line 35
def run
all_referenced_git_remote_hrefs = Set.new(input[:all_referenced_git_remote_hrefs])
all_pulp_git_remote_hrefs = input[:git_remote_list_action][:git_remote_list_response]
unreferenced_git_remote_hrefs = []
all_pulp_git_remote_hrefs.each do |git_remote|
pulp_href = git_remote[:pulp_href]
unreferenced_git_remote_hrefs << pulp_href unless all_referenced_git_remote_hrefs.include?(pulp_href)
end
output.update(unreferenced_git_remote_hrefs: unreferenced_git_remote_hrefs)
end
|