Class: VagrantPlugins::VagrantBosh::Communicator

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-bosh/communicator.rb

Instance Method Summary collapse

Constructor Details

#initialize(machine, ui) ⇒ Communicator

Returns a new instance of Communicator.



6
7
8
9
10
11
# File 'lib/vagrant-bosh/communicator.rb', line 6

def initialize(machine, ui)
  @c = machine.communicate

  @ui = ui.for(:communicator)
  @logger = Log4r::Logger.new("vagrant::provisioners::bosh::communicator")
end

Instance Method Details

#chmod_x(path) ⇒ Object



30
31
32
# File 'lib/vagrant-bosh/communicator.rb', line 30

def chmod_x(path)
  debug_sudo("chmod +x #{path}")
end

#chown(user, group, path, recursive = false) ⇒ Object



34
35
36
# File 'lib/vagrant-bosh/communicator.rb', line 34

def chown(user, group, path, recursive=false)
  debug_sudo("chown #{"-R" if recursive} #{user}:#{group} #{path}")
end

#mkdir_p(path) ⇒ Object



13
14
15
# File 'lib/vagrant-bosh/communicator.rb', line 13

def mkdir_p(path)
  debug_sudo("mkdir -p #{path}")
end

#mv(src_path, dst_path) ⇒ Object



26
27
28
# File 'lib/vagrant-bosh/communicator.rb', line 26

def mv(src_path, dst_path)
  debug_sudo("mv #{src_path} #{dst_path}")
end

#rm_rf(path) ⇒ Object



17
18
19
# File 'lib/vagrant-bosh/communicator.rb', line 17

def rm_rf(path)
  debug_sudo("rm -rf #{path}")
end

#sudo(cmd, &blk) ⇒ Object



38
39
40
# File 'lib/vagrant-bosh/communicator.rb', line 38

def sudo(cmd, &blk)
  debug_sudo(cmd, &blk)
end

#upload(src_path, dst_path) ⇒ Object



21
22
23
24
# File 'lib/vagrant-bosh/communicator.rb', line 21

def upload(src_path, dst_path)
  @ui.debug_msg(:upload, src_path: src_path, dst_path: dst_path)
  @c.upload(src_path, dst_path)
end