knife-azure 1.9.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/azure/azure_interface.rb +2 -3
- data/lib/azure/custom_errors.rb +1 -1
- data/lib/azure/helpers.rb +1 -1
- data/lib/azure/resource_management/ARM_deployment_template.rb +157 -162
- data/lib/azure/resource_management/ARM_interface.rb +72 -73
- data/lib/azure/resource_management/vnet_config.rb +11 -10
- data/lib/azure/resource_management/windows_credentials.rb +19 -19
- data/lib/azure/service_management/ASM_interface.rb +6 -5
- data/lib/azure/service_management/ag.rb +11 -11
- data/lib/azure/service_management/certificate.rb +7 -5
- data/lib/azure/service_management/connection.rb +10 -10
- data/lib/azure/service_management/deploy.rb +12 -14
- data/lib/azure/service_management/disk.rb +4 -2
- data/lib/azure/service_management/host.rb +7 -4
- data/lib/azure/service_management/image.rb +4 -4
- data/lib/azure/service_management/loadbalancer.rb +2 -2
- data/lib/azure/service_management/rest.rb +9 -8
- data/lib/azure/service_management/role.rb +67 -70
- data/lib/azure/service_management/storageaccount.rb +5 -3
- data/lib/azure/service_management/utility.rb +1 -1
- data/lib/azure/service_management/vnet.rb +1 -1
- data/lib/chef/knife/azure_ag_create.rb +13 -13
- data/lib/chef/knife/azure_ag_list.rb +1 -1
- data/lib/chef/knife/azure_base.rb +49 -66
- data/lib/chef/knife/azure_image_list.rb +6 -6
- data/lib/chef/knife/azure_internal-lb_create.rb +14 -14
- data/lib/chef/knife/azure_internal-lb_list.rb +1 -1
- data/lib/chef/knife/azure_server_create.rb +233 -268
- data/lib/chef/knife/azure_server_delete.rb +31 -31
- data/lib/chef/knife/azure_server_list.rb +1 -1
- data/lib/chef/knife/azure_server_show.rb +1 -1
- data/lib/chef/knife/azure_vnet_create.rb +15 -19
- data/lib/chef/knife/azure_vnet_list.rb +1 -1
- data/lib/chef/knife/azurerm_base.rb +39 -28
- data/lib/chef/knife/azurerm_server_create.rb +112 -177
- data/lib/chef/knife/azurerm_server_delete.rb +13 -13
- data/lib/chef/knife/azurerm_server_list.rb +1 -1
- data/lib/chef/knife/azurerm_server_show.rb +1 -1
- data/lib/chef/knife/bootstrap/bootstrapper.rb +34 -238
- data/lib/chef/knife/bootstrap/common_bootstrap_options.rb +77 -76
- data/lib/chef/knife/bootstrap_azure.rb +56 -33
- data/lib/chef/knife/bootstrap_azurerm.rb +46 -29
- data/lib/knife-azure/version.rb +18 -1
- metadata +28 -16
- data/lib/chef/knife/bootstrap/bootstrap_options.rb +0 -105
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Barry Davis (barryd@jetstreamsoftware.com)
|
3
|
-
# Copyright:: Copyright 2010-
|
3
|
+
# Copyright:: Copyright 2010-2019, Chef Software Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -26,9 +26,9 @@ module Azure
|
|
26
26
|
# force_load should be true when there is something in local cache and we want to reload
|
27
27
|
# first call is always load.
|
28
28
|
def load(force_load = false)
|
29
|
-
|
29
|
+
unless @azure_storage_accounts || force_load
|
30
30
|
@azure_storage_accounts = begin
|
31
|
-
azure_storage_accounts =
|
31
|
+
azure_storage_accounts = {}
|
32
32
|
responseXML = @connection.query_azure("storageservices")
|
33
33
|
servicesXML = responseXML.css("StorageServices StorageService")
|
34
34
|
servicesXML.each do |serviceXML|
|
@@ -48,6 +48,7 @@ module Azure
|
|
48
48
|
# first look up local cache if we have already loaded list.
|
49
49
|
def exists?(name)
|
50
50
|
return @azure_storage_accounts.key?(name) if @azure_storage_accounts
|
51
|
+
|
51
52
|
exists_on_cloud?(name)
|
52
53
|
end
|
53
54
|
|
@@ -71,6 +72,7 @@ module Azure
|
|
71
72
|
def clear_unattached
|
72
73
|
all.each do |storage|
|
73
74
|
next unless storage.attached == false
|
75
|
+
|
74
76
|
@connection.query_azure("storageaccounts/" + storage.name, "delete")
|
75
77
|
end
|
76
78
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Barry Davis (barryd@jetstreamsoftware.com)
|
3
|
-
# Copyright:: Copyright 2010-
|
3
|
+
# Copyright:: Copyright 2010-2019, Chef Software Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Jeff Mendoza (jeffmendoza@live.com)
|
3
|
-
# Copyright:: Copyright
|
3
|
+
# Copyright:: Copyright 2010-2019, Chef Software Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Jeff Mendoza (jeffmendoza@live.com)
|
3
|
-
# Copyright:: Copyright
|
3
|
+
# Copyright:: Copyright 2010-2019, Chef Software Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -26,18 +26,18 @@ class Chef
|
|
26
26
|
banner "knife azure ag create (options)"
|
27
27
|
|
28
28
|
option :azure_affinity_group,
|
29
|
-
:
|
30
|
-
:
|
31
|
-
:
|
29
|
+
short: "-a GROUP",
|
30
|
+
long: "--azure-affinity-group GROUP",
|
31
|
+
description: "Specifies new affinity group name."
|
32
32
|
|
33
33
|
option :azure_ag_desc,
|
34
|
-
:
|
35
|
-
:
|
34
|
+
long: "--azure-ag-desc DESC",
|
35
|
+
description: "Optional. Description for new affinity group."
|
36
36
|
|
37
37
|
option :azure_service_location,
|
38
|
-
:
|
39
|
-
:
|
40
|
-
:
|
38
|
+
short: "-m LOCATION",
|
39
|
+
long: "--azure-service-location LOCATION",
|
40
|
+
description: "Specifies the geographic location - the name of "\
|
41
41
|
"the data center location that is valid for your "\
|
42
42
|
"subscription. Eg: West US, East US, "\
|
43
43
|
"East Asia, Southeast Asia, North Europe, West Europe"
|
@@ -47,7 +47,7 @@ class Chef
|
|
47
47
|
|
48
48
|
Chef::Log.info("validating...")
|
49
49
|
validate_asm_keys!(:azure_affinity_group,
|
50
|
-
|
50
|
+
:azure_service_location)
|
51
51
|
|
52
52
|
params = {
|
53
53
|
azure_ag_name: locate_config_value(:azure_affinity_group),
|
@@ -61,11 +61,11 @@ class Chef
|
|
61
61
|
if rsp.at_css("Code").nil? || rsp.at_css("Message").nil?
|
62
62
|
puts "Unknown Error. try -VV"
|
63
63
|
else
|
64
|
-
puts "#{rsp.at_css(
|
65
|
-
"#{rsp.at_css(
|
64
|
+
puts "#{rsp.at_css("Code").content}: "\
|
65
|
+
"#{rsp.at_css("Message").content}"
|
66
66
|
end
|
67
67
|
else
|
68
|
-
puts "Creation status: #{rsp.at_css(
|
68
|
+
puts "Creation status: #{rsp.at_css("Status").content}"
|
69
69
|
end
|
70
70
|
end
|
71
71
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Jeff Mendoza (jeffmendoza@live.com)
|
3
|
-
# Copyright:: Copyright
|
3
|
+
# Copyright:: Copyright 2010-2019, Chef Software Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -1,7 +1,6 @@
|
|
1
|
-
|
2
1
|
# Author:: Barry Davis (barryd@jetstreamsoftware.com)
|
3
2
|
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
4
|
-
# Copyright:: Copyright
|
3
|
+
# Copyright:: Copyright 2010-2019, Chef Software Inc.
|
5
4
|
# License:: Apache License, Version 2.0
|
6
5
|
#
|
7
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -23,67 +22,65 @@ require "azure/service_management/ASM_interface"
|
|
23
22
|
class Chef
|
24
23
|
class Knife
|
25
24
|
module AzureBase
|
26
|
-
|
27
25
|
# :nodoc:
|
28
26
|
# Would prefer to do this in a rational way, but can't be done b/c of
|
29
27
|
# Mixlib::CLI's design :(
|
30
28
|
def self.included(includer)
|
31
29
|
includer.class_eval do
|
32
|
-
|
33
30
|
deps do
|
34
31
|
require "readline"
|
35
32
|
require "chef/json_compat"
|
36
33
|
end
|
37
34
|
|
38
35
|
option :azure_subscription_id,
|
39
|
-
:
|
40
|
-
:
|
41
|
-
:
|
42
|
-
:proc
|
36
|
+
short: "-S ID",
|
37
|
+
long: "--azure-subscription-id ID",
|
38
|
+
description: "Your Azure subscription ID",
|
39
|
+
proc: proc { |key| Chef::Config[:knife][:azure_subscription_id] = key }
|
43
40
|
|
44
41
|
option :azure_mgmt_cert,
|
45
|
-
:
|
46
|
-
:
|
47
|
-
:
|
48
|
-
:proc
|
42
|
+
short: "-p FILENAME",
|
43
|
+
long: "--azure-mgmt-cert FILENAME",
|
44
|
+
description: "Your Azure PEM file name",
|
45
|
+
proc: proc { |key| Chef::Config[:knife][:azure_mgmt_cert] = key }
|
49
46
|
|
50
47
|
option :azure_api_host_name,
|
51
|
-
:
|
52
|
-
:
|
53
|
-
:
|
54
|
-
:proc
|
48
|
+
short: "-H HOSTNAME",
|
49
|
+
long: "--azure-api-host-name HOSTNAME",
|
50
|
+
description: "Your Azure host name",
|
51
|
+
proc: proc { |key| Chef::Config[:knife][:azure_api_host_name] = key }
|
55
52
|
|
56
53
|
option :verify_ssl_cert,
|
57
|
-
:
|
58
|
-
:
|
59
|
-
:
|
60
|
-
:
|
54
|
+
long: "--verify-ssl-cert",
|
55
|
+
description: "Verify SSL Certificates for communication over HTTPS",
|
56
|
+
boolean: true,
|
57
|
+
default: false
|
61
58
|
|
62
59
|
option :azure_publish_settings_file,
|
63
|
-
:
|
64
|
-
:
|
65
|
-
:proc
|
60
|
+
long: "--azure-publish-settings-file FILENAME",
|
61
|
+
description: "Your Azure Publish Settings File",
|
62
|
+
proc: proc { |key| Chef::Config[:knife][:azure_publish_settings_file] = key }
|
66
63
|
end
|
67
64
|
end
|
68
65
|
|
69
66
|
def is_image_windows?
|
70
67
|
images = service.list_images
|
71
68
|
target_image = images.select { |i| i.name == locate_config_value(:azure_source_image) }
|
72
|
-
|
73
|
-
|
74
|
-
else
|
75
|
-
ui.error("Invalid image. Use the command \"knife azure image list\" to verify the image name")
|
69
|
+
if target_image[0].nil?
|
70
|
+
ui.error('Invalid image. Use the command "knife azure image list" to verify the image name')
|
76
71
|
exit 1
|
72
|
+
else
|
73
|
+
return target_image[0].os == "Windows"
|
77
74
|
end
|
78
75
|
end
|
79
76
|
|
80
77
|
def service
|
81
78
|
@service ||= begin
|
82
79
|
service = Azure::ServiceManagement::ASMInterface.new(
|
83
|
-
:
|
84
|
-
:
|
85
|
-
:
|
86
|
-
:
|
80
|
+
azure_subscription_id: locate_config_value(:azure_subscription_id),
|
81
|
+
azure_mgmt_cert: locate_config_value(:azure_mgmt_cert),
|
82
|
+
azure_api_host_name: locate_config_value(:azure_api_host_name),
|
83
|
+
verify_ssl_cert: locate_config_value(:verify_ssl_cert)
|
87
84
|
)
|
88
85
|
end
|
89
86
|
@service.ui = ui
|
@@ -120,19 +117,14 @@ class Chef
|
|
120
117
|
end
|
121
118
|
|
122
119
|
def pretty_key(key)
|
123
|
-
key.to_s.tr("_", " ").gsub(/\w+/) { |w|
|
120
|
+
key.to_s.tr("_", " ").gsub(/\w+/) { |w| w =~ /(ssh)|(aws)/i ? w.upcase : w.capitalize }
|
124
121
|
end
|
125
122
|
|
126
123
|
# validate command pre-requisites (cli options)
|
127
|
-
# (locate_config_value(:
|
124
|
+
# (locate_config_value(:connection_password).length <= 6 && locate_config_value(:connection_password).length >= 72)
|
128
125
|
def validate_params!
|
129
|
-
if locate_config_value(:
|
130
|
-
ui.error("The supplied password must be 6-72 characters long and meet password complexity requirements")
|
131
|
-
exit 1
|
132
|
-
end
|
133
|
-
|
134
|
-
if locate_config_value(:ssh_password) && !locate_config_value(:ssh_password).empty? && !locate_config_value(:ssh_password).strip.size.between?(6, 72)
|
135
|
-
ui.error("The supplied ssh password must be 6-72 characters long and meet password complexity requirements")
|
126
|
+
if locate_config_value(:connection_password) && !locate_config_value(:connection_password).length.between?(6, 72)
|
127
|
+
ui.error("The supplied connection password must be 6-72 characters long and meet password complexity requirements")
|
136
128
|
exit 1
|
137
129
|
end
|
138
130
|
|
@@ -141,20 +133,12 @@ class Chef
|
|
141
133
|
exit 1
|
142
134
|
end
|
143
135
|
|
144
|
-
|
145
|
-
ui.error("
|
146
|
-
exit 1
|
147
|
-
elsif locate_config_value(:azure_service_location).nil? && locate_config_value(:azure_affinity_group).nil?
|
148
|
-
ui.error("Must specify either --azure-service-location or --azure-affinity-group.")
|
149
|
-
exit 1
|
150
|
-
end
|
151
|
-
|
152
|
-
if locate_config_value(:winrm_authentication_protocol) && ! %w{basic negotiate kerberos}.include?(locate_config_value(:winrm_authentication_protocol).downcase)
|
153
|
-
ui.error("Invalid value for --winrm-authentication-protocol option. Use valid protocol values i.e [basic, negotiate, kerberos]")
|
136
|
+
unless !!locate_config_value(:azure_service_location) ^ !!locate_config_value(:azure_affinity_group)
|
137
|
+
ui.error("Specify either --azure-service-location or --azure-affinity-group")
|
154
138
|
exit 1
|
155
139
|
end
|
156
140
|
|
157
|
-
|
141
|
+
unless service.valid_image?(locate_config_value(:azure_source_image))
|
158
142
|
ui.error("Image '#{locate_config_value(:azure_source_image)}' is invalid")
|
159
143
|
exit 1
|
160
144
|
end
|
@@ -167,17 +151,17 @@ class Chef
|
|
167
151
|
end
|
168
152
|
end
|
169
153
|
|
170
|
-
if locate_config_value(:
|
171
|
-
ui.error("The SSL transport was specified without the --thumbprint option. Specify a thumbprint, or alternatively set the --winrm-
|
154
|
+
if locate_config_value(:winrm_ssl) && locate_config_value(:thumbprint).nil? && locate_config_value(:winrm_no_verify_cert).nil?
|
155
|
+
ui.error("The SSL transport was specified without the --thumbprint option. Specify a thumbprint, or alternatively set the --winrm-no-verify-cert option to skip verification.")
|
172
156
|
exit 1
|
173
157
|
end
|
174
158
|
|
175
|
-
if locate_config_value(:extended_logs) && locate_config_value(:
|
159
|
+
if locate_config_value(:extended_logs) && locate_config_value(:connection_protocol) != "cloud-api"
|
176
160
|
ui.error("--extended-logs option only works with --bootstrap-protocol cloud-api")
|
177
161
|
exit 1
|
178
162
|
end
|
179
163
|
|
180
|
-
if locate_config_value(:
|
164
|
+
if locate_config_value(:connection_protocol) == "cloud-api" && locate_config_value(:azure_vm_name).nil? && locate_config_value(:azure_dns_name).nil?
|
181
165
|
ui.error("Specifying the DNS name using --azure-dns-name or VM name using --azure-vm-name option is required with --bootstrap-protocol cloud-api")
|
182
166
|
exit 1
|
183
167
|
end
|
@@ -187,7 +171,7 @@ class Chef
|
|
187
171
|
raise ArgumentError, "The daemon option is only supported for Windows nodes."
|
188
172
|
end
|
189
173
|
|
190
|
-
unless locate_config_value(:
|
174
|
+
unless locate_config_value(:connection_protocol) == "cloud-api"
|
191
175
|
raise ArgumentError, "The --daemon option requires the use of --bootstrap-protocol cloud-api"
|
192
176
|
end
|
193
177
|
|
@@ -205,17 +189,15 @@ class Chef
|
|
205
189
|
errors << "You did not provide a valid '#{pretty_key(k)}' value. Please set knife[:#{k}] in your knife.rb or pass as an option."
|
206
190
|
end
|
207
191
|
end
|
208
|
-
if errors.each { |e| ui.error(e) }.any?
|
209
|
-
exit 1
|
210
|
-
end
|
192
|
+
exit 1 if errors.each { |e| ui.error(e) }.any?
|
211
193
|
end
|
212
194
|
|
213
195
|
# validate ASM mandatory keys
|
214
196
|
def validate_asm_keys!(*keys)
|
215
|
-
mandatory_keys =
|
197
|
+
mandatory_keys = %i{azure_subscription_id azure_mgmt_cert azure_api_host_name}
|
216
198
|
keys.concat(mandatory_keys)
|
217
199
|
|
218
|
-
|
200
|
+
unless locate_config_value(:azure_mgmt_cert).nil?
|
219
201
|
config[:azure_mgmt_cert] = File.read find_file(locate_config_value(:azure_mgmt_cert))
|
220
202
|
end
|
221
203
|
|
@@ -239,7 +221,7 @@ class Chef
|
|
239
221
|
doc = Nokogiri::XML(File.open(find_file(filename)))
|
240
222
|
profile = doc.at_css("PublishProfile")
|
241
223
|
subscription = profile.at_css("Subscription")
|
242
|
-
#check given PublishSettings XML file format.Currently PublishSettings file have two different XML format
|
224
|
+
# check given PublishSettings XML file format.Currently PublishSettings file have two different XML format
|
243
225
|
if profile.attribute("SchemaVersion").nil?
|
244
226
|
management_cert = OpenSSL::PKCS12.new(Base64.decode64(profile.attribute("ManagementCertificate").value))
|
245
227
|
Chef::Config[:knife][:azure_api_host_name] = URI(profile.attribute("Url").value).host
|
@@ -268,7 +250,7 @@ class Chef
|
|
268
250
|
azure_profile = File.read(File.expand_path(filename))
|
269
251
|
azure_profile = JSON.parse(azure_profile)
|
270
252
|
default_subscription = get_default_subscription(azure_profile)
|
271
|
-
if default_subscription.
|
253
|
+
if default_subscription.key?("id") && default_subscription.key?("managementCertificate") && default_subscription.key?("managementEndpointUrl")
|
272
254
|
|
273
255
|
Chef::Config[:knife][:azure_subscription_id] = default_subscription["id"]
|
274
256
|
mgmt_key = OpenSSL::PKey::RSA.new(default_subscription["managementCertificate"]["key"]).to_pem
|
@@ -285,7 +267,7 @@ class Chef
|
|
285
267
|
first_subscription_as_default = nil
|
286
268
|
azure_profile["subscriptions"].each do |subscription|
|
287
269
|
if subscription["isDefault"]
|
288
|
-
Chef::Log.info("Default subscription \'#{subscription[
|
270
|
+
Chef::Log.info("Default subscription \'#{subscription["name"]}\'' selected.")
|
289
271
|
return subscription
|
290
272
|
end
|
291
273
|
|
@@ -293,7 +275,7 @@ class Chef
|
|
293
275
|
end
|
294
276
|
|
295
277
|
if first_subscription_as_default
|
296
|
-
Chef::Log.info("First subscription \'#{subscription[
|
278
|
+
Chef::Log.info("First subscription \'#{subscription["name"]}\' selected as default.")
|
297
279
|
else
|
298
280
|
Chef::Log.info("No subscriptions found.")
|
299
281
|
exit 1
|
@@ -352,6 +334,7 @@ class Chef
|
|
352
334
|
|
353
335
|
def fetch_substatus(extension)
|
354
336
|
return nil if extension.at_css("ExtensionSettingStatus SubStatusList SubStatus").nil?
|
337
|
+
|
355
338
|
substatus_list_xml = extension.css("ExtensionSettingStatus SubStatusList SubStatus")
|
356
339
|
substatus_list_xml.each do |substatus|
|
357
340
|
if substatus.at_css("Name").text == "Chef Client run logs"
|
@@ -398,7 +381,7 @@ class Chef
|
|
398
381
|
## unavailability of the substatus field indicates that chef-client run is not completed yet on the server ##
|
399
382
|
fetch_process_wait_time = ((Time.now - fetch_process_start_time) / 60).round
|
400
383
|
if fetch_process_wait_time <= fetch_process_wait_timeout ## wait for maximum 30 minutes until chef-client run logs becomes available ##
|
401
|
-
print "#{ui.color(
|
384
|
+
print "#{ui.color(".", :bold)}"
|
402
385
|
sleep 30
|
403
386
|
fetch_chef_client_logs(fetch_process_start_time, fetch_process_wait_timeout)
|
404
387
|
else
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# Author:: Barry Davis (barryd@jetstreamsoftware.com)
|
3
3
|
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
4
4
|
# Author:: Adam Jacob (<adam@chef.io>)
|
5
|
-
# Copyright:: Copyright 2010-
|
5
|
+
# Copyright:: Copyright 2010-2019, Chef Software Inc.
|
6
6
|
# License:: Apache License, Version 2.0
|
7
7
|
#
|
8
8
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -29,10 +29,10 @@ class Chef
|
|
29
29
|
banner "knife azure image list (options)"
|
30
30
|
|
31
31
|
option :show_all_fields,
|
32
|
-
:
|
33
|
-
:
|
34
|
-
:
|
35
|
-
:
|
32
|
+
long: "--full",
|
33
|
+
default: false,
|
34
|
+
boolean: true,
|
35
|
+
description: "Show all the fields of the images"
|
36
36
|
|
37
37
|
def run
|
38
38
|
$stdout.sync = true
|
@@ -43,7 +43,7 @@ class Chef
|
|
43
43
|
image_labels = !locate_config_value(:show_all_fields) ? %w{Name OS Location} : %w{Name Category Label OS Location}
|
44
44
|
image_list = image_labels.map { |label| ui.color(label, :bold) }
|
45
45
|
|
46
|
-
image_items = image_labels.map
|
46
|
+
image_items = image_labels.map(&:downcase)
|
47
47
|
items.each do |image|
|
48
48
|
image_items.each { |item| image_list << image.send(item).to_s }
|
49
49
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Aiman Alsari (aiman.alsari@gmail.com)
|
3
|
-
# Copyright:: Copyright
|
3
|
+
# Copyright:: Copyright 2010-2019, Chef Software Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -26,22 +26,22 @@ class Chef
|
|
26
26
|
banner "knife azure internal lb create (options)"
|
27
27
|
|
28
28
|
option :azure_load_balancer,
|
29
|
-
:
|
30
|
-
:
|
31
|
-
:
|
29
|
+
short: "-n NAME",
|
30
|
+
long: "--azure-load-balancer NAME",
|
31
|
+
description: "Required. Specifies new load balancer name."
|
32
32
|
|
33
33
|
option :azure_lb_static_vip,
|
34
|
-
:
|
35
|
-
:
|
34
|
+
long: "--azure-lb-static-vip VIP",
|
35
|
+
description: "Optional. The Virtual IP that will be used for the load balancer."
|
36
36
|
|
37
37
|
option :azure_subnet_name,
|
38
|
-
:
|
39
|
-
:
|
38
|
+
long: "--azure-subnet-name SUBNET_NAME",
|
39
|
+
description: "Required if static VIP is set. Specifies the subnet name "\
|
40
40
|
"the load balancer is located in."
|
41
41
|
|
42
42
|
option :azure_dns_name,
|
43
|
-
:
|
44
|
-
:
|
43
|
+
long: "--azure-dns-name DNS_NAME",
|
44
|
+
description: "The DNS prefix name that will be used to add this load balancer to. This must be an existing service/deployment."
|
45
45
|
|
46
46
|
def run
|
47
47
|
$stdout.sync = true
|
@@ -53,7 +53,7 @@ class Chef
|
|
53
53
|
azure_load_balancer: locate_config_value(:azure_load_balancer),
|
54
54
|
azure_lb_static_vip: locate_config_value(:azure_lb_static_vip),
|
55
55
|
azure_subnet_name: locate_config_value(:azure_subnet_name),
|
56
|
-
azure_dns_name: locate_config_value(:azure_dns_name)
|
56
|
+
azure_dns_name: locate_config_value(:azure_dns_name),
|
57
57
|
}
|
58
58
|
|
59
59
|
rsp = service.create_internal_lb(params)
|
@@ -62,11 +62,11 @@ class Chef
|
|
62
62
|
if rsp.at_css("Code").nil? || rsp.at_css("Message").nil?
|
63
63
|
puts "Unknown Error. try -VV"
|
64
64
|
else
|
65
|
-
puts "#{rsp.at_css(
|
66
|
-
"#{rsp.at_css(
|
65
|
+
puts "#{rsp.at_css("Code").content}: "\
|
66
|
+
"#{rsp.at_css("Message").content}"
|
67
67
|
end
|
68
68
|
else
|
69
|
-
puts "Creation status: #{rsp.at_css(
|
69
|
+
puts "Creation status: #{rsp.at_css("Status").content}"
|
70
70
|
end
|
71
71
|
end
|
72
72
|
end
|