vagrant-azure 1.0.4 → 1.0.5

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: 885a96873ff590a63735e07f52d4fbd602055b06
4
- data.tar.gz: 65557e9414515c416956099c4145f073cab3afb4
3
+ metadata.gz: 3ff18ded26dfcf360b2196fefb6bd6bb1087d31c
4
+ data.tar.gz: 8c4370e04cef532293974872031134782d7982ad
5
5
  SHA512:
6
- metadata.gz: 2dc3dac70cd18050d7ab10382b0645fe6614b9e3d27b7965c55ff2b3c3fa7f81ed89d39c2801d83908df9fa9e18519cec7e6e7070d78fe972ceeceb5606b6674
7
- data.tar.gz: a5163475ec6352837905e1504cb92afc8a81a98c4d1c8a23fdfd9e379fc2811b08d7230198fdef21c90fe0c0f9bbfee04ae95aaa77306a6f242974a9f7861bd9
6
+ metadata.gz: 6e7ab67815f88b544c06adf06e628ee8b313d3b56d59485e37715ead164d1e46e623116f5e5652beb2f97f99a7b11ee7c5b1641bbb7e8d78b3a4b1745c7847e0
7
+ data.tar.gz: 0c81f4fd18ca74603c2763ca42befb69538ddc323da48f09fb103f0764b12192de434d1d099926d0eada06259fff8ed2bc8752cd7e207213d1e20026080f81a5
data/.gitignore CHANGED
@@ -8,7 +8,7 @@ Vagrantfile
8
8
  babu
9
9
  example_box/
10
10
  *.rdp
11
- pkg/
11
+ pkg/*
12
12
  gem/
13
13
  manifests/
14
14
  modules/
data/CHANGELOG.md ADDED
@@ -0,0 +1,24 @@
1
+ ## 1.0.5 (Unreleased)
2
+
3
+ FEATURES
4
+
5
+ - Provision for windows VM.
6
+ - Windows VM has to be specifically mentioned in the Vagrantfile with
7
+ `config.vm.guest = :windows`
8
+ - Chef, Puppet and Shell provision for Linux and Windows VM.
9
+ - **SyncedFolders**
10
+ - Linux VM uses `rsync` and has be mentioned in the VagrantFile.
11
+ - Windows VM will default to use PowerShell to copy files.
12
+
13
+ IMPROVEMENTS
14
+
15
+ - Better exception handling when VM fails to get created in cloud.
16
+ - Better exception handling for WinRM session errors.
17
+
18
+ BUGFIXES
19
+
20
+ - Cleaned up few typo in README
21
+ - Compatible with Vagrant 1.6 [GH-15]
22
+
23
+ ## Previous
24
+ See git commits
data/Gemfile CHANGED
@@ -13,7 +13,3 @@ group :development do
13
13
  # Vagrant environment itself using `vagrant plugin`.
14
14
  gem "vagrant", :git => "git://github.com/mitchellh/vagrant.git"
15
15
  end
16
-
17
- group :plugins do
18
- gem 'vagrant-azure', path: '.'
19
- end
data/README.md CHANGED
@@ -3,8 +3,7 @@
3
3
  ![Gem Version](https://badge.fury.io/rb/vagrant-azure.png)
4
4
 
5
5
  This is a [Vagrant](http://www.vagrantup.com) 1.5.2+ plugin that adds [Windows Azure](https://www.windowsazure.com)
6
- provider to Vagrant, allowing Vagrant to control and provision machines in
7
- Windows Azure.
6
+ provider to Vagrant, allowing Vagrant to control and provision machines in Windows Azure.
8
7
 
9
8
  **NOTE:** This plugin requires Vagrant 1.5.2+,
10
9
 
@@ -12,7 +11,7 @@ Windows Azure.
12
11
 
13
12
  Install Vagrant 1.5.2 or higher - [Download Vagrant](http://www.vagrantup.com/downloads.html)
14
13
 
15
- Install the vagrant-azure plugin using the standarn Vagrant 1.1+ installation methods. After installing the plugin, you can you can ```vagrant up``` and use ```azure``` provider. For example:
14
+ Install the vagrant-azure plugin using the standard Vagrant 1.1+ installation methods. After installing the plugin, you can you can ```vagrant up``` and use ```azure``` provider. For example:
16
15
 
17
16
  ```
18
17
  C:\> vagrant plugin install vagrant-azure
@@ -25,7 +24,7 @@ You'll need an ```azure``` box before you can do ```vagrant up``` though.
25
24
 
26
25
  ## Quick Start
27
26
 
28
- You can use the dummy box and specify all the required details manually in the ```confiv.vm.provider``` block in your ```Vagrantfile```. Add the dummy box with the name you want:
27
+ You can use the dummy box and specify all the required details manually in the ```config.vm.provider``` block in your ```Vagrantfile```. Add the dummy box with the name you want:
29
28
 
30
29
  ```
31
30
  C:\> vagrant box add azure https://github.com/msopentech/vagrant-azure/raw/master/dummy.box
@@ -42,8 +41,9 @@ Vagrant.configure('2') do |config|
42
41
  azure.mgmt_certificate = 'YOUR AZURE MANAGEMENT CERTIFICATE'
43
42
  azure.mgmt_endpoint = 'https://management.core.windows.net'
44
43
  azure.subscription_id = 'YOUR AZURE SUBSCRIPTION ID'
45
- auzre.storage_acct_name = 'NAME OF YOUR STORAGE ACCOUNT' # optional. A new one will be generated if not provided.
44
+ azure.storage_acct_name = 'NAME OF YOUR STORAGE ACCOUNT' # optional. A new one will be generated if not provided.
46
45
 
46
+ azure.vm_image = 'NAME OF THE IMAGE TO USE'
47
47
  azure.vm_user = 'PROVIDE A USERNAME' # defaults to 'vagrant' if not provided
48
48
  azure.vm_password = 'PROVIDE A VALID PASSWORD' # min 8 characters. should contain a lower case letter, an uppercase letter, a number and a special character
49
49
 
@@ -66,7 +66,7 @@ Vagrant.configure('2') do |config|
66
66
  end
67
67
 
68
68
  config.ssh.username = 'YOUR USERNAME' # the one used to create the VM
69
- config.ssh.password = 'YOUR PASSOWRD' # the one used to create the VM
69
+ config.ssh.password = 'YOUR PASSWORD' # the one used to create the VM
70
70
  end
71
71
  ```
72
72
 
@@ -97,7 +97,8 @@ The vagrant-azure provide exposes a few Azure specific configration options:
97
97
  * `subscription_id` - Your Azure Subscription ID.
98
98
  * `storage_acct_name` - The Storage account to use when creating VMs.
99
99
  * `vm_user` - The username to create the VM with. Defaults to `vagrant`.
100
- * `vm_password`- The password to set for the user created with the VM.
100
+ * `vm_password` - The password to set for the user created with the VM.
101
+ * `vm_image` - The name of the image to be used when creating the VM.
101
102
  * `vm_name` - The name of the created VM.
102
103
  * `vm_size` - The size of the created VM.
103
104
  * `cloud_service_name` - The name of the cloud service under which to create the VM.
@@ -13,3 +13,17 @@ $ tar cvzf azure.box ./metadata.json ./Vagrantfile
13
13
  ```
14
14
 
15
15
  You can add any defaults supported by the ```azure``` provider to the `Vagrantfile` in your box and Vagrant's built-in merging system will set them as defaults. Users can override these defaults in their own Vagrantfiles.
16
+
17
+ You can specify the image to be used for the VM here via the ```vm_image``` option. E.g.,
18
+
19
+ ```ruby
20
+ Vagrant.configure('2') do |config|
21
+ config.vm.box = 'azure'
22
+
23
+ config.vm.provider :azure do |azure|
24
+ azure.vm_image = 'NAME OF THE IMAGE TO USE'
25
+ end
26
+ end
27
+ ```
28
+
29
+ See also: [`Get-AzureVMImage`](http://msdn.microsoft.com/en-us/library/azure/dn495275.aspx)
data/lib/vagrant-azure.rb CHANGED
@@ -9,13 +9,20 @@ module VagrantPlugins
9
9
  module WinAzure
10
10
  lib_path = Pathname.new(File.expand_path('../vagrant-azure', __FILE__))
11
11
  autoload :Action, lib_path.join('action')
12
- autoload :Error, lib_path.join('errors')
12
+ autoload :Errors, lib_path.join('errors')
13
13
  autoload :Driver, lib_path.join('driver')
14
14
 
15
+ # Load a communicator for Windows guest
16
+ require lib_path.join("communication/powershell")
17
+
15
18
  require lib_path.join('provisioner/puppet')
16
19
  require lib_path.join('provisioner/chef-solo')
17
20
  require lib_path.join('provisioner/shell')
18
21
 
22
+ monkey_patch = Pathname.new(File.expand_path("../vagrant-azure/monkey_patch", __FILE__))
23
+ # Monkey Patch the core Hyper-V vagrant with the following
24
+ require monkey_patch.join("machine")
25
+
19
26
  # This returns the path to the source of this plugin.
20
27
  #
21
28
  # @return [Pathname]
@@ -65,14 +65,12 @@ module VagrantPlugins
65
65
  b2.use Message, I18n.t('vagrant_azure.not_created')
66
66
  next
67
67
  end
68
-
69
68
  b2.use Provision
70
- # b2.use SyncFolders
71
69
  end
72
70
  end
73
71
  end
74
72
 
75
- # This action is called to read the SSH info of the machine. The
73
+ # This action is called to read the SSH info of the machine. The
76
74
  # resulting state is expected to be put into the `:machine_ssh_info` key.
77
75
  def self.action_read_ssh_info
78
76
  Vagrant::Action::Builder.new.tap do |b|
@@ -158,32 +156,33 @@ module VagrantPlugins
158
156
 
159
157
  def self.action_prepare_boot
160
158
  Vagrant::Action::Builder.new.tap do |b|
161
- b.use Provision
162
- # b.use SyncFolders
163
- # b.use WarnNetworks
159
+ b.use Call, WaitForState, :ReadyRole do |env, b1|
160
+ if env[:result]
161
+ env[:machine].id =~ /@/
162
+ b1.use Message, I18n.t(
163
+ 'vagrant_azure.vm_started', :name => $`
164
+ )
165
+ b1.use WaitForCommunicate
166
+ b1.use Provision
167
+ b1.use SyncFolders
168
+ end
169
+ end
164
170
  end
165
171
  end
166
172
 
167
173
  # This action is called to bring the box up from nothing
168
174
  def self.action_up
169
175
  Vagrant::Action::Builder.new.tap do |b|
170
- b.use HandleBoxUrl
176
+ b.use HandleBox
171
177
  b.use ConfigValidate
172
178
  b.use ConnectAzure
179
+
173
180
  b.use Call, IsState, :NotCreated do |env1, b1|
174
181
  if !env1[:result]
175
182
  b1.use Call, IsState, :StoppedDeallocated do |env2, b2|
176
183
  if env2[:result]
177
- b2.use action_prepare_boot
178
184
  b2.use StartInstance # start this instance again
179
- b2.use Call, WaitForState, :ReadyRole do |env3, b3|
180
- if env3[:result]
181
- env3[:machine].id =~ /@/
182
- b3.use Message, I18n.t(
183
- 'vagrant_azure.vm_started', :name => $`
184
- )
185
- end
186
- end
185
+ b2.use action_prepare_boot
187
186
  else
188
187
  b2.use Message, I18n.t(
189
188
  'vagrant_azure.already_status', :status => 'created'
@@ -192,14 +191,7 @@ module VagrantPlugins
192
191
  end
193
192
  else
194
193
  b1.use RunInstance # Launch a new instance
195
- b1.use Call, WaitForState, :ReadyRole do |env2, b2|
196
- if env2[:result]
197
- env2[:machine].id =~ /@/
198
- b2.use Message, I18n.t(
199
- 'vagrant_azure.vm_started', :name => $`
200
- )
201
- end
202
- end
194
+ b1.use action_prepare_boot
203
195
  end
204
196
  end
205
197
  end
@@ -240,11 +232,12 @@ module VagrantPlugins
240
232
  autoload :RunInstance, action_root.join('run_instance')
241
233
  autoload :StartInstance, action_root.join('start_instance')
242
234
  autoload :StopInstance, action_root.join('stop_instance')
243
- # autoload :SyncFolders, action_root.join('sync_folders')
235
+ autoload :SyncFolders, action_root.join('sync_folders')
244
236
  autoload :TerminateInstance, action_root.join('terminate_instance')
245
237
  # autoload :TimedProvision, action_root.join('timed_provision')
246
238
  # autoload :WarnNetworks, action_root.join('warn_networks')
247
239
  autoload :WaitForState, action_root.join('wait_for_state')
240
+ autoload :WaitForCommunicate, action_root.join('wait_for_communicate')
248
241
  end
249
242
  end
250
243
  end
@@ -5,6 +5,11 @@
5
5
  require 'azure'
6
6
  require 'log4r'
7
7
 
8
+ # FIXME:
9
+ # This is a required to patch few exception handling which are not done in
10
+ # Azure Ruby SDK
11
+ require_relative "vagrant_azure_service"
12
+
8
13
  module VagrantPlugins
9
14
  module WinAzure
10
15
  module Action
@@ -17,11 +22,6 @@ module VagrantPlugins
17
22
  def call (env)
18
23
  config = env[:machine].provider_config
19
24
 
20
- env[:ui].warn "Subscription ID: [#{config.subscription_id}]"
21
- env[:ui].warn "Mangement Certificate: [#{config.mgmt_certificate}]"
22
- env[:ui].warn "Mangement Endpoint: [#{config.mgmt_endpoint}]"
23
- env[:ui].warn "Storage Account Name: [#{config.storage_acct_name}]"
24
-
25
25
  Azure.configure do |c|
26
26
  c.subscription_id = config.subscription_id
27
27
  c.management_certificate = config.mgmt_certificate
@@ -30,7 +30,13 @@ module VagrantPlugins
30
30
  c.storage_access_key = config.storage_access_key
31
31
  end
32
32
 
33
- env[:azure_vm_service] = Azure::VirtualMachineManagementService.new
33
+ # FIXME:
34
+ # Defining a new class VagrantAzureService
35
+ # Here we call the native azure virtual machine management service method
36
+ # and add some exception handling.
37
+ # Remove this once the Azure SDK adds the exception handling for the
38
+ # methods defined in VagrantAzureService
39
+ env[:azure_vm_service] = VagrantAzureService.new(Azure::VirtualMachineManagementService.new)
34
40
 
35
41
  @app.call(env)
36
42
  end
@@ -94,11 +94,15 @@ module VagrantPlugins
94
94
  params, options, add_role
95
95
  )
96
96
 
97
- # TODO: Exception/Error Handling
97
+ if server.nil?
98
+ raise Errors::CreateVMFailure
99
+ end
100
+
101
+ # The Ruby SDK returns any exception encountered on create virtual
102
+ # machine as a string.
98
103
 
99
104
  if server.instance_of? String
100
- env[:ui].info "Server not created. Error is: #{server}"
101
- raise "#{server}"
105
+ raise Errors::ServerNotCreated, message: server
102
106
  end
103
107
 
104
108
  env[:machine].id = "#{server.vm_name}@#{server.cloud_service_name}"
@@ -0,0 +1,63 @@
1
+ # Copyright (c) 2014 Mitchell Hashimoto
2
+ # Under The MIT License (MIT)
3
+ #---------------------------------------------------------------------------
4
+ # Copyright (c) Microsoft Open Technologies, Inc.
5
+ # All Rights Reserved. Licensed under the Apache 2.0 License.
6
+ #--------------------------------------------------------------------------
7
+ require "log4r"
8
+ require "vagrant/util/subprocess"
9
+ require "vagrant/util/scoped_hash_override"
10
+ require "vagrant/util/which"
11
+ require "#{Vagrant::source_root}/lib/vagrant/action/builtin/synced_folders"
12
+
13
+ module VagrantPlugins
14
+ module WinAzure
15
+ module Action
16
+ # This middleware uses `rsync` to sync the folders
17
+ class SyncFolders < Vagrant::Action::Builtin::SyncedFolders
18
+ include Vagrant::Util::ScopedHashOverride
19
+
20
+ def initialize(app, env)
21
+ @app = app
22
+ @logger = Log4r::Logger.new("vagrant_azure::action::sync_folders")
23
+ end
24
+
25
+ def call(env)
26
+ if env[:machine].config.vm.guest != :windows
27
+ super
28
+ else
29
+ @app.call(env)
30
+ env[:machine].config.vm.synced_folders.each do |id, data|
31
+ data = scoped_hash_override(data, :azure)
32
+
33
+ # Ignore disabled shared folders
34
+ next if data[:disabled]
35
+
36
+ hostpath = File.expand_path(data[:hostpath], env[:root_path])
37
+ guestpath = data[:guestpath]
38
+
39
+ env[:ui].info(I18n.t("vagrant_azure.copy_folder",
40
+ :hostpath => hostpath,
41
+ :guestpath => guestpath))
42
+
43
+ # Create the host path if it doesn't exist and option flag is set
44
+ if data[:create]
45
+ begin
46
+ FileUtils::mkdir_p(hostpath)
47
+ rescue => err
48
+ raise Errors::MkdirError,
49
+ :hostpath => hostpath,
50
+ :err => err
51
+ end
52
+ end
53
+
54
+ env[:machine].provider.driver.upload(hostpath, guestpath)
55
+
56
+ end
57
+ end
58
+ end
59
+
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,43 @@
1
+ #---------------------------------------------------------------------------
2
+ # Copyright (c) Microsoft Open Technologies, Inc.
3
+ # All Rights Reserved. Licensed under the Apache 2.0 License.
4
+ #--------------------------------------------------------------------------
5
+ # FIXME:
6
+ # This is a stop gap arrangement until the azure ruby SDK fixes the exceptions
7
+ # and gracefully fails.
8
+
9
+ module VagrantPlugins
10
+ module WinAzure
11
+ module Action
12
+ class VagrantAzureService
13
+ attr_reader :azure
14
+ def initialize(azure)
15
+ @azure = azure
16
+ end
17
+
18
+ # At times due to network latency the SDK raises SocketError, this can
19
+ # be rescued and re-try for three attempts.
20
+ def get_virtual_machine(*args)
21
+ vm = nil
22
+ attempt = 0
23
+ while true
24
+ begin
25
+ vm = azure.get_virtual_machine(*args)
26
+ rescue SocketError
27
+ attempt = attempt + 1
28
+ sleep 5
29
+ next if attempt < 3
30
+ end
31
+ break
32
+ end
33
+ vm
34
+ end
35
+
36
+ def method_missing(method, *args, &block)
37
+ azure.send(method, *args, &block)
38
+ end
39
+
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,38 @@
1
+ #--------------------------------------------------------------------------
2
+ # Copyright (c) Microsoft Open Technologies, Inc.
3
+ # All Rights Reserved. Licensed under the Apache 2.0 License.
4
+ #--------------------------------------------------------------------------
5
+ require 'log4r'
6
+ require 'timeout'
7
+
8
+ module VagrantPlugins
9
+ module WinAzure
10
+ module Action
11
+ class WaitForCommunicate
12
+ def initialize(app, env)
13
+ @app = app
14
+ @logger = Log4r::Logger.new("vagrant_azure::action::wait_for_communicate")
15
+ end
16
+
17
+ def call(env)
18
+
19
+ if !env[:interrupted]
20
+ # Wait for SSH to be ready.
21
+ env[:ui].info(I18n.t("vagrant_azure.waiting_for_ssh"))
22
+ while true
23
+ # If we're interrupted then just back out
24
+ break if env[:interrupted]
25
+ break if env[:machine].communicate.ready?
26
+ sleep 5
27
+ end
28
+
29
+ # Ready and booted!
30
+ env[:ui].info(I18n.t("vagrant_azure.ssh_ready"))
31
+ end
32
+
33
+ @app.call(env)
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,41 @@
1
+ #-------------------------------------------------------------------------
2
+ # Copyright (c) Microsoft Open Technologies, Inc.
3
+ # All Rights Reserved. Licensed under the Apache 2.0 License.
4
+ #--------------------------------------------------------------------------
5
+
6
+ module VagrantPlugins
7
+ module WinAzure
8
+ module Communicator
9
+ class PowerShell < Vagrant.plugin("2", :communicator)
10
+ def initialize(machine)
11
+ @machine = machine
12
+ end
13
+
14
+ def wait_for_ready(timeout)
15
+ ready?
16
+ end
17
+
18
+ def ready?
19
+ # Return True when the guest has enabled WinRM
20
+ # In this case we can try any remote PowerShell commands to see if
21
+ # further vagrant can be carried out using this communication
22
+ if !@winrm_status
23
+ status = false
24
+ response = @machine.provider.driver.check_winrm
25
+ message = nil
26
+ if response && response["message"]
27
+ message = response["message"]
28
+ @winrm_status = message == "Running"
29
+ end
30
+ raise Errors::WinRMNotReady, message: message if !@winrm_status
31
+ end
32
+ @winrm_status
33
+ end
34
+
35
+ def test(command, opts=nil)
36
+ true
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -96,7 +96,7 @@ module VagrantPlugins
96
96
 
97
97
  @state_read_timeout = 360 if @state_read_timeout == UNSET_VALUE
98
98
 
99
- # This done due to a bug in Ruby SDK - it doesn't generate a storage
99
+ # This done due to a bug in Ruby SDK - it doesn't generate a storage
100
100
  # account name if add_role = true
101
101
  if @storage_acct_name.nil? || @storage_acct_name.empty?
102
102
  @storage_acct_name = Azure::Core::Utility.random_string(
@@ -119,7 +119,7 @@ module VagrantPlugins
119
119
  self.mgmt_endpoint
120
120
  result.subscription_id = other.subscription_id || \
121
121
  self.subscription_id
122
- result.storage_account_name = other.storage_acct_name || \
122
+ result.storage_acct_name = other.storage_acct_name || \
123
123
  self.storage_acct_name
124
124
  result.storage_access_key = other.storage_access_key || \
125
125
  self.storage_access_key
@@ -60,6 +60,11 @@ module VagrantPlugins
60
60
  execute(script_path, options)
61
61
  end
62
62
 
63
+ def check_winrm
64
+ script_path = local_script_path('check_winrm.ps1')
65
+ execute(script_path, remote_credentials)
66
+ end
67
+
63
68
  protected
64
69
 
65
70
  def local_script_path(path)
@@ -0,0 +1,27 @@
1
+ #-------------------------------------------------------------------------
2
+ # Copyright (c) Microsoft Open Technologies, Inc.
3
+ # All Rights Reserved. Licensed under the Apache 2.0 License.
4
+ #--------------------------------------------------------------------------
5
+
6
+ module VagrantPlugins
7
+ module WinAzure
8
+ module Errors
9
+ class WinAzureError < Vagrant::Errors::VagrantError
10
+ error_namespace("vagrant_azure.errors")
11
+ end
12
+
13
+ class WinRMNotReady < WinAzureError
14
+ error_key(:win_rm_not_ready)
15
+ end
16
+
17
+ class ServerNotCreated < WinAzureError
18
+ error_key(:server_not_created)
19
+ end
20
+
21
+ class CreateVMFailure < WinAzureError
22
+ error_key(:create_vm_failure)
23
+ end
24
+
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,22 @@
1
+ #-------------------------------------------------------------------------
2
+ # Copyright (c) Microsoft Open Technologies, Inc.
3
+ # All Rights Reserved. Licensed under the Apache 2.0 License.
4
+ #--------------------------------------------------------------------------
5
+
6
+ module Vagrant
7
+ class Machine
8
+
9
+ ssh_communicate = instance_method(:communicate)
10
+
11
+ define_method(:communicate) do
12
+ unless @communicator
13
+ if @config.vm.guest == :windows
14
+ @communicator = VagrantPlugins::WinAzure::Communicator::PowerShell.new(self)
15
+ else
16
+ @communicator = ssh_communicate.bind(self).()
17
+ end
18
+ end
19
+ @communicator
20
+ end
21
+ end
22
+ end
@@ -2,10 +2,12 @@
2
2
  # Copyright (c) Microsoft Open Technologies, Inc.
3
3
  # All Rights Reserved. Licensed under the Apache 2.0 License.
4
4
  #--------------------------------------------------------------------------
5
+
5
6
  param (
6
7
  [string]$guest_ip = $(throw "-guest_ip is required."),
7
8
  [string]$username = $(throw "-guest_username is required."),
8
- [string]$password = $(throw "-guest_password is required.")
9
+ [string]$password = $(throw "-guest_password is required."),
10
+ [string]$guest_port = $(throw "-guest_port is required")
9
11
  )
10
12
 
11
13
  # Include the following modules
@@ -14,10 +16,14 @@ $presentDir = Split-Path -parent $PSCommandPath
14
16
  . ([System.IO.Path]::Combine($presentDir, "utils\create_session.ps1"))
15
17
 
16
18
  try {
17
- $response = Create-Remote-Session $guest_ip $username $password
19
+ $response = Create-Remote-Session $guest_ip $guest_port $username $password
18
20
  if (!$response["session"] -and $response["error"]) {
19
- Write-Host $response["error"]
20
- return
21
+ $session_message = $response['error']
22
+ $resultHash = @{
23
+ message = "$session_message"
24
+ }
25
+ Write-Output-Message $resultHash
26
+ return
21
27
  }
22
28
  function Remote-Execute() {
23
29
  $winrm_state = ""
@@ -34,7 +40,7 @@ try {
34
40
  } catch {
35
41
  $errortHash = @{
36
42
  type = "PowerShellError"
37
- error ="Failed to copy file $_"
43
+ error ="$_"
38
44
  }
39
45
  Write-Error-Message $errortHash
40
46
  return
@@ -5,6 +5,6 @@
5
5
 
6
6
  module VagrantPlugins
7
7
  module WinAzure
8
- VERSION = '1.0.4'
8
+ VERSION = '1.0.5'
9
9
  end
10
10
  end
data/locales/en.yml CHANGED
@@ -14,3 +14,24 @@ en:
14
14
  VM '%{name}' has been started
15
15
  vm_stopped: |-
16
16
  VM '%{name}' has been stopped
17
+ copy_folder: |-
18
+ Copying folder: %{hostpath} ==>
19
+ %{guestpath}
20
+ rsync_not_found_warning: |-
21
+ Warning! Folder sync disabled because the rsync binary is missing in the %{side}.
22
+ Make sure rsync is installed and the binary can be found in the PATH.
23
+ waiting_for_ssh: |-
24
+ Waiting for SSH
25
+ ssh_ready: |-
26
+ SSH Ready
27
+ read_attempt: |-
28
+ Failed to connect to Virtual Machine. Re-Connecting %{attempt}
29
+ errors:
30
+ win_rm_not_ready: |-
31
+ Vagrant failed to communicate to the VM using powershell. The operation failed
32
+ with the following message.
33
+ %{message}
34
+ server_not_created: |-
35
+ Server not created. Error is: %{message}
36
+ create_vm_failure: |-
37
+ There was some error in creating the VM.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-azure
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - MSOpenTech
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-11 00:00:00.000000000 Z
11
+ date: 2014-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: azure
@@ -100,6 +100,7 @@ executables: []
100
100
  extensions: []
101
101
  extra_rdoc_files: []
102
102
  files:
103
+ - CHANGELOG.md
103
104
  - dummy.box
104
105
  - example_box/metadata.json
105
106
  - example_box/README.md
@@ -113,12 +114,18 @@ files:
113
114
  - lib/vagrant-azure/action/run_instance.rb
114
115
  - lib/vagrant-azure/action/start_instance.rb
115
116
  - lib/vagrant-azure/action/stop_instance.rb
117
+ - lib/vagrant-azure/action/sync_folders.rb
116
118
  - lib/vagrant-azure/action/terminate_instance.rb
119
+ - lib/vagrant-azure/action/vagrant_azure_service.rb
120
+ - lib/vagrant-azure/action/wait_for_communicate.rb
117
121
  - lib/vagrant-azure/action/wait_for_state.rb
118
122
  - lib/vagrant-azure/action.rb
119
123
  - lib/vagrant-azure/command/rdp/command.rb
124
+ - lib/vagrant-azure/communication/powershell.rb
120
125
  - lib/vagrant-azure/config.rb
121
126
  - lib/vagrant-azure/driver.rb
127
+ - lib/vagrant-azure/errors.rb
128
+ - lib/vagrant-azure/monkey_patch/machine.rb
122
129
  - lib/vagrant-azure/plugin.rb
123
130
  - lib/vagrant-azure/provider.rb
124
131
  - lib/vagrant-azure/provisioner/chef-solo.rb
@@ -137,7 +144,6 @@ files:
137
144
  - lib/vagrant-azure.rb
138
145
  - LICENSE
139
146
  - locales/en.yml
140
- - pkg/vagrant-azure-1.0.4.gem
141
147
  - Rakefile
142
148
  - README.md
143
149
  - templates/provisioners/chef-solo/solo.erb
Binary file