hammer_cli_csv 0.0.6 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/lib/hammer_cli_csv/activation_keys.rb +57 -65
- data/lib/hammer_cli_csv/base.rb +62 -58
- data/lib/hammer_cli_csv/compute_profiles.rb +13 -15
- data/lib/hammer_cli_csv/compute_resources.rb +13 -15
- data/lib/hammer_cli_csv/content_hosts.rb +105 -86
- data/lib/hammer_cli_csv/content_view_filters.rb +73 -31
- data/lib/hammer_cli_csv/content_views.rb +109 -26
- data/lib/hammer_cli_csv/export.rb +64 -18
- data/lib/hammer_cli_csv/host_collections.rb +35 -33
- data/lib/hammer_cli_csv/hosts.rb +20 -20
- data/lib/hammer_cli_csv/i18n.rb +24 -0
- data/lib/hammer_cli_csv/lifecycle_environments.rb +28 -34
- data/lib/hammer_cli_csv/operating_systems.rb +17 -35
- data/lib/hammer_cli_csv/organizations.rb +13 -7
- data/lib/hammer_cli_csv/products.rb +46 -55
- data/lib/hammer_cli_csv/provisioning_templates.rb +41 -49
- data/lib/hammer_cli_csv/puppet_reports.rb +43 -52
- data/lib/hammer_cli_csv/reports.rb +23 -27
- data/lib/hammer_cli_csv/roles.rb +25 -25
- data/lib/hammer_cli_csv/smart_proxies.rb +13 -15
- data/lib/hammer_cli_csv/subnets.rb +16 -18
- data/lib/hammer_cli_csv/subscriptions.rb +35 -34
- data/lib/hammer_cli_csv/version.rb +1 -1
- data/test/content_hosts_test.rb +61 -0
- data/test/csv_test_helper.rb +22 -3
- data/test/data/activation-keys.csv +118 -118
- data/test/helpers/command.rb +4 -4
- data/test/helpers/resource_disabled.rb +3 -3
- data/test/hosts_test.rb +1 -1
- data/test/roles_test.rb +2 -2
- data/test/setup_test.rb +14 -14
- metadata +19 -4
- data/test/systems_test.rb +0 -71
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZTZmY2U4MTYyOGVjYjU0ZDNmMTg3ZjA4ODY4NDFlYjQzNWJmZDA0OQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YzNlNDUwZDIyZTk4ODA3MTUwOWRhNTY1NGJkNGVlN2U2N2U5MWY5Mg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MThjNzUwYTg4NDJjOTNlZDQzZjUxMjQyNTJmMDVmM2FmOGI3ZjFlYmJmZTMw
|
10
|
+
MWYzZWI2ZjNlYWNmNTA0MjI4NmMyYjc0ZTIxMDFhOWJhMTU2ODBkOTRjNzZm
|
11
|
+
NDIzYzUzMmJmZTc3NDUwNTZkM2ZkZWZmNzJlZDhhZjgwMjNkN2Y=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZjM0MWExNTUyOWU5MmY3NGUwM2YzYTVmZDVhZmNjNDg0MzUyNTdlYWE1ZjU1
|
14
|
+
NTc3NDU2YWFmOTllMjMwODVhOGIwOGQ3NTAyODQwNjA5NzgwYjNkMjYyMTll
|
15
|
+
MzU5OTlkZjJmOTRkZWJmMWQ4ZGNiMTEwMGQzNmZhNGIxNWI5OGM=
|
@@ -20,17 +20,16 @@ module HammerCLICsv
|
|
20
20
|
LIMIT = 'Limit'
|
21
21
|
ENVIRONMENT = 'Environment'
|
22
22
|
CONTENTVIEW = 'Content View'
|
23
|
-
|
23
|
+
HOSTCOLLECTIONS = 'System Groups'
|
24
24
|
SUBSCRIPTIONS = 'Subscriptions'
|
25
25
|
|
26
26
|
def export
|
27
27
|
CSV.open(option_csv_file || '/dev/stdout', 'wb', {:force_quotes => false}) do |csv|
|
28
28
|
csv << [NAME, COUNT, ORGANIZATION, DESCRIPTION, LIMIT, ENVIRONMENT, CONTENTVIEW,
|
29
|
-
|
29
|
+
HOSTCOLLECTIONS, SUBSCRIPTIONS]
|
30
30
|
if @server_status['release'] == 'Headpin'
|
31
31
|
@headpin.get(:organizations).each do |organization|
|
32
32
|
@headpin.get("organizations/#{organization['label']}/activation_keys").each do |activationkey|
|
33
|
-
puts "Writing activation key '#{activationkey['name']}'" if option_verbose?
|
34
33
|
name = namify(activationkey['name'])
|
35
34
|
count = 1
|
36
35
|
description = activationkey['description']
|
@@ -52,20 +51,17 @@ module HammerCLICsv
|
|
52
51
|
end
|
53
52
|
end
|
54
53
|
else
|
55
|
-
@api.resource(:organizations)
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
'organization_id' => organization['id']
|
63
|
-
})['results'].each do |activationkey|
|
64
|
-
puts "Writing activation key '#{activationkey['name']}'" if option_verbose?
|
54
|
+
@api.resource(:organizations).call(:index, {
|
55
|
+
:per_page => 999999
|
56
|
+
})['results'].each do |organization|
|
57
|
+
@api.resource(:activation_keys).call(:index, {
|
58
|
+
'per_page' => 999999,
|
59
|
+
'organization_id' => organization['id']
|
60
|
+
})['results'].each do |activationkey|
|
65
61
|
name = namify(activationkey['name'])
|
66
62
|
count = 1
|
67
63
|
description = activationkey['description']
|
68
|
-
limit = activationkey['usage_limit'].to_i < 0 ? 'Unlimited' :
|
64
|
+
limit = activationkey['usage_limit'].to_i < 0 ? 'Unlimited' : activationkey['usage_limit']
|
69
65
|
environment = activationkey['environment']['label']
|
70
66
|
contentview = activationkey['content_view']['name']
|
71
67
|
hostcollections = export_column(activationkey, 'systemGroups', 'name')
|
@@ -97,11 +93,10 @@ module HammerCLICsv
|
|
97
93
|
def create_activationkeys_from_csv(line)
|
98
94
|
if !@existing[line[ORGANIZATION]]
|
99
95
|
@existing[line[ORGANIZATION]] = {}
|
100
|
-
@api.resource(:activation_keys)
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
})['results'].each do |activationkey|
|
96
|
+
@api.resource(:activation_keys).call(:index, {
|
97
|
+
'per_page' => 999999,
|
98
|
+
'organization_id' => foreman_organization(:name => line[ORGANIZATION])
|
99
|
+
})['results'].each do |activationkey|
|
105
100
|
@existing[line[ORGANIZATION]][activationkey['name']] = activationkey['id'] if activationkey
|
106
101
|
end
|
107
102
|
end
|
@@ -111,30 +106,30 @@ module HammerCLICsv
|
|
111
106
|
|
112
107
|
if !@existing[line[ORGANIZATION]].include? name
|
113
108
|
print "Creating activation key '#{name}'..." if option_verbose?
|
114
|
-
activationkey = @api.resource(:activation_keys)
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
109
|
+
activationkey = @api.resource(:activation_keys).call(:create, {
|
110
|
+
'organization_id' => foreman_organization(:name => line[ORGANIZATION]),
|
111
|
+
'name' => name,
|
112
|
+
'environment_id' => lifecycle_environment(line[ORGANIZATION],
|
113
|
+
:name => line[ENVIRONMENT]),
|
114
|
+
'content_view_id' => katello_contentview(line[ORGANIZATION],
|
115
|
+
:name => line[CONTENTVIEW]),
|
116
|
+
'description' => line[DESCRIPTION],
|
117
|
+
'usage_limit' => usage_limit(line[LIMIT])
|
118
|
+
})
|
124
119
|
@existing[line[ORGANIZATION]][activationkey['name']] = activationkey['id']
|
125
120
|
else
|
126
121
|
print "Updating activation key '#{name}'..." if option_verbose?
|
127
|
-
activationkey = @api.resource(:activation_keys)
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
122
|
+
activationkey = @api.resource(:activation_keys).call(:update, {
|
123
|
+
'organization_id' => foreman_organization(:name => line[ORGANIZATION]),
|
124
|
+
'id' => @existing[line[ORGANIZATION]][name],
|
125
|
+
'name' => name,
|
126
|
+
'environment_id' => lifecycle_environment(line[ORGANIZATION],
|
127
|
+
:name => line[ENVIRONMENT]),
|
128
|
+
'content_view_id' => katello_contentview(line[ORGANIZATION],
|
129
|
+
:name => line[CONTENTVIEW]),
|
130
|
+
'description' => line[DESCRIPTION],
|
131
|
+
'usage_limit' => usage_limit(line[LIMIT])
|
132
|
+
})
|
138
133
|
|
139
134
|
update_subscriptions(activationkey, line)
|
140
135
|
update_groups(activationkey, line)
|
@@ -145,14 +140,13 @@ module HammerCLICsv
|
|
145
140
|
end
|
146
141
|
|
147
142
|
def update_groups(activationkey, line)
|
148
|
-
if line[
|
143
|
+
if line[HOSTCOLLECTIONS] && line[HOSTCOLLECTIONS] != ''
|
149
144
|
# TODO: note that existing system groups are not removed
|
150
|
-
CSV.parse_line(line[
|
151
|
-
@api.resource(:host_collections)
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
})
|
145
|
+
CSV.parse_line(line[HOSTCOLLECTIONS], {:skip_blanks => true}).each do |name|
|
146
|
+
@api.resource(:host_collections).call(:add_activation_keys, {
|
147
|
+
'id' => katello_hostcollection(line[ORGANIZATION], :name => name),
|
148
|
+
'activation_key_ids' => [activationkey['id']]
|
149
|
+
})
|
156
150
|
end
|
157
151
|
end
|
158
152
|
end
|
@@ -160,31 +154,29 @@ module HammerCLICsv
|
|
160
154
|
def update_subscriptions(activationkey, line)
|
161
155
|
if line[SUBSCRIPTIONS] && line[SUBSCRIPTIONS] != ''
|
162
156
|
subscriptions = CSV.parse_line(line[SUBSCRIPTIONS], {:skip_blanks => true}).collect do |subscription_details|
|
163
|
-
(amount, name) = subscription_details.split('|')
|
157
|
+
(amount, sku, name) = subscription_details.split('|')
|
164
158
|
{
|
165
159
|
:id => katello_subscription(line[ORGANIZATION], :name => name),
|
166
|
-
:quantity => amount
|
160
|
+
:quantity => (amount.nil? || amount == 'Automatic') ? 0 : amount
|
167
161
|
}
|
168
162
|
end
|
169
163
|
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
@api.resource(:
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
})
|
164
|
+
existing_subscriptions = @api.resource(:subscriptions).call(:index, {
|
165
|
+
'organization_id' => foreman_organization(:name => line[ORGANIZATION]),
|
166
|
+
'per_page' => 999999,
|
167
|
+
'activation_key_id' => activationkey['id']
|
168
|
+
})['results']
|
169
|
+
if existing_subscriptions.length > 0
|
170
|
+
@api.resource(:activation_keys).call(:remove_subscriptions, {
|
171
|
+
'id' => activationkey['id'],
|
172
|
+
'subscriptions' => existing_subscriptions
|
173
|
+
})
|
181
174
|
end
|
182
175
|
|
183
|
-
@api.resource(:
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
})
|
176
|
+
@api.resource(:activation_keys).call(:add_subscriptions, {
|
177
|
+
'id' => activationkey['id'],
|
178
|
+
'subscriptions' => subscriptions
|
179
|
+
})
|
188
180
|
end
|
189
181
|
end
|
190
182
|
|
data/lib/hammer_cli_csv/base.rb
CHANGED
@@ -23,50 +23,37 @@ module HammerCLICsv
|
|
23
23
|
option %w(--csv-export), :flag, 'Export current data instead of importing'
|
24
24
|
option %w(--csv-file), 'FILE_NAME', 'CSV file (default to /dev/stdout with --csv-export, otherwise required)'
|
25
25
|
option %w(--prefix), 'PREFIX', 'Prefix for all name columns'
|
26
|
-
option %w(--server), 'SERVER', 'Server URL'
|
27
|
-
option %w(-u --username), 'USERNAME', 'Username to access server'
|
28
|
-
option %w(-p --password), 'PASSWORD', 'Password to access server'
|
29
26
|
|
30
27
|
NAME = 'Name'
|
31
28
|
COUNT = 'Count'
|
32
29
|
|
33
30
|
def execute
|
34
|
-
|
35
|
-
if option_csv_export?
|
36
|
-
# rubocop:disable UselessAssignment
|
37
|
-
option_csv_file = '/dev/stdout'
|
38
|
-
else
|
39
|
-
# rubocop:disable UselessAssignment
|
40
|
-
option_csv_file = '/dev/stdin'
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
server = option_server ||
|
31
|
+
@server = HammerCLI::Settings.settings[:_params][:host] ||
|
45
32
|
HammerCLI::Settings.get(:csv, :host) ||
|
46
33
|
HammerCLI::Settings.get(:katello, :host) ||
|
47
34
|
HammerCLI::Settings.get(:foreman, :host)
|
48
|
-
username =
|
35
|
+
@username = HammerCLI::Settings.settings[:_params][:username] ||
|
49
36
|
HammerCLI::Settings.get(:csv, :username) ||
|
50
37
|
HammerCLI::Settings.get(:katello, :username) ||
|
51
38
|
HammerCLI::Settings.get(:foreman, :username)
|
52
|
-
password =
|
39
|
+
@password = HammerCLI::Settings.settings[:_params][:password] ||
|
53
40
|
HammerCLI::Settings.get(:csv, :password) ||
|
54
41
|
HammerCLI::Settings.get(:katello, :password) ||
|
55
42
|
HammerCLI::Settings.get(:foreman, :password)
|
56
43
|
|
57
|
-
@server_status = check_server_status
|
44
|
+
@server_status = check_server_status(@server, @username, @password)
|
58
45
|
|
59
46
|
if @server_status['release'] == 'Headpin'
|
60
47
|
@headpin = HeadpinApi.new({
|
61
|
-
:server => server,
|
62
|
-
:username => username,
|
63
|
-
:password => password
|
48
|
+
:server => @server,
|
49
|
+
:username => @username,
|
50
|
+
:password => @password
|
64
51
|
})
|
65
52
|
else
|
66
53
|
@api = ApipieBindings::API.new({
|
67
|
-
:uri => server,
|
68
|
-
:username => username,
|
69
|
-
:password => password,
|
54
|
+
:uri => @server,
|
55
|
+
:username => @username,
|
56
|
+
:password => @password,
|
70
57
|
:api_version => 2
|
71
58
|
})
|
72
59
|
end
|
@@ -75,10 +62,7 @@ module HammerCLICsv
|
|
75
62
|
HammerCLI::EX_OK
|
76
63
|
end
|
77
64
|
|
78
|
-
def check_server_status
|
79
|
-
server = option_server || HammerCLI::Settings.get(:csv, :host)
|
80
|
-
username = option_username || HammerCLI::Settings.get(:csv, :username)
|
81
|
-
password = option_password || HammerCLI::Settings.get(:csv, :password)
|
65
|
+
def check_server_status(server, username, password)
|
82
66
|
url = "#{server}/api/status"
|
83
67
|
uri = URI(url)
|
84
68
|
nethttp = Net::HTTP.new(uri.host, uri.port)
|
@@ -492,11 +476,10 @@ module HammerCLICsv
|
|
492
476
|
return nil if options[:name].nil? || options[:name].empty?
|
493
477
|
options[:id] = @lifecycle_environments[organization][options[:name]]
|
494
478
|
if !options[:id]
|
495
|
-
@api.resource(:lifecycle_environments)
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
})['results'].each do |environment|
|
479
|
+
@api.resource(:lifecycle_environments).call(:index, {
|
480
|
+
:per_page => 999999,
|
481
|
+
'organization_id' => foreman_organization(:name => organization)
|
482
|
+
})['results'].each do |environment|
|
500
483
|
@lifecycle_environments[organization][environment['name']] = environment['id']
|
501
484
|
end
|
502
485
|
options[:id] = @lifecycle_environments[organization][options[:name]]
|
@@ -527,9 +510,9 @@ module HammerCLICsv
|
|
527
510
|
options[:id] = @contentviews[organization][options[:name]]
|
528
511
|
if !options[:id]
|
529
512
|
@api.resource(:content_views).call(:index, {
|
530
|
-
|
531
|
-
|
532
|
-
|
513
|
+
:per_page => 999999,
|
514
|
+
'organization_id' => foreman_organization(:name => organization)
|
515
|
+
})['results'].each do |contentview|
|
533
516
|
@contentviews[organization][contentview['name']] = contentview['id']
|
534
517
|
end
|
535
518
|
options[:id] = @contentviews[organization][options[:name]]
|
@@ -551,6 +534,30 @@ module HammerCLICsv
|
|
551
534
|
result
|
552
535
|
end
|
553
536
|
|
537
|
+
def katello_contentviewversion(organization, name, version)
|
538
|
+
@contentviewversions ||= {}
|
539
|
+
@contentviewversions[organization] ||= {}
|
540
|
+
versionname = "#{version}|#{name}"
|
541
|
+
|
542
|
+
return nil if name.nil? || name.empty?
|
543
|
+
id = @contentviewversions[organization][versionname]
|
544
|
+
if !id
|
545
|
+
contentview_id = katello_contentview(organization, :name => name)
|
546
|
+
@api.resource(:content_view_versions).call(:index, {
|
547
|
+
:per_page => 999999,
|
548
|
+
'content_view_id' => contentview_id
|
549
|
+
})['results'].each do |contentviewversion|
|
550
|
+
if contentviewversion['version'] == version.to_i
|
551
|
+
@contentviewversions[organization][versionname] = contentviewversion['id']
|
552
|
+
end
|
553
|
+
end
|
554
|
+
id = @contentviewversions[organization][versionname]
|
555
|
+
raise "Content view version '#{name}' with version '#{version}' not found" if !id
|
556
|
+
end
|
557
|
+
|
558
|
+
id
|
559
|
+
end
|
560
|
+
|
554
561
|
def katello_repository(organization, options = {})
|
555
562
|
@repositories ||= {}
|
556
563
|
@repositories[organization] ||= {}
|
@@ -559,11 +566,10 @@ module HammerCLICsv
|
|
559
566
|
return nil if options[:name].nil? || options[:name].empty?
|
560
567
|
options[:id] = @repositories[organization][options[:name]]
|
561
568
|
if !options[:id]
|
562
|
-
@api.resource(:repositories)
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
})['results'].each do |repository|
|
569
|
+
@api.resource(:repositories).call(:index, {
|
570
|
+
:per_page => 999999,
|
571
|
+
'organization_id' => foreman_organization(:name => organization)
|
572
|
+
})['results'].each do |repository|
|
567
573
|
@repositories[organization][repository['name']] = repository['id']
|
568
574
|
end
|
569
575
|
options[:id] = @repositories[organization][options[:name]]
|
@@ -594,10 +600,10 @@ module HammerCLICsv
|
|
594
600
|
options[:id] = @subscriptions[organization][options[:name]]
|
595
601
|
if !options[:id]
|
596
602
|
results = @api.resource(:subscriptions).call(:index, {
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
603
|
+
:per_page => 999999,
|
604
|
+
'organization_id' => foreman_organization(:name => organization),
|
605
|
+
'search' => "name:\"#{options[:name]}\""
|
606
|
+
})
|
601
607
|
raise "No subscriptions match '#{options[:name]}'" if results['subtotal'] == 0
|
602
608
|
raise "Too many subscriptions match '#{options[:name]}'" if results['subtotal'] > 1
|
603
609
|
subscription = results['results'][0]
|
@@ -714,13 +720,12 @@ module HammerCLICsv
|
|
714
720
|
end
|
715
721
|
end
|
716
722
|
associations[organization] += [id] if !associations[organization].include? id
|
717
|
-
@api.resource(:organizations)
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
})
|
723
|
+
@api.resource(:organizations).call(:update, {
|
724
|
+
'id' => organization_id,
|
725
|
+
'organization' => {
|
726
|
+
"#{name}_ids" => associations[organization]
|
727
|
+
}
|
728
|
+
})
|
724
729
|
end if organizations && !organizations.empty?
|
725
730
|
end
|
726
731
|
|
@@ -737,13 +742,12 @@ module HammerCLICsv
|
|
737
742
|
end
|
738
743
|
associations[location] += [id] if !associations[location].include? id
|
739
744
|
|
740
|
-
@api.resource(:locations)
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
})
|
745
|
+
@api.resource(:locations).call(:update, {
|
746
|
+
'id' => location_id,
|
747
|
+
'location' => {
|
748
|
+
"#{name}_ids" => associations[location]
|
749
|
+
}
|
750
|
+
})
|
747
751
|
end if locations && !locations.empty?
|
748
752
|
end
|
749
753
|
end
|
@@ -61,23 +61,21 @@ module HammerCLICsv
|
|
61
61
|
name = namify(line[NAME], number)
|
62
62
|
if !@existing.include? name
|
63
63
|
print "Creating compute profile '#{name}'..." if option_verbose?
|
64
|
-
id = @api.resource(:compute_profiles)
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
})['id']
|
64
|
+
id = @api.resource(:compute_profiles).call(:create, {
|
65
|
+
'compute_profile' => {
|
66
|
+
'name' => name,
|
67
|
+
'url' => line[URL]
|
68
|
+
}
|
69
|
+
})['id']
|
71
70
|
else
|
72
71
|
print "Updating compute profile '#{name}'..." if option_verbose?
|
73
|
-
id = @api.resource(:compute_profiles)
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
})['compute_profile']['id']
|
72
|
+
id = @api.resource(:compute_profiles).call(:update, {
|
73
|
+
'id' => @existing[name],
|
74
|
+
'compute_profile' => {
|
75
|
+
'name' => name,
|
76
|
+
'url' => line[URL]
|
77
|
+
}
|
78
|
+
})['compute_profile']['id']
|
81
79
|
end
|
82
80
|
|
83
81
|
# Update associated profiles
|
@@ -59,23 +59,21 @@ module HammerCLICsv
|
|
59
59
|
name = namify(line[NAME], number)
|
60
60
|
if !@existing.include? name
|
61
61
|
print "Creating compute resource '#{name}'..." if option_verbose?
|
62
|
-
id = @api.resource(:compute_resources)
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
})['id']
|
62
|
+
id = @api.resource(:compute_resources).call(:create, {
|
63
|
+
'compute_resource' => {
|
64
|
+
'name' => name,
|
65
|
+
'url' => line[URL]
|
66
|
+
}
|
67
|
+
})['id']
|
69
68
|
else
|
70
69
|
print "Updating compute resource '#{name}'..." if option_verbose?
|
71
|
-
id = @api.resource(:compute_resources)
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
})['compute_resource']['id']
|
70
|
+
id = @api.resource(:compute_resources).call(:update, {
|
71
|
+
'id' => @existing[name],
|
72
|
+
'compute_resource' => {
|
73
|
+
'name' => name,
|
74
|
+
'url' => line[URL]
|
75
|
+
}
|
76
|
+
})['compute_resource']['id']
|
79
77
|
end
|
80
78
|
|
81
79
|
# Update associated resources
|