Skip to content
This repository was archived by the owner on Jan 30, 2021. It is now read-only.

Commit 12889e4

Browse files
committed
fix for config validation on custom images
1 parent 36cb07b commit 12889e4

File tree

6 files changed

+32
-32
lines changed

6 files changed

+32
-32
lines changed

Gemfile

+4-5
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,17 @@
22
# Copyright (c) Microsoft Corporation. All rights reserved.
33
# Licensed under the MIT License. See License in the project root for license information.
44

5-
source 'https://rubygems.org'
5+
source "https://rubygems.org"
66

77
gemspec
88

9-
group :development do
9+
group :development, :test do
1010
# We depend on Vagrant for development, but we don't add it as a
1111
# gem dependency because we expect to be installed within the
1212
# Vagrant environment itself using `vagrant plugin`.
13-
gem 'vagrant', git: 'https://github.com/mitchellh/vagrant.git'
14-
gem 'bundler', '~>1.10.5'
13+
gem "vagrant", git: "https://github.com/mitchellh/vagrant.git", tag: "v1.9.2"
1514
end
1615

1716
group :plugins do
18-
gem 'vagrant-azure', path: '.'
17+
gem "vagrant-azure", path: "."
1918
end

lib/vagrant-azure/config.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ def validate(machine)
252252
errors = _detected_errors
253253

254254
errors << I18n.t("vagrant_azure.custom_image_os_error") if !@vm_vhd_uri.nil? && (@vm_operating_system.nil? || @vm_vhd_storage_account_id.nil?)
255-
errors << I18n.t("vagrant_azure.vhd_and_managed_image_error") if !@vm_vhd_uri.nil? && !@vm_managed
255+
errors << I18n.t("vagrant_azure.vhd_and_managed_image_error") if !@vm_vhd_uri.nil? && !@vm_managed_image_id.nil?
256256
errors << I18n.t("vagrant_azure.manage_image_id_format_error") if !@vm_managed_image_id.nil? && !valid_image_id?(@vm_managed_image_id)
257257
# Azure connection properties related validation.
258258
errors << I18n.t('vagrant_azure.subscription_id.required') if @subscription_id.nil?

lib/vagrant-azure/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44

55
module VagrantPlugins
66
module Azure
7-
VERSION = '2.0.0.pre7'.freeze
7+
VERSION = '2.0.0.pre8'.freeze
88
end
99
end

templates/arm/deployment.json.erb

+24-23
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,13 @@
9696
},
9797
"resources": [
9898
<% if vhd_uri %>
99-
<%= VagrantPlugins::Azure::Util::TemplateRenderer.render("arm/resources/import_disk.json", {
100-
name: "[variables('managedOSDiskName')]",
101-
account_type: "[parameters('storageAccountType')]",
102-
os_type: "#{operating_system}",
103-
source_uri: "#{vhd_uri}",
104-
account_id: "#{vhd_stor_acct_id}"
105-
}) + "," %>
99+
<%= VagrantPlugins::Azure::Util::TemplateRenderer.render("arm/resources/import_disk.json", {
100+
name: "[variables('managedOSDiskName')]",
101+
account_type: "[parameters('storageAccountType')]",
102+
os_type: "#{operating_system}",
103+
source_uri: "#{vhd_uri}",
104+
account_id: "#{vhd_stor_acct_id}"
105+
}) + "," %>
106106
<% end %>
107107
<%= VagrantPlugins::Azure::Util::TemplateRenderer.render("arm/resources/network_security_group.json", self) + "," %>
108108
<%= VagrantPlugins::Azure::Util::TemplateRenderer.render("arm/resources/public_ip_address.json", self) + "," %>
@@ -113,32 +113,33 @@
113113
<% end %>
114114

115115
<% if vhd_uri && operating_system == "Linux" %>
116-
<%= VagrantPlugins::Azure::Util::TemplateRenderer.render("arm/resources/linux_reset_root_ext.json",
117-
{
118-
name: "[concat(parameters('vmName'), '/linuxResetUserExt')]",
119-
depends_on: ["[concat('Microsoft.Compute/virtualMachines/', parameters('vmName'))]"],
120-
ssh_key: "[parameters('sshKeyData')]",
121-
username: "[parameters('adminUserName')]"
122-
}) + ", "
123-
%>
116+
<%= VagrantPlugins::Azure::Util::TemplateRenderer.render("arm/resources/linux_reset_root_ext.json",
117+
{
118+
name: "[concat(parameters('vmName'), '/linuxResetUserExt')]",
119+
depends_on: ["[concat('Microsoft.Compute/virtualMachines/', parameters('vmName'))]"],
120+
ssh_key: "[parameters('sshKeyData')]",
121+
username: "[parameters('adminUserName')]"
122+
}) + ", "
123+
%>
124124
<% end %>
125125

126126
<% if vhd_uri && operating_system == "Windows" %>
127-
<%= VagrantPlugins::Azure::Util::TemplateRenderer.render("arm/resources/windows_reset_access_ext.json",
128-
{
129-
name: "[concat(parameters('vmName'), '/windowsResetUserExt')]",
130-
depends_on: ["[concat('Microsoft.Compute/virtualMachines/', parameters('vmName'))]"],
131-
password: "[parameters('adminPassword')]",
132-
username: "[parameters('adminUserName')]"
133-
}) + ", "
134-
%>
127+
<%= VagrantPlugins::Azure::Util::TemplateRenderer.render("arm/resources/windows_reset_access_ext.json",
128+
{
129+
name: "[concat(parameters('vmName'), '/windowsResetUserExt')]",
130+
depends_on: ["[concat('Microsoft.Compute/virtualMachines/', parameters('vmName'))]"],
131+
password: "[parameters('adminPassword')]",
132+
username: "[parameters('adminUserName')]"
133+
}) + ", "
134+
%>
135135
<% end %>
136136

137137
<%
138138
vm_dependencies = ["[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]"]
139139
if availability_set_name
140140
vm_dependencies.push("[resourceId('Microsoft.Compute/availabilitySets', '#{availability_set_name}')")
141141
end
142+
142143
if vhd_uri
143144
vm_dependencies.push("[resourceId('Microsoft.Compute/disks', variables('managedOSDiskName'))]")
144145
end

templates/arm/resources/linux_reset_root_ext.json.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"properties": {
1010
"publisher": "Microsoft.OSTCExtensions",
1111
"type": "VMAccessForLinux",
12-
"typeHandlerVersion": "1.*",
12+
"typeHandlerVersion": "1.4",
1313
"autoUpgradeMinorVersion": true,
1414
"protectedSettings": {
1515
"ssh_key": "<%= ssh_key %>",

vagrant-azure.gemspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
2626
s.add_runtime_dependency 'haikunator', '~>1.1'
2727
s.add_runtime_dependency 'highline', '~>1.7'
2828

29-
s.add_development_dependency 'bundler', '~>1.9'
29+
s.add_development_dependency 'bundler', '~>1.10.5'
3030
s.add_development_dependency 'rake', '~>11.1'
3131
s.add_development_dependency 'rspec', '~>3.4'
3232
s.add_development_dependency 'simplecov', '~>0.11'

0 commit comments

Comments
 (0)