Module: Vagabond::Actions::SSH

Included in:
Kitchen
Defined in:
lib/vagabond/actions/ssh.rb

Instance Method Summary collapse

Instance Method Details

#_sshObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/vagabond/actions/ssh.rb', line 6

def _ssh
  name_required!
  if(lxc.exists?)
    if(lxc.running?)
      key_path = setup_key!
      ui.info "#{ui.color('Vagabond:', :bold)} SSH connect to: #{ui.color(name, :cyan)}"
      command = ["#{options[:sudo]}ssh root@#{lxc.container_ip(10, true)} -i #{Settings[:ssh_key]} -oStrictHostKeyChecking=no"]
      if(@leftover_args)
        command << "\"#{@leftover_args.join(' ')}\""
      end
      exec command.join(' ')
    else
      ui.error "Node not running: #{name}"
    end
  else
    ui.error "Node not created: #{name}"
  end
end