Class: VagrantPlugins::Vmpooler::Action::SetupRsync

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-vmpooler/action/setup_rsync.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ SetupRsync

Returns a new instance of SetupRsync.



6
7
8
9
# File 'lib/vagrant-vmpooler/action/setup_rsync.rb', line 6

def initialize(app, env)
  @app = app
  @logger = Log4r::Logger.new("vagrant_vmpooler::action::setup_rsync")
end

Instance Method Details

#call(env) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/vagrant-vmpooler/action/setup_rsync.rb', line 23

def call(env)
  ssh_info = env[:machine].ssh_info
  os_flavor = env[:machine].provider_config.os
  cmd_install_rsync = determine_packman(os_flavor)

  if cmd_install_rsync
    env[:ui].info(I18n.t("vagrant_vmpooler.install_rsync"))
    env[:machine].communicate.execute(cmd_install_rsync, :error_check => true)
  else
    env[:ui].warn(I18n.t("vagrant_vmpooler.no_install_rsync"))
  end

  @app.call(env)
end

#determine_packman(os_flavor) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/vagrant-vmpooler/action/setup_rsync.rb', line 11

def determine_packman(os_flavor)
  if os_flavor =~ /centos|fedora|redhat/i
    cmd_install_rsync = "yum install rsync.x86_64 -y"
  elsif os_flavor =~ /debian|ubuntu/i
    cmd_install_rsync = "apt-get install rsync -y"
  else
    cmd_install_rsync = nil
  end

  cmd_install_rsync
end