knife-azure 1.6.0.rc.0 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +304 -8
- data/lib/azure/azure_interface.rb +81 -0
- data/lib/azure/custom_errors.rb +35 -0
- data/lib/azure/helpers.rb +44 -0
- data/lib/azure/resource_management/ARM_base.rb +29 -0
- data/lib/azure/resource_management/ARM_deployment_template.rb +561 -0
- data/lib/azure/resource_management/ARM_interface.rb +795 -0
- data/lib/azure/resource_management/windows_credentials.rb +136 -0
- data/lib/azure/service_management/ASM_interface.rb +301 -0
- data/lib/azure/{ag.rb → service_management/ag.rb} +2 -2
- data/lib/azure/{certificate.rb → service_management/certificate.rb} +2 -2
- data/lib/azure/service_management/connection.rb +102 -0
- data/lib/azure/{deploy.rb → service_management/deploy.rb} +8 -2
- data/lib/azure/{disk.rb → service_management/disk.rb} +2 -2
- data/lib/azure/{host.rb → service_management/host.rb} +2 -2
- data/lib/azure/{image.rb → service_management/image.rb} +2 -2
- data/lib/azure/{loadbalancer.rb → service_management/loadbalancer.rb} +4 -18
- data/lib/azure/{rest.rb → service_management/rest.rb} +15 -10
- data/lib/azure/{role.rb → service_management/role.rb} +174 -6
- data/lib/azure/{storageaccount.rb → service_management/storageaccount.rb} +2 -2
- data/lib/azure/{utility.rb → service_management/utility.rb} +0 -0
- data/lib/azure/{vnet.rb → service_management/vnet.rb} +2 -2
- data/lib/chef/knife/azure_ag_create.rb +3 -6
- data/lib/chef/knife/azure_ag_list.rb +2 -16
- data/lib/chef/knife/azure_base.rb +89 -22
- data/lib/chef/knife/azure_image_list.rb +3 -7
- data/lib/chef/knife/azure_internal-lb_create.rb +2 -5
- data/lib/chef/knife/azure_internal-lb_list.rb +2 -16
- data/lib/chef/knife/azure_server_create.rb +122 -501
- data/lib/chef/knife/azure_server_delete.rb +15 -38
- data/lib/chef/knife/azure_server_list.rb +2 -27
- data/lib/chef/knife/azure_server_show.rb +4 -60
- data/lib/chef/knife/azure_vnet_create.rb +2 -7
- data/lib/chef/knife/azure_vnet_list.rb +2 -17
- data/lib/chef/knife/azurerm_base.rb +228 -0
- data/lib/chef/knife/azurerm_server_create.rb +393 -0
- data/lib/chef/knife/azurerm_server_delete.rb +121 -0
- data/lib/chef/knife/azurerm_server_list.rb +18 -0
- data/lib/chef/knife/azurerm_server_show.rb +37 -0
- data/lib/chef/knife/bootstrap/bootstrap_options.rb +105 -0
- data/lib/chef/knife/bootstrap/bootstrapper.rb +343 -0
- data/lib/chef/knife/bootstrap/common_bootstrap_options.rb +116 -0
- data/lib/chef/knife/bootstrap_azure.rb +110 -0
- data/lib/chef/knife/bootstrap_azurerm.rb +116 -0
- data/lib/knife-azure/version.rb +1 -2
- metadata +132 -16
- data/lib/azure/connection.rb +0 -99
data/lib/azure/connection.rb
DELETED
@@ -1,99 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Barry Davis (barryd@jetstreamsoftware.com)
|
3
|
-
# Copyright:: Copyright (c) 2010-2011 Opscode, Inc.
|
4
|
-
# License:: Apache License, Version 2.0
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
#
|
18
|
-
require File.expand_path('../utility', __FILE__)
|
19
|
-
require File.expand_path('../rest', __FILE__)
|
20
|
-
require File.expand_path('../host', __FILE__)
|
21
|
-
require File.expand_path('../storageaccount', __FILE__)
|
22
|
-
require File.expand_path('../deploy', __FILE__)
|
23
|
-
require File.expand_path('../role', __FILE__)
|
24
|
-
require File.expand_path('../disk', __FILE__)
|
25
|
-
require File.expand_path('../image', __FILE__)
|
26
|
-
require File.expand_path('../certificate', __FILE__)
|
27
|
-
require File.expand_path('../ag', __FILE__)
|
28
|
-
require File.expand_path('../loadbalancer', __FILE__)
|
29
|
-
require File.expand_path('../vnet', __FILE__)
|
30
|
-
|
31
|
-
class Azure
|
32
|
-
class Connection
|
33
|
-
include AzureAPI
|
34
|
-
include AzureUtility
|
35
|
-
attr_accessor :hosts, :rest, :images, :deploys, :roles,
|
36
|
-
:disks, :storageaccounts, :certificates, :ags, :vnets, :lbs
|
37
|
-
def initialize(params={})
|
38
|
-
@rest = Rest.new(params)
|
39
|
-
@hosts = Hosts.new(self)
|
40
|
-
@storageaccounts = StorageAccounts.new(self)
|
41
|
-
@images = Images.new(self)
|
42
|
-
@deploys = Deploys.new(self)
|
43
|
-
@roles = Roles.new(self)
|
44
|
-
@disks = Disks.new(self)
|
45
|
-
@certificates = Certificates.new(self)
|
46
|
-
@ags = AGs.new(self)
|
47
|
-
@vnets = Vnets.new(self)
|
48
|
-
@lbs = Loadbalancers.new(self)
|
49
|
-
end
|
50
|
-
|
51
|
-
def query_azure(service_name,
|
52
|
-
verb = 'get',
|
53
|
-
body = '',
|
54
|
-
params = '',
|
55
|
-
wait = true,
|
56
|
-
services = true)
|
57
|
-
Chef::Log.info 'calling ' + verb + ' ' + service_name + (wait ? " synchronously" : " asynchronously")
|
58
|
-
Chef::Log.debug body unless body == ''
|
59
|
-
response = @rest.query_azure(service_name, verb, body, params, services)
|
60
|
-
if response.code.to_i == 200
|
61
|
-
ret_val = Nokogiri::XML response.body
|
62
|
-
elsif !wait && response.code.to_i == 202
|
63
|
-
Chef::Log.debug 'Request accepted in asynchronous mode'
|
64
|
-
ret_val = Nokogiri::XML response.body
|
65
|
-
elsif response.code.to_i >= 201 && response.code.to_i <= 299
|
66
|
-
ret_val = wait_for_completion()
|
67
|
-
else
|
68
|
-
if response.body
|
69
|
-
ret_val = Nokogiri::XML response.body
|
70
|
-
Chef::Log.debug ret_val.to_xml
|
71
|
-
error_code, error_message = error_from_response_xml(ret_val)
|
72
|
-
Chef::Log.debug error_code + ' : ' + error_message if error_code.length > 0
|
73
|
-
else
|
74
|
-
Chef::Log.warn 'http error: ' + response.code
|
75
|
-
end
|
76
|
-
end
|
77
|
-
ret_val
|
78
|
-
end
|
79
|
-
def wait_for_completion()
|
80
|
-
status = 'InProgress'
|
81
|
-
Chef::Log.info 'Waiting while status returns InProgress'
|
82
|
-
while status == 'InProgress'
|
83
|
-
response = @rest.query_for_completion()
|
84
|
-
ret_val = Nokogiri::XML response.body
|
85
|
-
status = xml_content(ret_val,'Status')
|
86
|
-
if status == 'InProgress'
|
87
|
-
print '.'
|
88
|
-
sleep(0.5)
|
89
|
-
elsif status == 'Succeeded'
|
90
|
-
Chef::Log.debug 'not InProgress : ' + ret_val.to_xml
|
91
|
-
else
|
92
|
-
error_code, error_message = error_from_response_xml(ret_val)
|
93
|
-
Chef::Log.debug status + error_code + ' : ' + error_message if error_code.length > 0
|
94
|
-
end
|
95
|
-
end
|
96
|
-
ret_val
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|