vagrant-windows 1.2.0 → 1.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.
- data/.DS_Store +0 -0
- data/CHANGELOG.md +38 -0
- data/Gemfile +1 -0
- data/README.md +66 -111
- data/lib/vagrant-windows/guest/cap/configure_networks.rb +3 -3
- data/lib/vagrant-windows/guest/cap/mount_shared_folder.rb +31 -0
- data/lib/vagrant-windows/guest/windows.rb +9 -9
- data/lib/vagrant-windows/helper.rb +15 -1
- data/lib/vagrant-windows/plugin.rb +4 -4
- data/lib/vagrant-windows/scripts/{mount_volume.vmware.ps1.erb → mount_volume.ps1.erb} +2 -1
- data/lib/vagrant-windows/version.rb +1 -1
- data/spec/vagrant-windows/guestnetwork_spec.rb +13 -1
- data/spec/vagrant-windows/helper_spec.rb +19 -0
- data/spec/vagrant-windows/mount_shared_folder_spec.rb +34 -0
- metadata +37 -15
- checksums.yaml +0 -7
- data/lib/vagrant-windows/guest/cap/mount_virtualbox_shared_folder.rb +0 -17
- data/lib/vagrant-windows/guest/cap/mount_vmware_shared_folder.rb +0 -15
- data/lib/vagrant-windows/scripts/mount_volume.virtualbox.ps1.erb +0 -49
data/.DS_Store
ADDED
Binary file
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
## Changelog
|
2
|
+
|
3
|
+
0.1.1
|
4
|
+
|
5
|
+
- Remove extra debug information from command output.
|
6
|
+
|
7
|
+
0.1.2
|
8
|
+
|
9
|
+
- Added virtual box 4.2 support.
|
10
|
+
|
11
|
+
0.1.3
|
12
|
+
|
13
|
+
- Added puppet provisioner.
|
14
|
+
|
15
|
+
1.0.0
|
16
|
+
|
17
|
+
- Converted to Vagrant 1.1.x plugin architecture.
|
18
|
+
|
19
|
+
1.0.1
|
20
|
+
|
21
|
+
- Fix #29 Monkey Patch the 4.2 driver to include read_mac_addresses.
|
22
|
+
- use read_mac_addresses in all cases.
|
23
|
+
|
24
|
+
1.0.3
|
25
|
+
|
26
|
+
- Added vagrant shell provisioner. The built-in shell provisioner tried to chmod the target script which doesn't make sense on windows.
|
27
|
+
- Can now run the vagrant-windows plugin via bundle exec instead of vagrant plugin install (for plugin dev).The vagrant src root finding logic didn't work from a bundle, but the native Vagrant src root does.
|
28
|
+
- Readme fixes/updates.
|
29
|
+
|
30
|
+
1.2.0
|
31
|
+
|
32
|
+
- Converted to Vagrant 1.2.x plugin architecture.
|
33
|
+
- Various networking fixes.
|
34
|
+
- Chef provisioner runs through the Windows task scheduler instead of ps_runas power shell script.
|
35
|
+
|
36
|
+
1.2.1
|
37
|
+
|
38
|
+
- Fixed issue 91, drive mapping was failing on Vagrant 1.1.
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,80 +1,64 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# Vagrant-Windows
|
2
|
+
[](https://travis-ci.org/WinRb/vagrant-windows)
|
3
|
+
[](https://codeclimate.com/github/WinRb/vagrant-windows)
|
4
|
+
[](http://badge.fury.io/rb/vagrant-windows)
|
3
5
|
|
4
|
-
|
5
|
-
For Vagrant 1.0.x execute `vagrant plugin install vagrant-windows --plugin-version 0.1.2`.
|
6
|
+
Use Windows guests with Vagrant
|
6
7
|
|
7
|
-
|
8
|
-
|
8
|
+
## Getting Started
|
9
|
+
1. Install the vagrant-windows plugin.
|
10
|
+
2. Create and configure a Windows guest base box.
|
11
|
+
3. Create a Vagrantfile.
|
12
|
+
4. vagrant up
|
9
13
|
|
10
|
-
|
11
|
-
bundle install
|
12
|
-
bundle exec rake
|
13
|
-
vagrant plugin install pkg/vagrant-windows-1.2.0.gem
|
14
|
-
```
|
14
|
+
## Installation
|
15
15
|
|
16
|
-
|
16
|
+
- For Vagrant 1.1 and 1.2 execute `vagrant plugin install vagrant-windows`.
|
17
|
+
- For Vagrant 1.0 execute `vagrant plugin install vagrant-windows --plugin-version 0.1.2`.
|
17
18
|
|
18
|
-
|
19
|
-
===========================================
|
20
|
-
_Does NOT work with Windows 2003 or XP_
|
19
|
+
## Creating a Base Box
|
21
20
|
|
21
|
+
Supported Guest Operating Systems:
|
22
22
|
- Windows 7
|
23
23
|
- Windows 2008
|
24
24
|
- Windows 2008 R2
|
25
25
|
- Windows 2012
|
26
26
|
- Windows 8
|
27
27
|
|
28
|
-
|
29
|
-
===================
|
28
|
+
Windows Server 2003 and Windows XP are not supported.
|
30
29
|
|
31
|
-
|
32
|
-
--------------------
|
33
|
-
#### Prerequisites
|
34
|
-
|
35
|
-
Box setup:
|
30
|
+
You'll need to create a new Vagrant base box. Create a new Windows VM in VirtualBox, configure some Windows settings (see below) then follow the [Vagrant packaging instructions](http://docs.vagrantup.com/v2/cli/package.html).
|
36
31
|
|
37
32
|
- Create a vagrant user, for things to work out of the box username and password should both be "vagrant".
|
38
33
|
- Turn off UAC (Msconfig)
|
39
34
|
- Disable complex passwords
|
35
|
+
- [Disable Shutdown Tracker](http://www.jppinto.com/2010/01/how-to-disable-the-shutdown-event-tracker-in-server-20032008/) on Windows 2008/2012 Servers (except Core).
|
36
|
+
- [Disable "Server Manager" Starting at login](http://www.elmajdal.net/win2k8/How_to_Turn_Off_The_Automatic_Display_of_Server_Manager_At_logon.aspx) on Windows 2008/2012 Servers (except Core).
|
37
|
+
- Enable and configure WinRM (see below)
|
40
38
|
|
41
|
-
|
39
|
+
### WinRM Configuration
|
42
40
|
|
43
|
-
|
44
|
-
- Remote Procedure Call (RPC)
|
45
|
-
- DCOM Server Process Launcher
|
46
|
-
- RPC Endpoint Mapper
|
47
|
-
- Windows Firewall
|
48
|
-
- Windows Remote Management (WS-Management)
|
49
|
-
|
50
|
-
#### Enable WinRM
|
41
|
+
These commands assume you're running from a regular command window and not PowerShell.
|
51
42
|
```
|
52
43
|
winrm quickconfig -q
|
53
44
|
winrm set winrm/config/winrs @{MaxMemoryPerShellMB="512"}
|
54
45
|
winrm set winrm/config @{MaxTimeoutms="1800000"}
|
55
46
|
winrm set winrm/config/service @{AllowUnencrypted="true"}
|
56
47
|
winrm set winrm/config/service/auth @{Basic="true"}
|
48
|
+
sc config WinRM start= auto
|
57
49
|
```
|
58
|
-
|
59
|
-
If you want to run the winrm commands from PowerShell you need to put ```@{MaxMemoryPerShellMB="512"}``` etc in single quotes:
|
60
|
-
|
61
|
-
```
|
62
|
-
winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="512"}'
|
63
|
-
```
|
64
|
-
|
65
|
-
#### Last steps
|
50
|
+
### Required Windows Services
|
66
51
|
|
67
|
-
|
68
|
-
- _Note:_ When you use the `winrm` command line tool it will always ask to set the startup to Delayed, so you may find yourself performing this a few times.
|
52
|
+
If you like to turn off optional Windows services you'll need to ensure you leave these services enabled for vagrant-windows to continue to work:
|
69
53
|
|
54
|
+
- Base Filtering Engine
|
55
|
+
- Remote Procedure Call (RPC)
|
56
|
+
- DCOM Server Process Launcher
|
57
|
+
- RPC Endpoint Mapper
|
58
|
+
- Windows Firewall
|
59
|
+
- Windows Remote Management (WS-Management)
|
70
60
|
|
71
|
-
|
72
|
-
---------------------------------------
|
73
|
-
- [Disable Shutdown Tracker](http://www.jppinto.com/2010/01/how-to-disable-the-shutdown-event-tracker-in-server-20032008/)
|
74
|
-
- [Disable "Server Manager" Starting at login](http://www.elmajdal.net/win2k8/How_to_Turn_Off_The_Automatic_Display_of_Server_Manager_At_logon.aspx)
|
75
|
-
|
76
|
-
The Vagrant File
|
77
|
-
================
|
61
|
+
## The Vagrant File
|
78
62
|
|
79
63
|
Add the following to your Vagrantfile
|
80
64
|
|
@@ -122,41 +106,39 @@ Available Config Parameters:
|
|
122
106
|
* ```config.winrm.max_tries``` - The number of retries to connect to WinRM, defaults to 20.
|
123
107
|
* ```config.winrm.timeout``` - The max number of seconds to wait for a WinRM response, defaults to 1800 seconds.
|
124
108
|
|
125
|
-
Note - You need to ensure you specify a config.windows and a config.winrm in your Vagrantfile. Currently there's a problem where
|
126
|
-
|
109
|
+
Note - You need to ensure you specify a config.windows and a config.winrm in your Vagrantfile. Currently there's a problem where Vagrant will not load the plugin config even with defaults if at least one of its values doesn't exist in the Vagrantfile.
|
110
|
+
|
127
111
|
|
128
112
|
|
129
|
-
|
130
|
-
|
113
|
+
------------------------------------------------------------
|
114
|
+
|
115
|
+
## What Works?
|
116
|
+
|
131
117
|
- vagrant up|halt|reload|provision
|
132
118
|
- Chef Vagrant Provisioner
|
133
119
|
- Puppet Vagrant Provisioner
|
134
120
|
- Shell Vagrant provisioner. Batch files or PowerShell (ps1) scripts are supported as well as inline scripts.
|
135
121
|
|
136
|
-
TODOs
|
137
|
-
=========
|
138
|
-
1. Test it! We need to test on more hosts, guests, and VBox versions. Help wanted.
|
139
|
-
2. Chef-Client support.
|
140
|
-
3. Unit tests.
|
141
|
-
4. Better docs.
|
142
122
|
|
143
|
-
Troubleshooting
|
144
|
-
===============
|
123
|
+
## Troubleshooting
|
145
124
|
|
146
|
-
I get
|
147
|
-
|
125
|
+
#### When I run the winrm command I get: "Error: Invalid use of command line. Type "winrm -?" for help."
|
126
|
+
- You're running the winrm command from powershell. You need to put ```@{MaxMemoryPerShellMB="512"}``` etc in single quotes:
|
127
|
+
```
|
128
|
+
winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="512"}'
|
129
|
+
```
|
130
|
+
|
131
|
+
#### I get a 401 auth error from WinRM
|
148
132
|
- Ensure you've followed the WinRM configuration instructions above.
|
149
133
|
- Ensure you can manually login using the specified config.winrm.username you've specified in your Vagrantfile.
|
150
134
|
- Ensure your password hasn't expired.
|
151
135
|
- Ensure your password doesn't need to be changed because of policy.
|
152
136
|
|
153
|
-
I get a non-401 error from WinRM waiting for the VM to boot
|
154
|
-
-----------------------------------------------------------
|
137
|
+
#### I get a non-401 error from WinRM waiting for the VM to boot
|
155
138
|
- Ensure you've properly setup port forwarding of WinRM
|
156
139
|
- Make sure your VM can boot manually through VBox.
|
157
140
|
|
158
|
-
SQL Server cookbook fails to install through Vagrant
|
159
|
-
----------------------------------------------------
|
141
|
+
#### SQL Server cookbook fails to install through Vagrant
|
160
142
|
- Ensure UAC is turned off
|
161
143
|
- Ensure your vagrant user is an admin on the guest
|
162
144
|
- The SQL Server installer uses a lot of resources, ensure WinRM Quota Management is properly configured to give it enough resources.
|
@@ -165,21 +147,17 @@ SQL Server cookbook fails to install through Vagrant
|
|
165
147
|
If all else fails try running [vagrant with debug logging](http://docs.vagrantup.com/v2/debugging.html), perhaps that will give
|
166
148
|
you enough insight to fix the problem or file an issue.
|
167
149
|
|
168
|
-
What Can I do to help?
|
169
|
-
======================
|
170
|
-
1. Contribute Code (See Below)
|
171
|
-
2. Test Various Scenarios and file bugs for things that dont work
|
172
150
|
|
173
|
-
Contributing
|
174
|
-
|
151
|
+
## Contributing
|
152
|
+
|
175
153
|
1. Fork it.
|
176
154
|
2. Create a branch (git checkout -b my_feature_branch)
|
177
155
|
3. Commit your changes (git commit -am "Added a sweet feature")
|
178
156
|
4. Push to the branch (git push origin my_feature_branch)
|
179
157
|
5. Create a pull requst from your branch into master (Please be sure to provide enough detail for us to cipher what this change is doing)
|
180
158
|
|
181
|
-
Development
|
182
|
-
|
159
|
+
### Development
|
160
|
+
|
183
161
|
Clone this repository and use [Bundler](http://gembundler.com) to get the dependencies:
|
184
162
|
|
185
163
|
```
|
@@ -202,9 +180,20 @@ use bundler to execute Vagrant:
|
|
202
180
|
$ bundle exec vagrant up
|
203
181
|
```
|
204
182
|
|
183
|
+
### Installing Vagrant-Windows From Source
|
184
|
+
|
185
|
+
If you want to globally install your locally built plugin from source, use the following method (this would be for 1.2.0):
|
186
|
+
|
187
|
+
```
|
188
|
+
bundle install
|
189
|
+
bundle exec rake build
|
190
|
+
vagrant plugin install pkg/vagrant-windows-1.2.0.gem
|
191
|
+
```
|
192
|
+
|
193
|
+
Keep in mind you should have Ruby 1.9.3 and Ruby DevKit installed. Check out the following gist that can get you what you need (from blank system to fully ready): [Install Vagrant Windows Plugin From Source Gist](https://gist.github.com/ferventcoder/6251225).
|
194
|
+
|
195
|
+
## References and Shout Outs
|
205
196
|
|
206
|
-
References and Shout Outs
|
207
|
-
=========================
|
208
197
|
- Chris McClimans - Vagrant Branch (https://github.com/hh/vagrant/blob/feature/winrm/)
|
209
198
|
- Dan Wanek - WinRM GEM (https://github.com/zenchild/WinRM)
|
210
199
|
- +1 For being super responsive to pull requests.
|
@@ -215,38 +204,4 @@ References and Shout Outs
|
|
215
204
|
- Rob Reynolds - Updated readme installation and box configuration notes
|
216
205
|
- stonith - Updated readme winrm config notes
|
217
206
|
- wenns - Updated readme to advise against forwarding RDP
|
218
|
-
|
219
|
-
Changelog
|
220
|
-
=========
|
221
|
-
0.1.1
|
222
|
-
|
223
|
-
- Remove extra debug information from command output.
|
224
|
-
|
225
|
-
0.1.2
|
226
|
-
|
227
|
-
- Added virtual box 4.2 support.
|
228
|
-
|
229
|
-
0.1.3
|
230
|
-
|
231
|
-
- Added puppet provisioner.
|
232
|
-
|
233
|
-
1.0.0
|
234
|
-
|
235
|
-
- Converted to Vagrant 1.1.x plugin architecture.
|
236
|
-
|
237
|
-
1.0.1
|
238
|
-
|
239
|
-
- Fix #29 Monkey Patch the 4.2 driver to include read_mac_addresses.
|
240
|
-
- use read_mac_addresses in all cases.
|
241
|
-
|
242
|
-
1.0.3
|
243
|
-
|
244
|
-
- Added vagrant shell provisioner. The built-in shell provisioner tried to chmod the target script which doesn't make sense on windows.
|
245
|
-
- Can now run the vagrant-windows plugin via bundle exec instead of vagrant plugin install (for plugin dev).The vagrant src root finding logic didn't work from a bundle, but the native Vagrant src root does.
|
246
|
-
- Readme fixes/updates.
|
247
|
-
|
248
|
-
1.2.0
|
249
|
-
|
250
|
-
- Converted to Vagrant 1.2.x plugin architecture.
|
251
|
-
- Various networking fixes.
|
252
|
-
- Chef provisioner runs through the Windows task scheduler instead of ps_runas power shell script.
|
207
|
+
- Joe Fitzgerald - Added VMWare support and improved retry logic.
|
@@ -2,6 +2,7 @@ require 'log4r'
|
|
2
2
|
require_relative '../../communication/guestnetwork'
|
3
3
|
require_relative '../../communication/winrmshell'
|
4
4
|
require_relative '../../errors'
|
5
|
+
require_relative '../../helper'
|
5
6
|
|
6
7
|
module VagrantWindows
|
7
8
|
module Guest
|
@@ -14,8 +15,7 @@ module VagrantWindows
|
|
14
15
|
@@logger.debug("networks: #{networks.inspect}")
|
15
16
|
|
16
17
|
guest_network = ::VagrantWindows::Communication::GuestNetwork.new(machine.communicate.winrmshell)
|
17
|
-
|
18
|
-
if (machine.provider_name != :vmware_fusion) && (machine.provider_name != :vmware_workstation)
|
18
|
+
unless VagrantWindows::Helper.is_vmware(machine)
|
19
19
|
vm_interface_map = create_vm_interface_map(machine, guest_network)
|
20
20
|
end
|
21
21
|
|
@@ -53,7 +53,7 @@ module VagrantWindows
|
|
53
53
|
naked_mac = nic[:mac_address].gsub(':','')
|
54
54
|
if driver_mac_address[naked_mac]
|
55
55
|
vm_interface_map[driver_mac_address[naked_mac]] = {
|
56
|
-
:
|
56
|
+
:net_connection_id => nic[:net_connection_id],
|
57
57
|
:mac_address => naked_mac,
|
58
58
|
:interface_index => nic[:interface_index],
|
59
59
|
:index => nic[:index] }
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require_relative '../../helper'
|
2
|
+
|
3
|
+
module VagrantWindows
|
4
|
+
module Guest
|
5
|
+
module Cap
|
6
|
+
class MountSharedFolder
|
7
|
+
|
8
|
+
def self.mount_virtualbox_shared_folder(machine, name, guestpath, options)
|
9
|
+
mount_shared_folder(machine, name, guestpath, "\\\\vboxsrv\\")
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.mount_vmware_shared_folder(machine, name, guestpath, options)
|
13
|
+
mount_shared_folder(machine, name, guestpath, "\\\\vmware-host\\Shared Folders\\")
|
14
|
+
end
|
15
|
+
|
16
|
+
protected
|
17
|
+
|
18
|
+
def self.mount_shared_folder(machine, name, guestpath, vm_provider_unc_base)
|
19
|
+
share_name = VagrantWindows::Helper.win_friendly_share_id(name)
|
20
|
+
options = {
|
21
|
+
:mount_point => guestpath,
|
22
|
+
:share_name => share_name,
|
23
|
+
:vm_provider_unc_path => vm_provider_unc_base + share_name}
|
24
|
+
mount_script = VagrantWindows.load_script_template("mount_volume.ps1", :options => options)
|
25
|
+
machine.communicate.execute(mount_script, {:shell => :powershell})
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
require "vagrant"
|
2
|
+
require "vagrant-windows/helper"
|
2
3
|
require "vagrant-windows/guest/cap/change_host_name"
|
3
4
|
require "vagrant-windows/guest/cap/configure_networks"
|
4
5
|
require "vagrant-windows/guest/cap/halt"
|
5
|
-
require "vagrant-windows/guest/cap/
|
6
|
-
require "vagrant-windows/guest/cap/mount_vmware_shared_folder"
|
6
|
+
require "vagrant-windows/guest/cap/mount_shared_folder"
|
7
7
|
|
8
8
|
module VagrantWindows
|
9
9
|
module Guest
|
@@ -31,14 +31,14 @@ module VagrantWindows
|
|
31
31
|
VagrantWindows::Guest::Cap::Halt.halt(@machine)
|
32
32
|
end
|
33
33
|
|
34
|
-
def
|
35
|
-
VagrantWindows::
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
VagrantWindows::Guest::Cap::MountVMwareBoxSharedFolder.mount_vmware_shared_folder(
|
34
|
+
def mount_shared_folder(name, guestpath, options)
|
35
|
+
if VagrantWindows::Helper.is_vmware(@machine) then
|
36
|
+
VagrantWindows::Guest::Cap::MountSharedFolder.mount_vmware_shared_folder(
|
37
|
+
@machine, name, guestpath, options)
|
38
|
+
else
|
39
|
+
VagrantWindows::Guest::Cap::MountSharedFolder.mount_virtualbox_shared_folder(
|
41
40
|
@machine, name, guestpath, options)
|
41
|
+
end
|
42
42
|
end
|
43
43
|
|
44
44
|
def configure_networks(networks)
|
@@ -2,6 +2,10 @@ module VagrantWindows
|
|
2
2
|
module Helper
|
3
3
|
extend self
|
4
4
|
|
5
|
+
# Makes a path Windows guest friendly.
|
6
|
+
# Turns '/vagrant' into 'c:\vagrant'
|
7
|
+
#
|
8
|
+
# @return [String]
|
5
9
|
def win_friendly_path(path)
|
6
10
|
if path
|
7
11
|
new_path = path.gsub('/', '\\')
|
@@ -10,10 +14,20 @@ module VagrantWindows
|
|
10
14
|
new_path
|
11
15
|
end
|
12
16
|
|
13
|
-
#
|
17
|
+
# Makes Vagrant share names Windows guest friendly.
|
18
|
+
# Turns '/vagrant' into 'vagrant' or turns ''/a/b/c/d/e' into 'a_b_c_d_e'
|
19
|
+
#
|
20
|
+
# @return [String]
|
14
21
|
def win_friendly_share_id(shared_folder_name)
|
15
22
|
return shared_folder_name.gsub(/[\/\/]/,'_').sub(/^_/, '')
|
16
23
|
end
|
17
24
|
|
25
|
+
# Checks to see if the specified machine is using VMWare Fusion or Workstation.
|
26
|
+
#
|
27
|
+
# @return [Boolean]
|
28
|
+
def is_vmware(machine)
|
29
|
+
machine.provider_name.to_s().start_with?('vmware')
|
30
|
+
end
|
31
|
+
|
18
32
|
end
|
19
33
|
end
|
@@ -76,13 +76,13 @@ module VagrantWindows
|
|
76
76
|
end
|
77
77
|
|
78
78
|
guest_capability(:windows, :mount_virtualbox_shared_folder) do
|
79
|
-
require_relative "guest/cap/
|
80
|
-
VagrantWindows::Guest::Cap::
|
79
|
+
require_relative "guest/cap/mount_shared_folder"
|
80
|
+
VagrantWindows::Guest::Cap::MountSharedFolder
|
81
81
|
end
|
82
82
|
|
83
83
|
guest_capability(:windows, :mount_vmware_shared_folder) do
|
84
|
-
require_relative "guest/cap/
|
85
|
-
VagrantWindows::Guest::Cap::
|
84
|
+
require_relative "guest/cap/mount_shared_folder"
|
85
|
+
VagrantWindows::Guest::Cap::MountSharedFolder
|
86
86
|
end
|
87
87
|
|
88
88
|
end
|
@@ -7,6 +7,7 @@ function Test-ReparsePoint([string]$path) {
|
|
7
7
|
|
8
8
|
$MountPoint = [System.IO.Path]::GetFullPath("<%= options[:mount_point] %>")
|
9
9
|
$ShareName = "<%= options[:share_name] %>"
|
10
|
+
$VmProviderUncPath = "<%= options[:vm_provider_unc_path] %>"
|
10
11
|
|
11
12
|
# https://github.com/BIAINC/vagrant-windows/issues/4
|
12
13
|
# Not sure why this works, but it does.
|
@@ -41,7 +42,7 @@ if (-not (Test-Path $BaseDirectory))
|
|
41
42
|
New-Item $BaseDirectory -Type Directory -Force | Out-Null
|
42
43
|
}
|
43
44
|
|
44
|
-
cmd /c mklink /D "$MountPoint" "
|
45
|
+
cmd /c mklink /D "$MountPoint" "$VmProviderUncPath" | out-null
|
45
46
|
|
46
47
|
if ( $LASTEXITCODE -ne 0 )
|
47
48
|
{
|
@@ -35,8 +35,20 @@ describe VagrantWindows::Communication::GuestNetwork , :integration => true do
|
|
35
35
|
|
36
36
|
it "should configure static IP for adapter" do
|
37
37
|
nics = @guestnetwork.network_adapters()
|
38
|
-
@guestnetwork.configure_static_interface(
|
38
|
+
@guestnetwork.configure_static_interface(
|
39
|
+
nics[1][:index],
|
40
|
+
nics[1][:net_connection_id],
|
41
|
+
"192.168.0.121",
|
42
|
+
"255.255.255.0")
|
43
|
+
|
39
44
|
expect(@guestnetwork.is_dhcp_enabled(nics[1][:index])).to be_false
|
45
|
+
|
46
|
+
# ensure the right IP was set by looking through all the output of ipconfig
|
47
|
+
ipconfig_out = ''
|
48
|
+
@shell.powershell('ipconfig /all') do |_, line|
|
49
|
+
ipconfig_out = ipconfig_out + "#{line}"
|
50
|
+
end
|
51
|
+
expect(ipconfig_out).to include('192.168.0.121')
|
40
52
|
end
|
41
53
|
|
42
54
|
it "should configure all networks to work mode" do
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'mocha/api'
|
2
3
|
|
3
4
|
describe VagrantWindows::Helper , :unit => true do
|
4
5
|
|
@@ -34,5 +35,23 @@ describe VagrantWindows::Helper , :unit => true do
|
|
34
35
|
end
|
35
36
|
|
36
37
|
end
|
38
|
+
|
39
|
+
describe "is_vmware" do
|
40
|
+
it "should be true for vmware_fusion" do
|
41
|
+
machine = stub(:provider_name => :vmware_fusion)
|
42
|
+
expect(@dummy.is_vmware(machine)).to be_true
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should be true for vmware_workstation" do
|
46
|
+
machine = stub(:provider_name => :vmware_workstation)
|
47
|
+
expect(@dummy.is_vmware(machine)).to be_true
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should be false for virtual_box" do
|
51
|
+
machine = stub(:provider_name => :virtual_box)
|
52
|
+
expect(@dummy.is_vmware(machine)).to be_false
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
37
56
|
|
38
57
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'mocha/api'
|
3
|
+
require 'vagrant-windows/guest/cap/mount_shared_folder'
|
4
|
+
|
5
|
+
describe VagrantWindows::Guest::Cap::MountSharedFolder, :unit => true do
|
6
|
+
|
7
|
+
before(:each) do
|
8
|
+
@communicator = mock()
|
9
|
+
@machine = stub(:communicate => @communicator)
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "mount_virtualbox_shared_folder" do
|
13
|
+
it "should run script with vbox paths" do
|
14
|
+
@communicator.expects(:execute).with do |script, options|
|
15
|
+
expect(script).to include("$VmProviderUncPath = \"\\\\vboxsrv\\vagrant\"")
|
16
|
+
end
|
17
|
+
|
18
|
+
VagrantWindows::Guest::Cap::MountSharedFolder.mount_virtualbox_shared_folder(
|
19
|
+
@machine, "vagrant", "/tmp/vagrant", {})
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "mount_vmware_shared_folder" do
|
24
|
+
it "should run script with vmware paths" do
|
25
|
+
@communicator.expects(:execute).with do |script, options|
|
26
|
+
expect(script).to include("$VmProviderUncPath = \"\\\\vmware-host\\Shared Folders\\vagrant\"")
|
27
|
+
end
|
28
|
+
|
29
|
+
VagrantWindows::Guest::Cap::MountSharedFolder.mount_vmware_shared_folder(
|
30
|
+
@machine, "vagrant", "/tmp/vagrant", {})
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
metadata
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-windows
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Paul Morton
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2013-09-
|
12
|
+
date: 2013-09-16 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: winrm
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
19
|
- - ~>
|
18
20
|
- !ruby/object:Gem::Version
|
@@ -20,6 +22,7 @@ dependencies:
|
|
20
22
|
type: :runtime
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
23
26
|
requirements:
|
24
27
|
- - ~>
|
25
28
|
- !ruby/object:Gem::Version
|
@@ -27,20 +30,23 @@ dependencies:
|
|
27
30
|
- !ruby/object:Gem::Dependency
|
28
31
|
name: rake
|
29
32
|
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
30
34
|
requirements:
|
31
|
-
- - '>='
|
35
|
+
- - ! '>='
|
32
36
|
- !ruby/object:Gem::Version
|
33
37
|
version: '0'
|
34
38
|
type: :development
|
35
39
|
prerelease: false
|
36
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
37
42
|
requirements:
|
38
|
-
- - '>='
|
43
|
+
- - ! '>='
|
39
44
|
- !ruby/object:Gem::Version
|
40
45
|
version: '0'
|
41
46
|
- !ruby/object:Gem::Dependency
|
42
47
|
name: rspec-core
|
43
48
|
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
44
50
|
requirements:
|
45
51
|
- - ~>
|
46
52
|
- !ruby/object:Gem::Version
|
@@ -48,6 +54,7 @@ dependencies:
|
|
48
54
|
type: :development
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
51
58
|
requirements:
|
52
59
|
- - ~>
|
53
60
|
- !ruby/object:Gem::Version
|
@@ -55,6 +62,7 @@ dependencies:
|
|
55
62
|
- !ruby/object:Gem::Dependency
|
56
63
|
name: rspec-expectations
|
57
64
|
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
58
66
|
requirements:
|
59
67
|
- - ~>
|
60
68
|
- !ruby/object:Gem::Version
|
@@ -62,6 +70,7 @@ dependencies:
|
|
62
70
|
type: :development
|
63
71
|
prerelease: false
|
64
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
65
74
|
requirements:
|
66
75
|
- - ~>
|
67
76
|
- !ruby/object:Gem::Version
|
@@ -69,6 +78,7 @@ dependencies:
|
|
69
78
|
- !ruby/object:Gem::Dependency
|
70
79
|
name: rspec-mocks
|
71
80
|
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
72
82
|
requirements:
|
73
83
|
- - ~>
|
74
84
|
- !ruby/object:Gem::Version
|
@@ -76,6 +86,7 @@ dependencies:
|
|
76
86
|
type: :development
|
77
87
|
prerelease: false
|
78
88
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
79
90
|
requirements:
|
80
91
|
- - ~>
|
81
92
|
- !ruby/object:Gem::Version
|
@@ -83,15 +94,17 @@ dependencies:
|
|
83
94
|
- !ruby/object:Gem::Dependency
|
84
95
|
name: simplecov
|
85
96
|
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
86
98
|
requirements:
|
87
|
-
- - '>='
|
99
|
+
- - ! '>='
|
88
100
|
- !ruby/object:Gem::Version
|
89
101
|
version: '0'
|
90
102
|
type: :development
|
91
103
|
prerelease: false
|
92
104
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
93
106
|
requirements:
|
94
|
-
- - '>='
|
107
|
+
- - ! '>='
|
95
108
|
- !ruby/object:Gem::Version
|
96
109
|
version: '0'
|
97
110
|
description: Windows Guest Support for Vagrant
|
@@ -101,6 +114,7 @@ executables: []
|
|
101
114
|
extensions: []
|
102
115
|
extra_rdoc_files: []
|
103
116
|
files:
|
117
|
+
- CHANGELOG.md
|
104
118
|
- coverage/assets/0.7.1/application.css
|
105
119
|
- coverage/assets/0.7.1/application.js
|
106
120
|
- coverage/assets/0.7.1/fancybox/blank.gif
|
@@ -153,8 +167,7 @@ files:
|
|
153
167
|
- lib/vagrant-windows/guest/cap/change_host_name.rb
|
154
168
|
- lib/vagrant-windows/guest/cap/configure_networks.rb
|
155
169
|
- lib/vagrant-windows/guest/cap/halt.rb
|
156
|
-
- lib/vagrant-windows/guest/cap/
|
157
|
-
- lib/vagrant-windows/guest/cap/mount_vmware_shared_folder.rb
|
170
|
+
- lib/vagrant-windows/guest/cap/mount_shared_folder.rb
|
158
171
|
- lib/vagrant-windows/guest/windows.rb
|
159
172
|
- lib/vagrant-windows/helper.rb
|
160
173
|
- lib/vagrant-windows/monkey_patches/lib/vagrant/machine.rb
|
@@ -170,8 +183,7 @@ files:
|
|
170
183
|
- lib/vagrant-windows/scripts/cheftask.xml.erb
|
171
184
|
- lib/vagrant-windows/scripts/cheftaskrun.ps1.erb
|
172
185
|
- lib/vagrant-windows/scripts/command_alias.ps1
|
173
|
-
- lib/vagrant-windows/scripts/mount_volume.
|
174
|
-
- lib/vagrant-windows/scripts/mount_volume.vmware.ps1.erb
|
186
|
+
- lib/vagrant-windows/scripts/mount_volume.ps1.erb
|
175
187
|
- lib/vagrant-windows/scripts/set_work_network.ps1
|
176
188
|
- lib/vagrant-windows/scripts/winrs_v3_get_adapters.ps1
|
177
189
|
- lib/vagrant-windows/version.rb
|
@@ -183,34 +195,43 @@ files:
|
|
183
195
|
- spec/vagrant-windows/config_spec.rb
|
184
196
|
- spec/vagrant-windows/guestnetwork_spec.rb
|
185
197
|
- spec/vagrant-windows/helper_spec.rb
|
198
|
+
- spec/vagrant-windows/mount_shared_folder_spec.rb
|
186
199
|
- spec/vagrant-windows/winrmcommunicator_spec.rb
|
187
200
|
- vagrant-windows.gemspec
|
201
|
+
- .DS_Store
|
188
202
|
- .gitignore
|
189
203
|
- .travis.yml
|
190
204
|
- coverage/.last_run.json
|
191
205
|
- coverage/.resultset.json
|
192
206
|
homepage: ''
|
193
207
|
licenses: []
|
194
|
-
metadata: {}
|
195
208
|
post_install_message:
|
196
209
|
rdoc_options: []
|
197
210
|
require_paths:
|
198
211
|
- lib
|
199
212
|
required_ruby_version: !ruby/object:Gem::Requirement
|
213
|
+
none: false
|
200
214
|
requirements:
|
201
|
-
- - '>='
|
215
|
+
- - ! '>='
|
202
216
|
- !ruby/object:Gem::Version
|
203
217
|
version: '0'
|
218
|
+
segments:
|
219
|
+
- 0
|
220
|
+
hash: 1712186085374339877
|
204
221
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
222
|
+
none: false
|
205
223
|
requirements:
|
206
|
-
- - '>='
|
224
|
+
- - ! '>='
|
207
225
|
- !ruby/object:Gem::Version
|
208
226
|
version: '0'
|
227
|
+
segments:
|
228
|
+
- 0
|
229
|
+
hash: 1712186085374339877
|
209
230
|
requirements: []
|
210
231
|
rubyforge_project:
|
211
|
-
rubygems_version:
|
232
|
+
rubygems_version: 1.8.23
|
212
233
|
signing_key:
|
213
|
-
specification_version:
|
234
|
+
specification_version: 3
|
214
235
|
summary: A small gem that adds windows guest support to vagrant, uses WinRM as the
|
215
236
|
Communication Channel
|
216
237
|
test_files:
|
@@ -218,4 +239,5 @@ test_files:
|
|
218
239
|
- spec/vagrant-windows/config_spec.rb
|
219
240
|
- spec/vagrant-windows/guestnetwork_spec.rb
|
220
241
|
- spec/vagrant-windows/helper_spec.rb
|
242
|
+
- spec/vagrant-windows/mount_shared_folder_spec.rb
|
221
243
|
- spec/vagrant-windows/winrmcommunicator_spec.rb
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: cecfc851c351d99894540e03b595c9ed93fb313b
|
4
|
-
data.tar.gz: 325c6d920df52dc61f4db48e64337b88480a1b0d
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: c5d93cd182875294ee9c50911b272363752039d8ab1ccae5c620291b109eb7c04a3ec8073901982e64fa040b04678197936fc8f2fe97d925ebb71fb8c230c438
|
7
|
-
data.tar.gz: 9932265ce43b14f7b942146291e1696d861c2070d8b79b147bda0b02bc4e41ac486b8996e20fac232802ddea0b083f276e2dddd7f7692cd5e49a711033fc2582
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require_relative '../../helper'
|
2
|
-
|
3
|
-
module VagrantWindows
|
4
|
-
module Guest
|
5
|
-
module Cap
|
6
|
-
class MountVirtualBoxSharedFolder
|
7
|
-
|
8
|
-
def self.mount_virtualbox_shared_folder(machine, name, guestpath, options)
|
9
|
-
share_name = VagrantWindows::Helper.win_friendly_share_id(name)
|
10
|
-
mount_script = VagrantWindows.load_script_template("mount_volume.virtualbox.ps1",
|
11
|
-
:options => {:mount_point => guestpath, :share_name => share_name})
|
12
|
-
machine.communicate.execute(mount_script, {:shell => :powershell})
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module VagrantWindows
|
2
|
-
module Guest
|
3
|
-
module Cap
|
4
|
-
class MountVMwareSharedFolder
|
5
|
-
|
6
|
-
def self.mount_vmware_shared_folder(machine, name, guestpath, options)
|
7
|
-
share_name = VagrantWindows::Helper.win_friendly_share_id(name)
|
8
|
-
mount_script = VagrantWindows.load_script_template("mount_volume.vmware.ps1",
|
9
|
-
:options => {:mount_point => guestpath, :share_name => share_name})
|
10
|
-
machine.communicate.execute(mount_script, {:shell => :powershell})
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
|
2
|
-
function Test-ReparsePoint([string]$path) {
|
3
|
-
$file = Get-Item $path -Force -ea 0
|
4
|
-
return [bool]($file.Attributes -band [IO.FileAttributes]::ReparsePoint)
|
5
|
-
}
|
6
|
-
|
7
|
-
|
8
|
-
$MountPoint = [System.IO.Path]::GetFullPath("<%= options[:mount_point] %>")
|
9
|
-
$ShareName = "<%= options[:share_name] %>"
|
10
|
-
|
11
|
-
# https://github.com/BIAINC/vagrant-windows/issues/4
|
12
|
-
# Not sure why this works, but it does.
|
13
|
-
|
14
|
-
& net use $ShareName 2>&1 | Out-Null
|
15
|
-
|
16
|
-
Write-Debug "Attempting to mount $ShareName to $MountPoint"
|
17
|
-
if( (Test-Path "$MountPoint") -and (Test-ReparsePoint "$MountPoint") )
|
18
|
-
{
|
19
|
-
Write-Debug "Junction already exists, so I will delete it"
|
20
|
-
# Powershell refuses to delete junctions, oh well use cmd
|
21
|
-
cmd /c rd "$MountPoint"
|
22
|
-
|
23
|
-
if ( $LASTEXITCODE -ne 0 )
|
24
|
-
{
|
25
|
-
Write-Error "Failed to delete symbolic link at $MountPoint"
|
26
|
-
exit 1
|
27
|
-
}
|
28
|
-
|
29
|
-
}
|
30
|
-
elseif(Test-Path $MountPoint)
|
31
|
-
{
|
32
|
-
Write-Debug "Mount point already exists and is not a symbolic link"
|
33
|
-
exit 1
|
34
|
-
}
|
35
|
-
|
36
|
-
$BaseDirectory = [System.IO.Path]::GetDirectoryName($MountPoint)
|
37
|
-
|
38
|
-
if (-not (Test-Path $BaseDirectory))
|
39
|
-
{
|
40
|
-
Write-Debug "Creating parent directory for mount point $BaseDirectory"
|
41
|
-
New-Item $BaseDirectory -Type Directory -Force | Out-Null
|
42
|
-
}
|
43
|
-
|
44
|
-
cmd /c mklink /D "$MountPoint" "\\vboxsrv\$ShareName" | out-null
|
45
|
-
|
46
|
-
if ( $LASTEXITCODE -ne 0 )
|
47
|
-
{
|
48
|
-
exit 1
|
49
|
-
}
|