hammer_cli_import 0.11.1 → 0.11.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2024b364e195c834b54c4f222e41a4bf112a030e
|
4
|
+
data.tar.gz: 6f31847618212064183447dddcb4647e7dbc9604
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f60431b8922f66724f13ce9586518b044bc6d1107af24f40b0e9a0f1c649870ba166b3111ac6029e9eb48c2fd7ad50d9ed14434e4a37bcad14dbb3a4264b2d84
|
7
|
+
data.tar.gz: a6e943876bb2b3fc8ea5662febadf678d89aeb24e3154ec3c3e1637bc8830fd2f47edbc68e422964b37a1b48a53a3475d5c272f86b30d082c6498c2b8d2e19cb
|
@@ -62,7 +62,7 @@ module HammerCLIImport
|
|
62
62
|
:products => :organizations,
|
63
63
|
:repositories => :organizations,
|
64
64
|
:repository_sets => :products,
|
65
|
-
:
|
65
|
+
:hosts => :organizations
|
66
66
|
}
|
67
67
|
# cache imported objects (created/lookuped)
|
68
68
|
@cache = {}
|
@@ -338,7 +338,7 @@ module HammerCLIImport
|
|
338
338
|
end
|
339
339
|
|
340
340
|
results.each do |entity|
|
341
|
-
entity['id'] = entity['
|
341
|
+
entity['id'] = entity['id'].to_s if entity_type == :hosts
|
342
342
|
@cache[entity_type][entity['id']] = entity
|
343
343
|
end
|
344
344
|
end
|
@@ -443,7 +443,7 @@ module HammerCLIImport
|
|
443
443
|
return get_cache(entity_type)[@pm[entity_type][original_id]]
|
444
444
|
else
|
445
445
|
info 'Creating new ' + type + ': ' + entity_hash.values_at(:name, :label, :login).compact[0]
|
446
|
-
if entity_type == :
|
446
|
+
if entity_type == :hosts
|
447
447
|
entity = @api.resource(:host_subscriptions).call(:create, entity_hash)
|
448
448
|
params = {
|
449
449
|
'id' => entity['id'],
|
@@ -451,7 +451,7 @@ module HammerCLIImport
|
|
451
451
|
'comment' => entity_hash[:description]
|
452
452
|
}
|
453
453
|
}
|
454
|
-
@api.resource(:hosts).call(:update, params)
|
454
|
+
entity = @api.resource(:hosts).call(:update, params)
|
455
455
|
unless entity_hash[:host_collection_ids].empty?
|
456
456
|
@api.resource(:host_collections).call(:add_hosts, {
|
457
457
|
'id' => entity_hash[:host_collection_ids][0],
|
@@ -38,7 +38,7 @@ module HammerCLIImport
|
|
38
38
|
'base_channel_label'
|
39
39
|
|
40
40
|
persistent_maps :organizations, :content_views, :redhat_content_views, :system_content_views,
|
41
|
-
:host_collections, :
|
41
|
+
:host_collections, :hosts
|
42
42
|
|
43
43
|
option ['--export-directory'], 'DIR_PATH', 'Directory to export rpmbuild structure'
|
44
44
|
|
@@ -88,12 +88,14 @@ module HammerCLIImport
|
|
88
88
|
'Composite content view for content hosts',
|
89
89
|
cvs)
|
90
90
|
profile = mk_profile_hash data, cv_id
|
91
|
-
c_host = create_entity(:
|
91
|
+
c_host = create_entity(:hosts, profile, data['server_id'].to_i)
|
92
92
|
# store processed system profiles to a set according to the organization
|
93
93
|
@map << {
|
94
94
|
:org_id => data['organization_id'].to_i,
|
95
|
-
:
|
96
|
-
:
|
95
|
+
:system_id => data['server_id'].to_i,
|
96
|
+
:host_id => c_host['id'],
|
97
|
+
:uuid => c_host['subscription_facet_attributes']['uuid']
|
98
|
+
}
|
97
99
|
# associate virtual guests in post_import to make sure, all the guests
|
98
100
|
# are already imported (and known to sat6)
|
99
101
|
@vguests[data['server_id'].to_i] = split_multival(data['virtual_guest']) if data['virtual_host'] == data['server_id']
|
@@ -103,13 +105,13 @@ module HammerCLIImport
|
|
103
105
|
def post_import(_file)
|
104
106
|
@vguests.each do |system_id, guest_ids|
|
105
107
|
handle_missing_and_supress "setting guests for #{system_id}" do
|
106
|
-
uuid = get_translated_id(:
|
108
|
+
uuid = get_translated_id(:hosts, system_id)
|
107
109
|
vguest_uuids = guest_ids.collect do |id|
|
108
|
-
get_translated_id(:
|
110
|
+
get_translated_id(:hosts, id)
|
109
111
|
end if guest_ids
|
110
112
|
debug "Setting virtual guests for #{uuid}: #{vguest_uuids.inspect}"
|
111
113
|
update_entity(
|
112
|
-
:
|
114
|
+
:hosts,
|
113
115
|
uuid,
|
114
116
|
{:guest_ids => vguest_uuids}
|
115
117
|
) if uuid && vguest_uuids
|
@@ -155,14 +157,14 @@ module HammerCLIImport
|
|
155
157
|
def delete_single_row(data)
|
156
158
|
@composite_cvs ||= Set.new
|
157
159
|
profile_id = data['server_id'].to_i
|
158
|
-
unless @pm[:
|
159
|
-
info "#{to_singular(:
|
160
|
+
unless @pm[:hosts][profile_id]
|
161
|
+
info "#{to_singular(:hosts).capitalize} with id #{profile_id} wasn't imported. Skipping deletion."
|
160
162
|
return
|
161
163
|
end
|
162
|
-
profile = get_cache(:
|
164
|
+
profile = get_cache(:hosts)[@pm[:hosts][profile_id]]
|
163
165
|
cv = get_cache(:content_views)[profile['content_view_id']]
|
164
|
-
@composite_cvs << cv['id'] if cv['composite']
|
165
|
-
delete_entity_by_import_id(:
|
166
|
+
@composite_cvs << cv['id'] if cv && cv['composite']
|
167
|
+
delete_entity_by_import_id(:hosts, get_translated_id(:hosts, profile_id), 'id')
|
166
168
|
end
|
167
169
|
|
168
170
|
def post_delete(_file)
|
@@ -56,7 +56,7 @@ module PersistentMap
|
|
56
56
|
:content_views
|
57
57
|
@definitions[:redhat_repositories] = [{'org_id' => Fixnum}, {'channel_id' => Fixnum}], ['sat6' => Fixnum],
|
58
58
|
:repositories
|
59
|
-
@definitions[:
|
59
|
+
@definitions[:hosts] = ['sat5' => Fixnum], ['sat6' => String], :hosts
|
60
60
|
@definitions[:template_snippets] = ['id' => Fixnum], ['sat6' => Fixnum], :config_templates
|
61
61
|
|
62
62
|
@definitions.freeze
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hammer_cli_import
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "@mkollar"
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-07-
|
12
|
+
date: 2016-07-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: hammer_cli
|