-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cap: add sshfs_get_absolute_path guest capability
- Loading branch information
Showing
4 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
lib/vagrant-sshfs/cap/guest/linux/sshfs_get_absolute_path.rb
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,25 @@ | ||
module VagrantPlugins | ||
module GuestLinux | ||
module Cap | ||
class SSHFSGetAbsolutePath | ||
def self.sshfs_get_absolute_path(machine, path) | ||
abs_path = "" | ||
machine.communicate.execute("readlink -f #{path}") do |type, data| | ||
if type == :stdout | ||
abs_path = data | ||
end | ||
end | ||
|
||
if ! abs_path | ||
# If no real absolute path was detected then error out | ||
error_class = VagrantPlugins::SyncedFolderSSHFS::Errors::SSHFSGetAbsolutePathFailed | ||
raise error_class, path: path | ||
end | ||
|
||
# Chomp the string so that any trailing newlines are killed | ||
return abs_path.chomp | ||
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