Top Level Namespace

Defined Under Namespace

Modules: Lfstacks Classes: ReimageCommand, RemasterCommand, RepuppetCommand, RsshCommand, S3boxCommand, S3upCommand

Instance Method Summary collapse

Instance Method Details

#cycle_iface(machine, iface) ⇒ Object



18
19
20
21
# File 'lib/vagrant-lfstacks/utils.rb', line 18

def cycle_iface(machine, iface)
  ssh_cmd(machine, "/sbin/ifdown #{iface}")
  ssh_cmd(machine, "/sbin/ifup #{iface}")
end

#get_next_ip(current_ip) ⇒ Object



12
13
14
15
16
# File 'lib/vagrant-lfstacks/utils.rb', line 12

def get_next_ip(current_ip)
  ip = current_ip.split "."
  ip[3] = String(Integer(ip[3])+1)
  ip.join(".")
end

#ssh_cmd(machine, cmd, opts = {}) ⇒ Object



2
3
4
5
6
7
8
9
10
# File 'lib/vagrant-lfstacks/utils.rb', line 2

def ssh_cmd(machine, cmd, opts = {})
  machine.communicate.tap do |comm|
    comm.sudo(cmd, opts) do |type, data|
      if !data.empty?
        machine.env.ui.info(data, :new_line => false, :prefix => false)
      end
    end
  end
end