Skip to content

Commit

Permalink
sshfs_mount: improve log message output based on mount type
Browse files Browse the repository at this point in the history
For normal mounts it will now output user/host information as well
  • Loading branch information
dustymabe committed Mar 30, 2016
1 parent 7676951 commit 941ec99
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
12 changes: 8 additions & 4 deletions lib/vagrant-sshfs/cap/linux/sshfs_mount.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ def self.sshfs_mount_folder(machine, opts)
hostpath = opts[:hostpath].dup
hostpath.gsub!("'", "'\\\\''")

# Log some information
machine.ui.info(I18n.t("vagrant.sshfs.actions.mounting_folder",
hostpath: hostpath, guestpath: expanded_guest_path))

# Add in some sshfs/fuse options that are common to both mount methods
opts[:sshfs_opts] = ' -o allow_other ' # allow non-root users to access
opts[:sshfs_opts]+= ' -o noauto_cache '# disable caching based on mtime
Expand Down Expand Up @@ -100,8 +96,11 @@ def self.sshfs_slave_mount(machine, opts, hostpath, expanded_guest_path)
ssh_cmd = ssh_path + ssh_opts + machine.ssh_info[:host]
ssh_cmd+= ' "' + sshfs_cmd + '"'

# Log some information
@@logger.debug("sftp-server cmd: #{sftp_server_cmd}")
@@logger.debug("ssh cmd: #{ssh_cmd}")
machine.ui.info(I18n.t("vagrant.sshfs.actions.slave_mounting_folder",
hostpath: hostpath, guestpath: expanded_guest_path))

# Create two named pipes for communication between sftp-server and
# sshfs running in slave mode
Expand Down Expand Up @@ -171,6 +170,11 @@ def self.sshfs_normal_mount(machine, opts, hostpath, expanded_guest_path)
echopipe = "echo '#{password}' | "
sshfs_opts+= '-o password_stdin '
end

# Log some information
machine.ui.info(I18n.t("vagrant.sshfs.actions.normal_mounting_folder",
user: username, host: host,
hostpath: hostpath, guestpath: expanded_guest_path))

# Build up the command and connect
error_class = VagrantPlugins::SyncedFolderSSHFS::Errors::SSHFSNormalMountFailed
Expand Down
4 changes: 3 additions & 1 deletion locales/synced_folder_sshfs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ en:
actions:
installing: Installing SSHFS client...
mounting: Mounting SSHFS shared folders...
mounting_folder: |-
slave_mounting_folder: |-
Mounting folder via SSHFS: %{hostpath} => %{guestpath}
normal_mounting_folder: |-
Mounting folder via SSHFS: %{user}@%{host}:%{hostpath} => %{guestpath}
ask:
prompt_for_password: |-
SSHFS password for '%{username}':
Expand Down

0 comments on commit 941ec99

Please sign in to comment.