vagrant-parallels 0.2.2.rc1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +89 -46
- data/Rakefile +0 -3
- data/lib/vagrant-parallels/action/network.rb +8 -10
- data/lib/vagrant-parallels/driver/pd_8.rb +12 -15
- data/lib/vagrant-parallels/driver/pd_9.rb +12 -15
- data/lib/vagrant-parallels/guest_cap/linux/mount_parallels_shared_folder.rb +16 -6
- data/lib/vagrant-parallels/version.rb +1 -1
- data/test/unit/support/shared/pd_driver_examples.rb +10 -12
- data/vagrant-parallels.gemspec +1 -1
- metadata +4 -5
- data/debug.log +0 -941
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 178317a43fb02ed49d4eb27f1a025e8f62d5c4d0
|
4
|
+
data.tar.gz: c70b4668ae2e493fa210329edb3dff36a2e77bbc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df41060d1e8712890643f19f2444eef2df81d12224655169a3637128fc629786de900c37fbeac16773d668a18d03b986266bbd2531b0c462aae57495e0966ba2
|
7
|
+
data.tar.gz: cc37ea2f852f56da279a4697b656187842d94e924bf00b897dbe63083f51ccb267d8587eb3e5c473eda5c661cbd4fb43d898845da3064c893e5e3a0ebcccca0a
|
data/README.md
CHANGED
@@ -1,26 +1,41 @@
|
|
1
1
|
# Vagrant Parallels Provider
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/vagrant-parallels.png)](http://badge.fury.io/rb/vagrant-parallels)
|
2
3
|
[![Build Status](https://travis-ci.org/Parallels/vagrant-parallels.png?branch=master)](https://travis-ci.org/Parallels/vagrant-parallels)
|
3
4
|
[![Code Climate](https://codeclimate.com/github/Parallels/vagrant-parallels.png)](https://codeclimate.com/github/Parallels/vagrant-parallels)
|
4
5
|
|
5
|
-
This is a
|
6
|
-
|
6
|
+
This is a plugin for [Vagrant](http://www.vagrantup.com),
|
7
|
+
allowing to power virtual machines by
|
8
|
+
[Parallels Desktop for Mac](http://www.parallels.com/downloads/desktop/).
|
7
9
|
|
8
|
-
|
10
|
+
### Requirements
|
11
|
+
- Parallels Desktop for Mac 8 or 9
|
12
|
+
- Vagrant v1.4 or higher
|
9
13
|
|
10
|
-
|
11
|
-
|
14
|
+
If you're just getting started with Vagrant, it is highly recommended that you
|
15
|
+
read the official [Vagrant documentation](http://docs.vagrantup.com/v2/) first.
|
12
16
|
|
13
|
-
|
17
|
+
## Features
|
18
|
+
Parallels provider supports all basic Vagrant features, except one: **"Forwarded ports" configuration is not available yet**.
|
19
|
+
|
20
|
+
It might be implemented in the future, after the next release of Parallels Desktop for Mac.
|
14
21
|
|
15
22
|
## Installation
|
16
|
-
|
17
|
-
|
23
|
+
First of all make sure that you have [Parallels Desktop for Mac](http://www.parallels.com/products/desktop/)
|
24
|
+
and [Vagrant](http://www.vagrantup.com/downloads) properly installed.
|
25
|
+
We recommend that you use the latest versions of these products.
|
26
|
+
|
27
|
+
Since Parallels provider is a Vagrant plugin, installing is easy:
|
18
28
|
|
19
|
-
|
20
|
-
|
29
|
+
```
|
30
|
+
$ vagrant plugin install vagrant-parallels
|
31
|
+
```
|
21
32
|
|
22
33
|
## Usage
|
23
|
-
|
34
|
+
Parallels provider is used just like any other provider. Please read the general
|
35
|
+
[basic usage](http://docs.vagrantup.com/v2/providers/basic_usage.html) page for
|
36
|
+
providers.
|
37
|
+
|
38
|
+
The value to use for the `--provider` flag is `parallels`:
|
24
39
|
|
25
40
|
```
|
26
41
|
$ vagrant init
|
@@ -28,43 +43,52 @@ $ vagrant up --provider=parallels
|
|
28
43
|
...
|
29
44
|
```
|
30
45
|
|
31
|
-
You need to have a parallels compatible box specified in your `Vagrantfile`
|
46
|
+
You need to have a parallels compatible box specified in your `Vagrantfile`
|
47
|
+
before doing a `vagrant up`, please refer to the *Boxes* section for instructions.
|
32
48
|
|
33
49
|
### Default Provider
|
34
50
|
|
35
|
-
|
36
|
-
|
37
|
-
|
51
|
+
You can use `VAGRANT_DEFAULT_PROVIDER` environmental variable to specify the
|
52
|
+
default provider. Just set it to `parallels` and then it wont be necessary
|
53
|
+
to add `--provider` flag to vagrant commands.
|
38
54
|
|
39
55
|
```
|
40
|
-
|
41
|
-
echo "export VAGRANT_DEFAULT_PROVIDER=parallels" | tee -a ~/.bashrc
|
42
|
-
source ~/.bashrc
|
56
|
+
export VAGRANT_DEFAULT_PROVIDER=parallels
|
43
57
|
```
|
44
58
|
|
45
|
-
|
59
|
+
You can also add this command to your `~/.bashrc` file
|
60
|
+
(or `~/.zshrc` if your shell is Zsh) to make this setting permanent.
|
46
61
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
62
|
+
## Boxes
|
63
|
+
|
64
|
+
Every provider in Vagrant must introduce a custom box format.
|
65
|
+
|
66
|
+
As with every provider, Parallels provider has a custom box format.
|
67
|
+
There is a list of popular base boxes for Parallels provider:
|
68
|
+
|
69
|
+
- Ubuntu 12.04 x86_64:
|
70
|
+
[http://download.parallels.com/desktop/vagrant/precise64.box]
|
71
|
+
(http://download.parallels.com/desktop/vagrant/precise64.box)
|
52
72
|
|
53
|
-
|
73
|
+
- Ubuntu 13.10 x86_64:
|
74
|
+
[http://download.parallels.com/desktop/vagrant/saucy64.box]
|
75
|
+
(http://download.parallels.com/desktop/vagrant/saucy64.box)
|
54
76
|
|
55
|
-
|
56
|
-
|
77
|
+
- CentOS 6.5 x86_64:-
|
78
|
+
[http://download.parallels.com/desktop/vagrant/CentOS-6.5-x86_64.box]
|
79
|
+
(http://download.parallels.com/desktop/vagrant/CentOS-6.5-x86_64.box)
|
57
80
|
|
58
|
-
|
81
|
+
- CentOS 5.9 x86_64:-
|
82
|
+
[http://download.parallels.com/desktop/vagrant/CentOS-5.9-x86_64.box]
|
83
|
+
(http://download.parallels.com/desktop/vagrant/CentOS-5.9-x86_64.box)
|
84
|
+
|
85
|
+
|
86
|
+
You can add one of these boxes using the next command:
|
59
87
|
|
60
88
|
```
|
61
89
|
$ vagrant box add --provider=parallels precise64 http://download.parallels.com/desktop/vagrant/precise64.box
|
62
90
|
```
|
63
91
|
|
64
|
-
The box format is basically just the required `metadata.json` file
|
65
|
-
along with a `Vagrantfile` that does default settings for the
|
66
|
-
provider-specific configuration for this provider.
|
67
|
-
|
68
92
|
## Networking
|
69
93
|
By default Vagrant Parallels provider uses the basic Vagrant networking
|
70
94
|
approach. Initially VM has one adapter assigned to the 'Shared' network
|
@@ -114,14 +138,14 @@ end
|
|
114
138
|
|
115
139
|
## Development
|
116
140
|
|
117
|
-
To work on the `vagrant-parallels` plugin, clone this repository
|
141
|
+
To work on the `vagrant-parallels` plugin development, clone this repository:
|
118
142
|
|
119
143
|
```
|
120
144
|
$ git clone https://github.com/Parallels/vagrant-parallels
|
121
145
|
$ cd vagrant-parallels
|
122
146
|
```
|
123
147
|
|
124
|
-
Use [Bundler](http://gembundler.com) to get the dependencies:
|
148
|
+
Use [Bundler](http://gembundler.com) to get the dependencies (Ruby 2.0 is needed):
|
125
149
|
|
126
150
|
```
|
127
151
|
$ bundle
|
@@ -135,14 +159,14 @@ $ bundle exec rake
|
|
135
159
|
|
136
160
|
If those pass, you're ready to start developing the plugin. You can test
|
137
161
|
the plugin without installing it into your Vagrant environment by just
|
138
|
-
creating a `Vagrantfile` in the top level of this directory (it is
|
162
|
+
creating a `Vagrantfile` in the top level of this directory (it is added to *.gitignore*)
|
139
163
|
and add the following line to your `Vagrantfile`
|
140
164
|
|
141
165
|
```ruby
|
142
166
|
Vagrant.require_plugin "vagrant-parallels"
|
143
167
|
```
|
144
168
|
|
145
|
-
You need to have a compatible box file installed, refer to
|
169
|
+
You need to have a compatible box file installed, refer to the *Boxes* section
|
146
170
|
|
147
171
|
Use bundler to execute Vagrant:
|
148
172
|
|
@@ -150,29 +174,48 @@ Use bundler to execute Vagrant:
|
|
150
174
|
$ bundle exec vagrant up --provider=parallels
|
151
175
|
```
|
152
176
|
|
153
|
-
|
154
|
-
|
177
|
+
###Installing Parallels Provider From Source
|
178
|
+
|
179
|
+
If you want to globally install your locally built plugin from source, use the following method:
|
155
180
|
|
156
181
|
```
|
157
|
-
$ git clone https://github.com/Parallels/vagrant-parallels
|
158
182
|
$ cd vagrant-parallels
|
159
|
-
$
|
183
|
+
$ bundle install
|
160
184
|
...
|
161
|
-
$
|
185
|
+
$ bundle exec rake build
|
186
|
+
...
|
187
|
+
$ vagrant plugin install pkg/vagrant-parallels-<version>.gem
|
162
188
|
...
|
163
189
|
```
|
164
|
-
So, now that you have your own plugin installed, check it with the command
|
190
|
+
So, now that you have your own plugin installed, check it with the command
|
191
|
+
`vagrant plugin list`
|
192
|
+
|
193
|
+
## Contributing
|
194
|
+
|
195
|
+
1. Fork it.
|
196
|
+
2. Create a branch (`git checkout -b my-new-feature`)
|
197
|
+
3. Commit your changes (`git commit -am "Added a sweet feature"`)
|
198
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
199
|
+
5. Create a pull request from your `my-new-feature` branch into master
|
200
|
+
|
201
|
+
## Getting help
|
202
|
+
Having problems while using our provider? Ask your question to our mailing list:
|
203
|
+
[Google Group](https://groups.google.com/group/vagrant-parallels)
|
204
|
+
|
205
|
+
If you've got a strange error while using Parallels provider, or found a bug
|
206
|
+
there - please, report it on [Issue Tracker](https://github.com/Parallels/vagrant-parallels).
|
165
207
|
|
166
|
-
##
|
208
|
+
## Credits
|
209
|
+
Great thanks to *Youssef Shahin* `@yshahin` for having initiated the development
|
210
|
+
of this provider. You've done a great job, Youssef!
|
167
211
|
|
168
|
-
|
212
|
+
Also, thanks to the people who helping this project stand on its feet, thank you
|
169
213
|
|
170
|
-
* Youssef Shahin `@yshahin` - plugin's author
|
171
214
|
* Mikhail Zholobov `@legal90`
|
172
215
|
* Kevin Kaland `@wizonesolutions`
|
173
216
|
* Konstantin Nazarov `@racktear`
|
174
217
|
* Dmytro Vasylenko `@odi-um`
|
175
218
|
* Thomas Koschate `@koschate`
|
176
219
|
|
177
|
-
and to all the people who are using and testing this provider
|
220
|
+
and to all the people who are using and testing this provider.
|
178
221
|
|
data/Rakefile
CHANGED
@@ -153,9 +153,9 @@ module VagrantPlugins
|
|
153
153
|
|
154
154
|
# Search for a matching bridged interface
|
155
155
|
bridgedifs.each do |interface|
|
156
|
-
if
|
156
|
+
if interface[:name].downcase == config[:bridge].downcase
|
157
157
|
@logger.debug("Specific bridge found as configured in the Vagrantfile. Using it.")
|
158
|
-
chosen_bridge = interface
|
158
|
+
chosen_bridge = interface[:name]
|
159
159
|
break
|
160
160
|
end
|
161
161
|
end
|
@@ -174,7 +174,7 @@ module VagrantPlugins
|
|
174
174
|
if !chosen_bridge
|
175
175
|
if bridgedifs.length == 1
|
176
176
|
# One bridgable interface? Just use it.
|
177
|
-
chosen_bridge = bridgedifs[0]
|
177
|
+
chosen_bridge = bridgedifs[0][:name]
|
178
178
|
@logger.debug("Only one bridged interface available. Using it by default.")
|
179
179
|
else
|
180
180
|
# More than one bridgable interface requires a user decision, so
|
@@ -196,18 +196,17 @@ module VagrantPlugins
|
|
196
196
|
choice = choice.to_i
|
197
197
|
end
|
198
198
|
|
199
|
-
chosen_bridge = bridgedifs[choice - 1]
|
199
|
+
chosen_bridge = bridgedifs[choice - 1][:name]
|
200
200
|
end
|
201
201
|
end
|
202
202
|
|
203
|
-
@logger.info("Bridging adapter #{config[:adapter]} to #{chosen_bridge
|
203
|
+
@logger.info("Bridging adapter #{config[:adapter]} to #{chosen_bridge}")
|
204
204
|
|
205
205
|
# Given the choice we can now define the adapter we're using
|
206
206
|
return {
|
207
207
|
:adapter => config[:adapter],
|
208
208
|
:type => :bridged,
|
209
|
-
:bridge => chosen_bridge
|
210
|
-
:bound_to => chosen_bridge[:bound_to],
|
209
|
+
:bridge => chosen_bridge,
|
211
210
|
:mac_address => config[:mac],
|
212
211
|
:nic_type => config[:nic_type]
|
213
212
|
}
|
@@ -321,7 +320,6 @@ module VagrantPlugins
|
|
321
320
|
return {
|
322
321
|
:adapter => config[:adapter],
|
323
322
|
:hostonly => interface[:name],
|
324
|
-
:bound_to => interface[:bound_to],
|
325
323
|
:mac => config[:mac],
|
326
324
|
:nic_type => config[:nic_type],
|
327
325
|
:type => :hostonly
|
@@ -392,7 +390,7 @@ module VagrantPlugins
|
|
392
390
|
end
|
393
391
|
|
394
392
|
# This determines the next free network name
|
395
|
-
def
|
393
|
+
def next_network_id
|
396
394
|
# Get the list of numbers
|
397
395
|
net_nums = []
|
398
396
|
@env[:machine].provider.driver.read_virtual_networks.each do |net|
|
@@ -416,7 +414,7 @@ module VagrantPlugins
|
|
416
414
|
# This creates a host only network for the given configuration.
|
417
415
|
def hostonly_create_network(config)
|
418
416
|
options = {
|
419
|
-
:
|
417
|
+
:network_id => next_network_id,
|
420
418
|
:adapter_ip => config[:adapter_ip],
|
421
419
|
:netmask => config[:netmask],
|
422
420
|
}
|
@@ -41,7 +41,7 @@ module VagrantPlugins
|
|
41
41
|
|
42
42
|
def create_host_only_network(options)
|
43
43
|
# Create the interface
|
44
|
-
execute(:prlsrvctl, "net", "add", options[:
|
44
|
+
execute(:prlsrvctl, "net", "add", options[:network_id], "--type", "host-only")
|
45
45
|
|
46
46
|
# Configure it
|
47
47
|
args = ["--ip", "#{options[:adapter_ip]}/#{options[:netmask]}"]
|
@@ -51,16 +51,15 @@ module VagrantPlugins
|
|
51
51
|
"--ip-scope-end", options[:dhcp][:upper]])
|
52
52
|
end
|
53
53
|
|
54
|
-
execute(:prlsrvctl, "net", "set", options[:
|
54
|
+
execute(:prlsrvctl, "net", "set", options[:network_id], *args)
|
55
55
|
|
56
56
|
# Determine interface to which it has been bound
|
57
|
-
net_info = json { execute(:prlsrvctl, 'net', 'info', options[:
|
58
|
-
|
57
|
+
net_info = json { execute(:prlsrvctl, 'net', 'info', options[:network_id], '--json', retryable: true) }
|
58
|
+
iface_name = net_info['Bound To']
|
59
59
|
|
60
60
|
# Return the details
|
61
61
|
return {
|
62
|
-
:name =>
|
63
|
-
:bound_to => bound_to,
|
62
|
+
:name => iface_name,
|
64
63
|
:ip => options[:adapter_ip],
|
65
64
|
:netmask => options[:netmask],
|
66
65
|
:dhcp => options[:dhcp]
|
@@ -123,15 +122,15 @@ module VagrantPlugins
|
|
123
122
|
args.concat(["--device-add", "net"])
|
124
123
|
end
|
125
124
|
|
126
|
-
if adapter[:
|
125
|
+
if adapter[:type] == :hostonly
|
127
126
|
# Oddly enough, but there is a 'bridge' anyway.
|
128
127
|
# The only difference is the destination interface:
|
129
128
|
# - in host-only (private) network it will be bridged to the 'vnicX' device
|
130
129
|
# - in real bridge (public) network it will be bridged to the assigned device
|
131
|
-
args.concat(["--type", "bridged", "--iface", adapter[:
|
132
|
-
|
133
|
-
|
134
|
-
|
130
|
+
args.concat(["--type", "bridged", "--iface", adapter[:hostonly]])
|
131
|
+
elsif adapter[:type] == :bridge
|
132
|
+
args.concat(["--type", "bridged", "--iface", adapter[:bridge]])
|
133
|
+
elsif adapter[:type] == :shared
|
135
134
|
args.concat(["--type", "shared"])
|
136
135
|
end
|
137
136
|
|
@@ -199,8 +198,7 @@ module VagrantPlugins
|
|
199
198
|
info = {}
|
200
199
|
ifconfig = execute(:ifconfig, iface['Bound To'])
|
201
200
|
# Assign default values
|
202
|
-
info[:name] = iface['
|
203
|
-
info[:bound_to] = iface['Bound To']
|
201
|
+
info[:name] = iface['Bound To']
|
204
202
|
info[:ip] = "0.0.0.0"
|
205
203
|
info[:netmask] = "0.0.0.0"
|
206
204
|
info[:status] = "Down"
|
@@ -235,8 +233,7 @@ module VagrantPlugins
|
|
235
233
|
info = {}
|
236
234
|
net_info = json { execute(:prlsrvctl, 'net', 'info', iface['Network ID'], '--json') }
|
237
235
|
# Really we need to work with bounded virtual interface
|
238
|
-
info[:name] = net_info['
|
239
|
-
info[:bound_to] = net_info['Bound To']
|
236
|
+
info[:name] = net_info['Bound To']
|
240
237
|
info[:ip] = net_info['Parallels adapter']['IP address']
|
241
238
|
info[:netmask] = net_info['Parallels adapter']['Subnet mask']
|
242
239
|
# Such interfaces are always in 'Up'
|
@@ -41,7 +41,7 @@ module VagrantPlugins
|
|
41
41
|
|
42
42
|
def create_host_only_network(options)
|
43
43
|
# Create the interface
|
44
|
-
execute(:prlsrvctl, "net", "add", options[:
|
44
|
+
execute(:prlsrvctl, "net", "add", options[:network_id], "--type", "host-only")
|
45
45
|
|
46
46
|
# Configure it
|
47
47
|
args = ["--ip", "#{options[:adapter_ip]}/#{options[:netmask]}"]
|
@@ -51,16 +51,15 @@ module VagrantPlugins
|
|
51
51
|
"--ip-scope-end", options[:dhcp][:upper]])
|
52
52
|
end
|
53
53
|
|
54
|
-
execute(:prlsrvctl, "net", "set", options[:
|
54
|
+
execute(:prlsrvctl, "net", "set", options[:network_id], *args)
|
55
55
|
|
56
56
|
# Determine interface to which it has been bound
|
57
|
-
net_info = json { execute(:prlsrvctl, 'net', 'info', options[:
|
58
|
-
|
57
|
+
net_info = json { execute(:prlsrvctl, 'net', 'info', options[:network_id], '--json', retryable: true) }
|
58
|
+
iface_name = net_info['Bound To']
|
59
59
|
|
60
60
|
# Return the details
|
61
61
|
return {
|
62
|
-
:name =>
|
63
|
-
:bound_to => bound_to,
|
62
|
+
:name => iface_name,
|
64
63
|
:ip => options[:adapter_ip],
|
65
64
|
:netmask => options[:netmask],
|
66
65
|
:dhcp => options[:dhcp]
|
@@ -123,15 +122,15 @@ module VagrantPlugins
|
|
123
122
|
args.concat(["--device-add", "net"])
|
124
123
|
end
|
125
124
|
|
126
|
-
if adapter[:
|
125
|
+
if adapter[:type] == :hostonly
|
127
126
|
# Oddly enough, but there is a 'bridge' anyway.
|
128
127
|
# The only difference is the destination interface:
|
129
128
|
# - in host-only (private) network it will be bridged to the 'vnicX' device
|
130
129
|
# - in real bridge (public) network it will be bridged to the assigned device
|
131
|
-
args.concat(["--type", "bridged", "--iface", adapter[:
|
132
|
-
|
133
|
-
|
134
|
-
|
130
|
+
args.concat(["--type", "bridged", "--iface", adapter[:hostonly]])
|
131
|
+
elsif adapter[:type] == :bridge
|
132
|
+
args.concat(["--type", "bridged", "--iface", adapter[:bridge]])
|
133
|
+
elsif adapter[:type] == :shared
|
135
134
|
args.concat(["--type", "shared"])
|
136
135
|
end
|
137
136
|
|
@@ -199,8 +198,7 @@ module VagrantPlugins
|
|
199
198
|
info = {}
|
200
199
|
ifconfig = execute(:ifconfig, iface['Bound To'])
|
201
200
|
# Assign default values
|
202
|
-
info[:name] = iface['
|
203
|
-
info[:bound_to] = iface['Bound To']
|
201
|
+
info[:name] = iface['Bound To']
|
204
202
|
info[:ip] = "0.0.0.0"
|
205
203
|
info[:netmask] = "0.0.0.0"
|
206
204
|
info[:status] = "Down"
|
@@ -235,8 +233,7 @@ module VagrantPlugins
|
|
235
233
|
info = {}
|
236
234
|
net_info = json { execute(:prlsrvctl, 'net', 'info', iface['Network ID'], '--json') }
|
237
235
|
# Really we need to work with bounded virtual interface
|
238
|
-
info[:name] = net_info['
|
239
|
-
info[:bound_to] = net_info['Bound To']
|
236
|
+
info[:name] = net_info['Bound To']
|
240
237
|
info[:ip] = net_info['Parallels adapter']['IP address']
|
241
238
|
info[:netmask] = net_info['Parallels adapter']['Subnet mask']
|
242
239
|
# Such interfaces are always in 'Up'
|
@@ -4,25 +4,35 @@ module VagrantPlugins
|
|
4
4
|
class MountParallelsSharedFolder
|
5
5
|
|
6
6
|
def self.mount_parallels_shared_folder(machine, name, guestpath, options)
|
7
|
+
# Expand the guest path so we can handle things like "~/vagrant"
|
8
|
+
expanded_guest_path = machine.guest.capability(
|
9
|
+
:shell_expand_guest_path, guestpath)
|
10
|
+
|
7
11
|
machine.communicate.tap do |comm|
|
8
12
|
# clear prior symlink
|
9
|
-
if comm.test("test -L \"#{
|
10
|
-
comm.sudo("rm \"#{
|
13
|
+
if comm.test("test -L \"#{expanded_guest_path}\"", :sudo => true)
|
14
|
+
comm.sudo("rm \"#{expanded_guest_path}\"")
|
11
15
|
end
|
12
16
|
|
13
17
|
# clear prior directory if exists
|
14
|
-
if comm.test("test -d \"#{
|
15
|
-
comm.sudo("rm -Rf \"#{
|
18
|
+
if comm.test("test -d \"#{expanded_guest_path}\"", :sudo => true)
|
19
|
+
comm.sudo("rm -Rf \"#{expanded_guest_path}\"")
|
16
20
|
end
|
17
21
|
|
18
22
|
# create intermediate directories if needed
|
19
|
-
intermediate_dir = File.dirname(
|
23
|
+
intermediate_dir = File.dirname(expanded_guest_path)
|
20
24
|
if !comm.test("test -d \"#{intermediate_dir}\"", :sudo => true)
|
21
25
|
comm.sudo("mkdir -p \"#{intermediate_dir}\"")
|
22
26
|
end
|
23
27
|
|
24
28
|
# finally make the symlink
|
25
|
-
comm.sudo("ln -s \"/media/psf/#{name}\" \"#{
|
29
|
+
comm.sudo("ln -s \"/media/psf/#{name}\" \"#{expanded_guest_path}\"")
|
30
|
+
|
31
|
+
# Emit an upstart event if we can
|
32
|
+
if comm.test("test -x /sbin/initctl")
|
33
|
+
comm.sudo(
|
34
|
+
"/sbin/initctl emit --no-wait vagrant-mounted MOUNTPOINT=#{expanded_guest_path}")
|
35
|
+
end
|
26
36
|
end
|
27
37
|
end
|
28
38
|
end
|