Revision a77acc4a
Added by Thomas McKay about 9 years ago
lib/hammer_cli_csv/products.rb | ||
---|---|---|
45 | 45 |
@api.resource(:products).call(:index, { |
46 | 46 |
'per_page' => 999999, |
47 | 47 |
'enabled' => true, |
48 |
'organization_id' => katello_organization(:name => organization['name'])
|
|
48 |
'organization_id' => foreman_organization(:name => organization['name'])
|
|
49 | 49 |
})['results'].each do |product| |
50 | 50 |
# product = @api.resource(:products).call(:show, { |
51 | 51 |
# 'id' => product['id'], |
... | ... | |
78 | 78 |
if !@existing_products[line[ORGANIZATION]] |
79 | 79 |
@existing_products[line[ORGANIZATION]] = {} |
80 | 80 |
@api.resource(:products).call(:index, { |
81 |
'organization_id' => katello_organization(:name => line[ORGANIZATION]),
|
|
81 |
'organization_id' => foreman_organization(:name => line[ORGANIZATION]),
|
|
82 | 82 |
'page_size' => 999999, |
83 | 83 |
'paged' => true |
84 | 84 |
})['results'].each do |product| |
... | ... | |
86 | 86 |
|
87 | 87 |
if product |
88 | 88 |
@api.resource(:repositories).call(:index, { |
89 |
'organization_id' => katello_organization(:name => line[ORGANIZATION]),
|
|
89 |
'organization_id' => foreman_organization(:name => line[ORGANIZATION]),
|
|
90 | 90 |
'product_id' => product['id'], |
91 | 91 |
'enabled' => true, |
92 | 92 |
'library' => true, |
... | ... | |
111 | 111 |
end |
112 | 112 |
|
113 | 113 |
product_id = @api.resource(:products).call(:create, { |
114 |
'organization_id' => katello_organization(:name => line[ORGANIZATION]),
|
|
114 |
'organization_id' => foreman_organization(:name => line[ORGANIZATION]),
|
|
115 | 115 |
'name' => name |
116 | 116 |
})['id'] |
117 | 117 |
@existing_products[line[ORGANIZATION]][name] = product_id |
... | ... | |
127 | 127 |
# Hash the existing repositories for the product |
128 | 128 |
if !@existing_repositories[line[ORGANIZATION] + name][repository_name] |
129 | 129 |
@api.resource(:repositories).call(:index, { |
130 |
'organization_id' => katello_organization(:name => line[ORGANIZATION]),
|
|
130 |
'organization_id' => foreman_organization(:name => line[ORGANIZATION]),
|
|
131 | 131 |
'library' => true, |
132 | 132 |
'all' => false, |
133 | 133 |
'product_id' => product_id |
... | ... | |
142 | 142 |
# TMP |
143 | 143 |
puts 'TMP' |
144 | 144 |
@api.resource(:repositories).call(:index, { |
145 |
'organization_id' => katello_organization(:name => line[ORGANIZATION]),
|
|
145 |
'organization_id' => foreman_organization(:name => line[ORGANIZATION]),
|
|
146 | 146 |
'library' => true, |
147 | 147 |
'all' => true, |
148 | 148 |
'product_id' => product_id |
... | ... | |
154 | 154 |
|
155 | 155 |
else |
156 | 156 |
repository_id = @api.resource(:repositories).call(:create, { |
157 |
'organization_id' => katello_organization(:name => line[ORGANIZATION]),
|
|
157 |
'organization_id' => foreman_organization(:name => line[ORGANIZATION]),
|
|
158 | 158 |
'name' => repository_name, |
159 | 159 |
'label' => labelize(repository_name), |
160 | 160 |
'product_id' => product_id, |
... | ... | |
166 | 166 |
|
167 | 167 |
puts 'TODO: skipping sync' |
168 | 168 |
# task_id = @api.resource(:repositories).call(:sync, { |
169 |
# 'organization_id' => katello_organization(:name => line[ORGANIZATION]),
|
|
169 |
# 'organization_id' => foreman_organization(:name => line[ORGANIZATION]),
|
|
170 | 170 |
# 'id' => repository_id |
171 | 171 |
# })['id'] |
172 | 172 |
# TODO: wait for sync task |
Also available in: Unified diff
a lot of fixes and updates across many resources to match katello updates