Skip to content

Commit

Permalink
Fix lingering whitespaces at end of lines
Browse files Browse the repository at this point in the history
  • Loading branch information
the-eater committed May 18, 2017
1 parent 0c53e4f commit fb2661b
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 51 deletions.
12 changes: 6 additions & 6 deletions features/sshfs_cwd_mount.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
# human readable. All Gherkin files have a .feature extension
#
# See more here: https://en.wikipedia.org/wiki/Cucumber_(software)
#
# Additoinally in the setup/env.rb file we set up Aruba. Aruba is used
# to define most of the basic step definitions that we use as part of
#
# Additoinally in the setup/env.rb file we set up Aruba. Aruba is used
# to define most of the basic step definitions that we use as part of
# the Gherkin syntax in this file.
#
# For more information on the step definitions provided see:
Expand All @@ -21,7 +21,7 @@ Feature: SSHFS mount of vagrant current working directory
# Disable the default rsync
config.vm.synced_folder '.', '/vagrant', disabled: true
# If using libvirt and nested virt (vagrant in vagrant) then
# If using libvirt and nested virt (vagrant in vagrant) then
# we need to use a different network than 192.168.121.0
config.vm.provider :libvirt do |libvirt|
libvirt.management_network_name = 'vagrant-libvirt-test'
Expand All @@ -42,5 +42,5 @@ Feature: SSHFS mount of vagrant current working directory
Examples:
| box |
| centos/7 |


6 changes: 3 additions & 3 deletions features/step_definitions/sshfs_cwd_mount_steps.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This is a cucumber step definition. Cucumber scenarios become automated
# tests with the addition of what are called step definitions. A step
# definition is a block of code associated with one or more steps by a
# This is a cucumber step definition. Cucumber scenarios become automated
# tests with the addition of what are called step definitions. A step
# definition is a block of code associated with one or more steps by a
# regular expression (or, in simple cases, a string).
#
# This is the step definition for the `And vagrant current working
Expand Down
4 changes: 2 additions & 2 deletions lib/vagrant-sshfs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
raise "The Vagrant sshfs plugin must be run within Vagrant"
end

# Only load the gem on Windows since it replaces some methods in Ruby's
# Process class. Also load it here before Process.uid is called the first
# Only load the gem on Windows since it replaces some methods in Ruby's
# Process class. Also load it here before Process.uid is called the first
# time by Vagrant. The Process.create() function actually gets used in
# lib/vagrant-sshfs/cap/guest/linux/sshfs_forward_mount.rb
if Vagrant::Util::Platform.windows?
Expand Down
46 changes: 23 additions & 23 deletions lib/vagrant-sshfs/cap/guest/linux/sshfs_forward_mount.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def self.sshfs_forward_mount_folder(machine, opts)
# opts contains something like:
# { :type=>:sshfs,
# :guestpath=>"/sharedfolder",
# :hostpath=>"/guests/sharedfolder",
# :hostpath=>"/guests/sharedfolder",
# :disabled=>false
# :ssh_host=>"192.168.1.1"
# :ssh_port=>"22"
Expand All @@ -79,7 +79,7 @@ def self.sshfs_forward_mount_folder(machine, opts)
opts[:sshfs_opts]+= ' -o noauto_cache '# disable caching based on mtime

# Add in some ssh options that are common to both mount methods
opts[:ssh_opts] = ' -o StrictHostKeyChecking=no '# prevent yes/no question
opts[:ssh_opts] = ' -o StrictHostKeyChecking=no '# prevent yes/no question
opts[:ssh_opts]+= ' -o ServerAliveInterval=30 ' # send keepalives

# Do a normal mount only if the user provided host information
Expand Down Expand Up @@ -120,25 +120,25 @@ def self.sshfs_forward_unmount_folder(machine, opts)
protected

def self.windows_uninherit_handles(machine)
# For win32-process Process.create, if we pass any file handles to the
# underlying process for stdin/stdout/stderr then all file handles are
# For win32-process Process.create, if we pass any file handles to the
# underlying process for stdin/stdout/stderr then all file handles are
# inherited by default. We'll explicitly go through and set all Handles
# to not be inheritable by default. See following links for more info
#
#
# https://github.com/djberg96/win32-process/blob/6b380f450aebb69d44bb7accd958ecb6b9e1d246/lib/win32/process.rb#L445-L447
# bInheritHandles from https://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
#
#
# In 6f285cd we made it so that we would uninherit all filehandles by
# default on windows. Some users have reported that this operation
# is erroring because `The parameter is incorrect.`. See #52
# We will make the uninheriting operation best effort. The rationale
# is that if a file handle was not able to be set to uninheritable
# We will make the uninheriting operation best effort. The rationale
# is that if a file handle was not able to be set to uninheritable
# then it probably wasn't one that would get inherited in the first place.
#
# For each open IO object
# For each open IO object
ObjectSpace.each_object(IO) do |io|
if !io.closed?
fileno = io.fileno
fileno = io.fileno
@@logger.debug("Setting file handle #{fileno} to not be inherited")
begin
self.windows_uninherit_handle(fileno)
Expand All @@ -155,7 +155,7 @@ def self.windows_uninherit_handles(machine)

def self.windows_uninherit_handle(fileno)
# Right now we'll be doing this using private methods from the win32-process
# module by calling For each open IO object. Much of this code was copied from
# module by calling For each open IO object. Much of this code was copied from
# that module. We access the private methods by using the object.send(:method, args)
# technique. In the future we want to get a patch upstream so we don't need to
# access private methods. Upstream request is here:
Expand All @@ -174,15 +174,15 @@ def self.windows_uninherit_handle(fileno)
end

# Now clear the HANDLE_FLAG_INHERIT from the HANDLE so that the handle
# won't get shared by default. See:
# won't get shared by default. See:
# https://msdn.microsoft.com/en-us/library/windows/desktop/ms724935(v=vs.85).aspx
#
#
bool = Process.send(:SetHandleInformation, handle,
Process::Constants::HANDLE_FLAG_INHERIT, 0)
raise SystemCallError.new("SetHandleInformation", FFI.errno) unless bool
end

# Perform a mount by running an sftp-server on the vagrant host
# Perform a mount by running an sftp-server on the vagrant host
# and piping stdin/stdout to sshfs running inside the guest
def self.sshfs_slave_mount(machine, opts, hostpath, expanded_guest_path)

Expand All @@ -202,7 +202,7 @@ def self.sshfs_slave_mount(machine, opts, hostpath, expanded_guest_path)

# The remote sshfs command that will run (in slave mode)
sshfs_opts+= ' -o slave '
sshfs_cmd = "sudo -E sshfs :#{hostpath} #{expanded_guest_path}"
sshfs_cmd = "sudo -E sshfs :#{hostpath} #{expanded_guest_path}"
sshfs_cmd+= sshfs_opts + ' ' + sshfs_opts_append + ' '

# The ssh command to connect to guest and then launch sshfs
Expand All @@ -225,7 +225,7 @@ def self.sshfs_slave_mount(machine, opts, hostpath, expanded_guest_path)
# 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",
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
Expand All @@ -244,16 +244,16 @@ def self.sshfs_slave_mount(machine, opts, hostpath, expanded_guest_path)
# The way this works is by hooking up the stdin+stdout of the
# sftp-server process to the stdin+stdout of the sshfs process
# running inside the guest in slave mode. An illustration is below:
#
# stdout => w1 pipe1 r1 => stdin
#
# stdout => w1 pipe1 r1 => stdin
# />------------->==============>----------->\
# / \
# | |
# sftp-server (on vm host) sshfs (inside guest)
# | |
# \ /
# \<-------------<==============<-----------</
# stdin <= r2 pipe2 w2 <= stdout
# stdin <= r2 pipe2 w2 <= stdout
#
# Wire up things appropriately and start up the processes
if Vagrant::Util::Platform.windows?
Expand Down Expand Up @@ -329,13 +329,13 @@ def self.sshfs_normal_mount(machine, opts, hostpath, expanded_guest_path)
end

# Log some information
machine.ui.info(I18n.t("vagrant.sshfs.actions.normal_mounting_folder",
user: username, host: host,
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
cmd = echopipe
cmd = echopipe
cmd+= "sshfs -p #{port} "
cmd+= ssh_opts + ' ' + ssh_opts_append + ' '
cmd+= sshfs_opts + ' ' + sshfs_opts_append + ' '
Expand Down
6 changes: 3 additions & 3 deletions lib/vagrant-sshfs/cap/guest/redhat/sshfs_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module GuestRedHat
module Cap
class SSHFSClient
def self.sshfs_install(machine)
# Install epel rpm if not installed
# Install epel rpm if not installed
if !epel_installed(machine)
epel_install(machine)
end
Expand All @@ -15,7 +15,7 @@ def self.sshfs_install(machine)
def self.sshfs_installed(machine)
machine.communicate.test("rpm -q fuse-sshfs")
end

protected

def self.epel_installed(machine)
Expand All @@ -26,7 +26,7 @@ def self.epel_install(machine)
case machine.guest.capability("flavor")
when :rhel_7
machine.communicate.sudo("rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm")
when :rhel # rhel6
when :rhel # rhel6
machine.communicate.sudo("rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm")
end
end
Expand Down
12 changes: 6 additions & 6 deletions lib/vagrant-sshfs/cap/host/darwin/sshfs_reverse_mount.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def self.sshfs_reverse_mount_folder(env, machine, opts)
# opts contains something like:
# { :type=>:sshfs,
# :guestpath=>"/sharedfolder",
# :hostpath=>"/guests/sharedfolder",
# :hostpath=>"/guests/sharedfolder",
# :disabled=>false
# :ssh_host=>"192.168.1.1"
# :ssh_port=>"22"
Expand All @@ -46,7 +46,7 @@ def self.sshfs_reverse_unmount_folder(env, machine, opts)

protected

# Perform a mount by running an sftp-server on the vagrant host
# Perform a mount by running an sftp-server on the vagrant host
# and piping stdin/stdout to sshfs running inside the guest
def self.sshfs_mount(machine, opts)

Expand All @@ -64,7 +64,7 @@ def self.sshfs_mount(machine, opts)
opts[:sshfs_opts] = ' -o noauto_cache '# disable caching based on mtime

# Add in some ssh options that are common to both mount methods
opts[:ssh_opts] = ' -o StrictHostKeyChecking=no '# prevent yes/no question
opts[:ssh_opts] = ' -o StrictHostKeyChecking=no '# prevent yes/no question
opts[:ssh_opts]+= ' -o ServerAliveInterval=30 ' # send keepalives

# SSH connection options
Expand All @@ -88,12 +88,12 @@ def self.sshfs_mount(machine, opts)
# The sshfs command to mount the guest directory on the host
sshfs_cmd = "#{sshfs_path} #{ssh_opts} #{ssh_opts_append} "
sshfs_cmd+= "#{sshfs_opts} #{sshfs_opts_append} "
sshfs_cmd+= "#{username}@#{host}:#{expanded_guest_path} #{hostpath}"
sshfs_cmd+= "#{username}@#{host}:#{expanded_guest_path} #{hostpath}"

# Log some information
@@logger.debug("sshfs cmd: #{sshfs_cmd}")

machine.ui.info(I18n.t("vagrant.sshfs.actions.reverse_mounting_folder",
machine.ui.info(I18n.t("vagrant.sshfs.actions.reverse_mounting_folder",
hostpath: hostpath, guestpath: expanded_guest_path))

# Log STDERR to predictable files so that we can inspect them
Expand All @@ -104,7 +104,7 @@ def self.sshfs_mount(machine, opts)

# Launch sshfs command to mount guest dir into the host
if Vagrant::Util::Platform.windows?
# Need to handle Windows differently. Kernel.spawn fails to work,
# Need to handle Windows differently. Kernel.spawn fails to work,
# if the shell creating the process is closed.
# See https://github.com/dustymabe/vagrant-sshfs/issues/31
Process.create(:command_line => ssh_cmd,
Expand Down
12 changes: 6 additions & 6 deletions lib/vagrant-sshfs/cap/host/linux/sshfs_reverse_mount.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def self.sshfs_reverse_mount_folder(env, machine, opts)
# opts contains something like:
# { :type=>:sshfs,
# :guestpath=>"/sharedfolder",
# :hostpath=>"/guests/sharedfolder",
# :hostpath=>"/guests/sharedfolder",
# :disabled=>false
# :ssh_host=>"192.168.1.1"
# :ssh_port=>"22"
Expand All @@ -45,7 +45,7 @@ def self.sshfs_reverse_unmount_folder(env, machine, opts)

protected

# Perform a mount by running an sftp-server on the vagrant host
# Perform a mount by running an sftp-server on the vagrant host
# and piping stdin/stdout to sshfs running inside the guest
def self.sshfs_mount(machine, opts)

Expand All @@ -63,7 +63,7 @@ def self.sshfs_mount(machine, opts)
opts[:sshfs_opts] = ' -o noauto_cache '# disable caching based on mtime

# Add in some ssh options that are common to both mount methods
opts[:ssh_opts] = ' -o StrictHostKeyChecking=no '# prevent yes/no question
opts[:ssh_opts] = ' -o StrictHostKeyChecking=no '# prevent yes/no question
opts[:ssh_opts]+= ' -o ServerAliveInterval=30 ' # send keepalives

# SSH connection options
Expand All @@ -87,12 +87,12 @@ def self.sshfs_mount(machine, opts)
# The sshfs command to mount the guest directory on the host
sshfs_cmd = "#{sshfs_path} #{ssh_opts} #{ssh_opts_append} "
sshfs_cmd+= "#{sshfs_opts} #{sshfs_opts_append} "
sshfs_cmd+= "#{username}@#{host}:#{expanded_guest_path} #{hostpath}"
sshfs_cmd+= "#{username}@#{host}:#{expanded_guest_path} #{hostpath}"

# Log some information
@@logger.debug("sshfs cmd: #{sshfs_cmd}")

machine.ui.info(I18n.t("vagrant.sshfs.actions.reverse_mounting_folder",
machine.ui.info(I18n.t("vagrant.sshfs.actions.reverse_mounting_folder",
hostpath: hostpath, guestpath: expanded_guest_path))

# Log STDERR to predictable files so that we can inspect them
Expand All @@ -103,7 +103,7 @@ def self.sshfs_mount(machine, opts)

# Launch sshfs command to mount guest dir into the host
if Vagrant::Util::Platform.windows?
# Need to handle Windows differently. Kernel.spawn fails to work,
# Need to handle Windows differently. Kernel.spawn fails to work,
# if the shell creating the process is closed.
# See https://github.com/dustymabe/vagrant-sshfs/issues/31
Process.create(:command_line => ssh_cmd,
Expand Down
2 changes: 1 addition & 1 deletion lib/vagrant-sshfs/synced_folder/sshfs_forward_mount.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def get_auth_info(machine, opts)
if not opts.has_key?(:ssh_password) or not opts[:ssh_password]
if not ssh_info.has_key?(:forward_agent) or not ssh_info[:forward_agent]
prompt_for_password = true
end
end
end

# Now do the prompt
Expand Down
2 changes: 1 addition & 1 deletion test/misc/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Vagrant.configure(2) do |config|
# https://github.com/dustymabe/vagrant-sshfs/issues/44
config.vm.synced_folder "/etc/", "/sbin/forward_slave_mount_sym_link_test/", type: "sshfs"

# Test a forward normal mount:
# Test a forward normal mount:
# mounting a folder from a 3rd party host into guest
config.vm.synced_folder "/etc/", "/tmp/forward_normal_mount_etc/", type: "sshfs",
ssh_host: ENV['THIRD_PARTY_HOST'],
Expand Down

0 comments on commit fb2661b

Please sign in to comment.