chef-provisioning-azurerm 0.3.2 → 0.3.3

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: e622074ff9caf91886b46f9ed52ea099edbe0a6a
4
- data.tar.gz: 6a1295a76fda9698d7c7ee3a42c8b1492e621d8c
3
+ metadata.gz: 1697bfb9e31a3888825aee530b6134658ff7d339
4
+ data.tar.gz: 14b14b09738db36a036bc8533cc812a7740368a2
5
5
  SHA512:
6
- metadata.gz: af8e73f71ed1882a3c760101a55a4ed4cb91b5985edc7d60be0ede524c25a5d2afcef7e699b20059e67029e3cdc780221f6007ef98c2f84f9d4434db55c98fdd
7
- data.tar.gz: a7ca2425c44dcf520bd37a564a5d015a7ac7e2e36c4d058138f3b11ae1fa06384c899a05a53176312383d7f47d7d73c03e37a3939ae4ad70a5e07d776541d006
6
+ metadata.gz: f1085bcb5393a4fc41624ff15d6846012e10ef15d3faf834730d92642ec55c6d2a53b500857e46a3500f7eca38f187b5d64f040e12d506438435cc0ab8d49025
7
+ data.tar.gz: 5f785c089b359b3fb7306886d091b23831fa60d5920eb3a25ce88a90a2dbe5cd298d2bf8f2274dc3333e32e64787d7296cc61896c7b55e07d3476fd310bb9162
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # chef-provisioning-azurerm Changelog
2
2
 
3
+ ## [0.3.3] - 2016-01-25
4
+ - Raise AzureOperationError into log (@stuartpreston)
5
+ - Fix#6 VM extension JSON not formatted correctly (@andrewelizondo)
6
+
3
7
  ## [0.3.2] - 2015-10-07
4
8
  ### Changed
5
9
  - References to Azure SDK updated, supports Linux
data/README.md CHANGED
@@ -52,7 +52,6 @@ Note that the environment variables, if set, take preference over the values in
52
52
  Unlike a fully-featured **chef-provisioning** driver that fully utilises the **machine**, **machine_batch**, **machine_image** and **load_balancer** resources, the **chef-provisioning-azurerm** driver offers a lightweight way to interact with resources and providers in the Azure Resource Manager framework directly.
53
53
 
54
54
  To work around the issue of storing chef-provisioning driver info in the Chef server:
55
- - Any Azure Resource Manager (ARM) templates sent for deployment that contain a resource of type 'Microsoft.Compute/virtualMachine' or 'Microsoft.ClassicCompute/virtualMachine' will automatically have the Chef VM extension added (unless overridden with **install_vm_extension: false**)
56
55
  - The Chef VM extension will automatically be configured to point at the same Chef server as the provisioning node. This can be overridden in a recipe by using the following line: ```with_chef_server 'http://your.chef.server.url/yourorg'```
57
56
 
58
57
  The following resources are provided:
@@ -101,7 +101,7 @@ class Chef
101
101
 
102
102
  nic_properties.dns_settings = create_network_interface_dns_settings(dns_servers) if dns_servers
103
103
 
104
- ip_config = create_network_interface_ip_configuration("#{interface_name}-ipconfig", private_ip_type, private_ip, subnet_ref, public_ip_ref)
104
+ ip_config = create_network_interface_ip_configuration("#{interface_name}-ipconfig", private_ip_type, private_ip, subnet_ref, public_ip_ref)
105
105
  nic_properties.ip_configurations = [ip_config]
106
106
 
107
107
  nic_properties
@@ -117,7 +117,7 @@ class Chef
117
117
  ip_config = Azure::ARM::Network::Models::NetworkInterfaceIpConfiguration.new
118
118
  ip_config.name = ipconfig_name
119
119
  ip_config.properties = Azure::ARM::Network::Models::NetworkInterfaceIpConfigurationPropertiesFormat.new
120
- ip_config.properties.private_ipallocation_method = private_ip_type if private_ip_type
120
+ ip_config.properties.private_ipallocation_method = private_ip_type if private_ip_type
121
121
  ip_config.properties.private_ipaddress = private_ip if private_ip
122
122
 
123
123
  if subnet_ref
@@ -127,14 +127,14 @@ class Chef
127
127
 
128
128
  if public_ip_ref
129
129
  ip_config.properties.public_ipaddress = Azure::ARM::Network::Models::PublicIpAddress.new
130
- ip_config.properties.public_ipaddress.id = public_ip_ref
130
+ ip_config.properties.public_ipaddress.id = public_ip_ref
131
131
  end
132
132
 
133
133
  ip_config
134
134
  end
135
135
 
136
136
  def get_public_ip(resource_group, resource_name)
137
- result = try_azure_operation('getting public IP') do
137
+ result = try_azure_operation('getting public IP') do
138
138
  network_management_client.public_ip_addresses.get(resource_group, resource_name).value!
139
139
  end
140
140
 
@@ -147,7 +147,7 @@ class Chef
147
147
  return nil if v.nil? || v.empty?
148
148
  end
149
149
 
150
- result = try_azure_operation('getting subnet') do
150
+ result = try_azure_operation('getting subnet') do
151
151
  network_management_client.subnets.get(resource_group_name, vnet_name, subnet_name).value!
152
152
  end
153
153
  subnet = result.body
@@ -11,11 +11,16 @@ class Chef
11
11
 
12
12
  action :create do
13
13
  converge_by("create or update Resource Group #{new_resource.name}") do
14
- resource_group = Azure::ARM::Resources::Models::ResourceGroup.new
15
- resource_group.location = new_resource.location
16
- resource_group.tags = new_resource.tags
17
- result = resource_management_client.resource_groups.create_or_update(new_resource.name, resource_group).value!
18
- Chef::Log.debug("result: #{result.body.inspect}")
14
+ begin
15
+ resource_group = Azure::ARM::Resources::Models::ResourceGroup.new
16
+ resource_group.location = new_resource.location
17
+ resource_group.tags = new_resource.tags
18
+ result = resource_management_client.resource_groups.create_or_update(new_resource.name, resource_group).value!
19
+ Chef::Log.debug("result: #{result.body.inspect}")
20
+ rescue ::MsRestAzure::AzureOperationError => operation_error
21
+ Chef::Log.error operation_error.body['error']
22
+ raise "#{operation_error.body['error']['code']}: #{operation_error.body['error']['message']}"
23
+ end
19
24
  end
20
25
  end
21
26
 
@@ -11,10 +11,15 @@ class Chef
11
11
 
12
12
  action :deploy do
13
13
  converge_by("deploy or re-deploy Resource Manager template '#{new_resource.name}'") do
14
- result = resource_management_client.deployments.create_or_update(new_resource.resource_group, new_resource.name, deployment).value!
15
- action_handler.report_progress "Result: #{result.body.properties.provisioning_state}"
16
- Chef::Log.debug("result: #{result.body.inspect}")
17
- follow_deployment_until_end_state
14
+ begin
15
+ result = resource_management_client.deployments.create_or_update(new_resource.resource_group, new_resource.name, deployment).value!
16
+ action_handler.report_progress "Result: #{result.body.properties.provisioning_state}"
17
+ Chef::Log.debug("result: #{result.body.inspect}")
18
+ follow_deployment_until_end_state
19
+ rescue ::MsRestAzure::AzureOperationError => operation_error
20
+ Chef::Log.error operation_error.body['error']
21
+ raise "#{operation_error.body['error']['code']}: #{operation_error.body['error']['message']}"
22
+ end
18
23
  end
19
24
  end
20
25
 
@@ -53,6 +58,7 @@ class Chef
53
58
  chef_server_url = Chef::Config[:chef_server_url]
54
59
  validation_client_name = Chef::Config[:validation_client_name]
55
60
  validation_key_content = ::File.read(Chef::Config[:validation_key])
61
+ machine_name = "\'#{machine_name}\'" unless machine_name[0] == '['
56
62
  <<-EOH
57
63
  {
58
64
  "type": "Microsoft.Compute/virtualMachines/extensions",
@@ -1,7 +1,7 @@
1
1
  class Chef
2
2
  module Provisioning
3
3
  module AzureRM
4
- VERSION = '0.3.2'
4
+ VERSION = '0.3.3'
5
5
  end
6
6
  end
7
7
  end
@@ -30,7 +30,7 @@ class Chef
30
30
  attr_reader :public_ip_resource
31
31
 
32
32
  def public_ip(resource_name, &resource_block)
33
- @public_ip_resource = Chef::Resource::AzurePublicIPAddress.new(resource_name.to_s, run_context)
33
+ @public_ip_resource = Chef::Resource::AzurePublicIPAddress.new(resource_name.to_s, run_context)
34
34
  @public_ip_resource.action :nothing
35
35
  @public_ip_resource.instance_eval(&resource_block)
36
36
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-provisioning-azurerm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stuart Preston
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-07 00:00:00.000000000 Z
11
+ date: 2016-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef