Revision a77acc4a
Added by Thomas McKay about 9 years ago
lib/hammer_cli_csv/puppet_reports.rb | ||
---|---|---|
59 | 59 |
@api.resource(:organizations).call(:index, {:per_page => 999999})['results'].each do |organization| |
60 | 60 |
@api.resource(:systems).call(:index, { |
61 | 61 |
'per_page' => 999999, |
62 |
'organization_id' => organization['label']
|
|
62 |
'organization_id' => organization['id']
|
|
63 | 63 |
})['results'].each do |system| |
64 | 64 |
system = @api.resource(:systems).call(:show, { |
65 | 65 |
'id' => system['uuid'], |
... | ... | |
71 | 71 |
organization_label = organization['label'] |
72 | 72 |
environment = system['environment']['label'] |
73 | 73 |
contentview = system['content_view']['name'] |
74 |
systemgroups = CSV.generate do |column|
|
|
75 |
column << system['systemGroups'].collect do |systemgroup|
|
|
76 |
systemgroup['name']
|
|
74 |
hostcollections = CSV.generate do |column|
|
|
75 |
column << system['systemGroups'].collect do |hostcollection|
|
|
76 |
hostcollection['name']
|
|
77 | 77 |
end |
78 | 78 |
end.delete!("\n") |
79 | 79 |
virtual = system['facts']['virt.is_guest'] == 'true' ? 'Yes' : 'No' |
... | ... | |
97 | 97 |
"#{subscription['product_id']}|#{subscription['product_name']}" |
98 | 98 |
end |
99 | 99 |
end.delete!("\n") |
100 |
csv << [name, count, organization_label, environment, contentview, systemgroups, virtual, host,
|
|
100 |
csv << [name, count, organization_label, environment, contentview, hostcollections, virtual, host,
|
|
101 | 101 |
operatingsystem, architecture, sockets, ram, cores, sla, products, subscriptions] |
102 | 102 |
end |
103 | 103 |
end |
... | ... | |
169 | 169 |
@host_guests[@existing[line[ORGANIZATION]][line[HOST]]] << system_id |
170 | 170 |
end |
171 | 171 |
|
172 |
set_system_groups(system_id, line)
|
|
172 |
set_host_collections(system_id, line)
|
|
173 | 173 |
|
174 | 174 |
puts 'done' if option_verbose? |
175 | 175 |
end |
... | ... | |
194 | 194 |
facts |
195 | 195 |
end |
196 | 196 |
|
197 |
def set_system_groups(system_id, line)
|
|
198 |
CSV.parse_line(line[SYSTEMGROUPS]).each do |systemgroup_name|
|
|
199 |
@api.resource(:systemgroups).call(:add_systems, {
|
|
200 |
'id' => katello_systemgroup(line[ORGANIZATION], :name => systemgroup_name),
|
|
197 |
def set_host_collections(system_id, line)
|
|
198 |
CSV.parse_line(line[SYSTEMGROUPS]).each do |hostcollection_name|
|
|
199 |
@api.resource(:hostcollections).call(:add_systems, {
|
|
200 |
'id' => katello_hostcollection(line[ORGANIZATION], :name => hostcollection_name),
|
|
201 | 201 |
'system_ids' => [system_id] |
202 | 202 |
}) |
203 | 203 |
end |
Also available in: Unified diff
a lot of fixes and updates across many resources to match katello updates