chef-provisioning-azure 0.2 → 0.2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 66c8e132474e2a8b048de47d9bd622dffc4b5d6d
4
- data.tar.gz: 546d07efc616e3a0940d92858a4dc5070c56ee06
3
+ metadata.gz: 26141bfd34a60cbcca1f67c7ad5e812a680460a2
4
+ data.tar.gz: 83399cb5d0df2d81245787aaf2815b61dcd9a5c0
5
5
  SHA512:
6
- metadata.gz: ffccd9082ab50fca64d404bf2b9c46c8488831b6ce759b5beabb79c851c863403adc38d03c42aa2f55416ef504f1fe467273e947ec2017b3e8fa54fd35462882
7
- data.tar.gz: 1ed382128951f4a2100d0d1ddfe1e9c5b8addca62db91d42c8ee0f3644fda73220af3bef9f68b436d79372bf64b39d41884eee16635845b054f70a026c4ef388
6
+ metadata.gz: 563c5947d6cf351e69ef06591dba95d8d0b1ade40ad438a1347b9c228f8950096a57c526a8d08466a2bc245b8ec912e994e0694b9f2a46ec48bccf1303ea89ed
7
+ data.tar.gz: 1ac137365d67e200a3bee5a4594e78d855adb5085997e0bff8fbbf2414f746cdd01f5218ba86dbeef5fde2e911b3df4707250bd9ea8cf431c40917636ed46eef
@@ -82,22 +82,40 @@ module AzureDriver
82
82
 
83
83
  image_id = machine_options[:image_id] || default_image_for_location(location)
84
84
 
85
- params = {
86
- vm_name: machine_spec.name,
87
- vm_user: default_ssh_username,
88
- image: image_id,
89
- # This is only until SSH keys are added
90
- password: machine_options[:password],
91
- location: location
92
- }
93
-
94
85
  Chef::Log.debug "Azure bootstrap options: #{bootstrap_options.inspect}"
86
+
87
+ # If the cloud service exists already, need to add a role to it - otherwise create virtual machine (including cloud service)
88
+ cloud_service = azure_cloud_service_service.get_cloud_service(bootstrap_options[:cloud_service_name])
89
+
90
+ if cloud_service
91
+ action_handler.report_progress "Cloud Service #{bootstrap_options[:cloud_service_name]} already exists, adding role."
92
+ params = {
93
+ vm_name: machine_spec.name,
94
+ vm_user: default_ssh_username,
95
+ image: image_id,
96
+ # This is only until SSH keys are added
97
+ password: machine_options[:password],
98
+ cloud_service_name: bootstrap_options[:cloud_service_name]
99
+ }
100
+
101
+ action_handler.report_progress "Creating #{machine_spec.name} with image #{image_id} in #{bootstrap_options[:cloud_service_name]}..."
102
+ vm = azure_vm_service.add_role(params, bootstrap_options)
103
+ else
104
+ params = {
105
+ vm_name: machine_spec.name,
106
+ vm_user: default_ssh_username,
107
+ image: image_id,
108
+ # This is only until SSH keys are added
109
+ password: machine_options[:password],
110
+ location: location
111
+ }
112
+
113
+ action_handler.report_progress "Creating #{machine_spec.name} with image #{image_id} in #{location}..."
114
+ vm = azure_vm_service.create_virtual_machine(params, bootstrap_options)
115
+ end
95
116
 
96
- action_handler.report_progress "Creating #{machine_spec.name} with image #{image_id} in #{location}..."
97
- vm = azure_vm_service.create_virtual_machine(params, bootstrap_options)
98
117
  machine_spec.location['vm_name'] = vm.vm_name
99
- action_handler.report_progress "Created #{vm.vm_name} in #{location}..."
100
-
118
+ action_handler.report_progress "Created #{vm.vm_name} in #{location}..."
101
119
  end
102
120
 
103
121
  # (see Chef::Provisioning::Driver#ready_machine)
@@ -160,6 +178,10 @@ module AzureDriver
160
178
  @vm_service ||= Azure::VirtualMachineManagementService.new
161
179
  end
162
180
 
181
+ def azure_cloud_service_service
182
+ @cloud_service_service ||= Azure::CloudServiceManagementService.new
183
+ end
184
+
163
185
  def default_ssh_username
164
186
  'ubuntu'
165
187
  end
@@ -212,7 +234,10 @@ module AzureDriver
212
234
  remote_host = tcp_endpoint[:vip]
213
235
 
214
236
  # TODO: not this... replace with SSH key ASAP, only for getting this thing going...
215
- ssh_options = { password: machine_options[:password] }
237
+ ssh_options = {
238
+ password: machine_options[:password],
239
+ port: tcp_endpoint[:public_port] # use public port from Cloud Service endpoint
240
+ }
216
241
 
217
242
  options = {}
218
243
  options[:prefix] = 'sudo ' if machine_spec.location[:sudo] || username != 'root'
@@ -2,7 +2,7 @@
2
2
  class Chef
3
3
  module Provisioning
4
4
  module AzureDriver
5
- VERSION = '0.2'
5
+ VERSION = '0.2.1'
6
6
  end
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-provisioning-azure
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.2'
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Ewart
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-11 00:00:00.000000000 Z
11
+ date: 2015-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef