Revision bf81b9cf
Added by Thomas McKay over 8 years ago
lib/hammer_cli_csv/systems.rb | ||
---|---|---|
140 | 140 |
if !@existing[line[ORGANIZATION]].include? name |
141 | 141 |
print "Creating system '#{name}'..." if option_verbose? |
142 | 142 |
system_id = @api.resource(:systems).call(:create, { |
143 |
'name' => name, |
|
144 |
'organization_id' => katello_organization(:name => line[ORGANIZATION]), |
|
145 |
'environment_id' => katello_environment(line[ORGANIZATION], :name => line[ENVIRONMENT]), |
|
146 |
'content_view_id' => katello_contentview(line[ORGANIZATION], :name => line[CONTENTVIEW]), |
|
147 |
'facts' => facts(line), |
|
148 |
'installed_products' => products(line), |
|
149 |
'type' => 'system' |
|
150 |
})['uuid'] |
|
143 |
'name' => name,
|
|
144 |
'organization_id' => katello_organization(:name => line[ORGANIZATION]),
|
|
145 |
'environment_id' => katello_environment(line[ORGANIZATION], :name => line[ENVIRONMENT]),
|
|
146 |
'content_view_id' => katello_contentview(line[ORGANIZATION], :name => line[CONTENTVIEW]),
|
|
147 |
'facts' => facts(line),
|
|
148 |
'installed_products' => products(line),
|
|
149 |
'type' => 'system'
|
|
150 |
})['uuid']
|
|
151 | 151 |
@existing[line[ORGANIZATION]][name] = system_id |
152 | 152 |
else |
153 | 153 |
print "Updating system '#{name}'..." if option_verbose? |
154 | 154 |
system_id = @api.resource(:systems).call(:update, { |
155 |
'id' => @existing[line[ORGANIZATION]][name], |
|
156 |
'name' => name, |
|
157 |
'environment_id' => katello_environment(line[ORGANIZATION], :name => line[ENVIRONMENT]), |
|
158 |
'content_view_id' => katello_contentview(line[ORGANIZATION], :name => line[CONTENTVIEW]), |
|
159 |
'facts' => facts(line), |
|
160 |
'installed_products' => products(line) |
|
161 |
})['uuid'] |
|
155 |
'id' => @existing[line[ORGANIZATION]][name], |
|
156 |
'system' => { |
|
157 |
'name' => name, |
|
158 |
'environment_id' => katello_environment(line[ORGANIZATION], :name => line[ENVIRONMENT]), |
|
159 |
'content_view_id' => katello_contentview(line[ORGANIZATION], :name => line[CONTENTVIEW]), |
|
160 |
'facts' => facts(line), |
|
161 |
'installed_products' => products(line) |
|
162 |
} |
|
163 |
})['uuid'] |
|
162 | 164 |
end |
163 | 165 |
|
164 | 166 |
if line[VIRTUAL] == 'Yes' && line[HOST] |
... | ... | |
194 | 196 |
|
195 | 197 |
def set_system_groups(system_id, line) |
196 | 198 |
CSV.parse_line(line[SYSTEMGROUPS]).each do |systemgroup_name| |
197 |
@api.resource(:systemgroups).call(:add_systems, { |
|
199 |
@api.resource(:system_groups).call(:add_systems, {
|
|
198 | 200 |
'id' => katello_systemgroup(line[ORGANIZATION], :name => systemgroup_name), |
199 | 201 |
'system_ids' => [system_id] |
200 | 202 |
}) |
Also available in: Unified diff
test-fixes - setup_test clean except for manifest upload repeat