-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* master: action/force_prl_fs_mount: Added hostpath ensurance & conversion driver/base refactored synced_folders: Workaround for [GH-105]. Multiple mount is available driver: Added method read_shared_folders actions: Added 'force_prl_fs_mount' action [GH-102]
- Loading branch information
Showing
9 changed files
with
119 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
require "log4r" | ||
require 'vagrant/util/platform' | ||
|
||
module VagrantPlugins | ||
module Parallels | ||
module Action | ||
class ForcePrlFsMount | ||
# This middleware forces the prl_fs mount after the Resume, because | ||
# there is bug in Linux guests - custom shared folders are missed after | ||
# the resume [GH-102] | ||
include Vagrant::Action::Builtin::MixinSyncedFolders | ||
|
||
def initialize(app, env) | ||
@app = app | ||
@logger = Log4r::Logger.new("vagrant::plugins::parallels::force_prl_fs_mount") | ||
end | ||
|
||
def call(env) | ||
# Only for Linux guests! | ||
if env[:machine].communicate.test("uname -s | grep 'Linux'") | ||
folders = synced_folders(env[:machine])[:parallels] | ||
|
||
# Go through each folder and make sure to create it if | ||
# it does not exist on host | ||
folders.each do |id, data| | ||
data[:hostpath] = File.expand_path(data[:hostpath], env[:root_path]) | ||
|
||
# Create the hostpath if it doesn't exist and we've been told to | ||
if !File.directory?(data[:hostpath]) && data[:create] | ||
@logger.info("Creating shared folder host directory: #{data[:hostpath]}") | ||
begin | ||
Pathname.new(data[:hostpath]).mkpath | ||
rescue Errno::EACCES | ||
raise Vagrant::Errors::SharedFolderCreateFailed, | ||
path: data[:hostpath] | ||
end | ||
end | ||
|
||
if File.directory?(data[:hostpath]) | ||
data[:hostpath] = File.realpath(data[:hostpath]) | ||
data[:hostpath] = Vagrant::Util::Platform.fs_real_path(data[:hostpath]).to_s | ||
end | ||
end | ||
|
||
opts = nil | ||
instance = VagrantPlugins::Parallels::SyncedFolder.new | ||
instance.enable(env[:machine], folders, opts) | ||
end | ||
|
||
@app.call(env) | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
module VagrantPlugins | ||
module Parallels | ||
VERSION = "1.0.4" | ||
VERSION = "1.0.5" | ||
end | ||
end |