Class: Rig::Command::Csshx

Inherits:
Abstract
  • Object
show all
Defined in:
lib/rig/command/ssh.rb

Instance Method Summary collapse

Methods inherited from Abstract

#instance_list, #print_table

Instance Method Details

#executeObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/rig/command/ssh.rb', line 31

def execute
  unless user
    puts "must set rig:ssh:user in configuration."
    exit(1)
  end

  list = Rig::Model::Instance.find_by_environment(environment)
  if list.count == 0
    puts "environment has no servers or not found."
  else
    cmd = "csshX --login #{user} "
    cmd += list.map {|e| "#{e.tags['Name']}.#{Rig.[:dns_zone]}"}.join(" ")
    puts "running command: '#{cmd}'" if verbose?
    exec(cmd)
  end
end