Class: EnvironmentsCommand

Inherits:
Clamp::Command
  • Object
show all
Defined in:
lib/dew/commands/environments.rb

Constant Summary collapse

STATUS_KEYS =

STATUS_KEYS=%w(arch cpu_count cpu_freq disk ec2_cost ip_address load_average mem_available mem_used network processes reboot_required release time_utc updates_available uptime users)

%w(ip_address arch cpu_count cpu_freq disk ec2_cost load_average mem_available mem_used network processes release time_utc uptime)
STATUS_CMD =
"'[ -d ~/.byobu ] || mkdir ~/.byobu; touch ~/.byobu/status; for cmd in #{STATUS_KEYS.join(' ')}; do echo `/usr/lib/byobu/$cmd 2>/dev/null`; done'"

Instance Method Summary collapse

Instance Method Details

#controllerObject



10
11
12
# File 'lib/dew/commands/environments.rb', line 10

def controller
  @controller ||= EnvironmentsController.new
end

#get_server(environment_name, instance_no) ⇒ Object



181
182
183
184
185
186
187
188
189
190
# File 'lib/dew/commands/environments.rb', line 181

def get_server(environment_name, instance_no)
  env = Environment.get(environment_name)
  unless env
    Environment.index
    raise "Unknown environment: #{environment_name}"
  end
  server = env.servers[instance_no - 1]
  raise "Environment only has #{env.servers.length} instances, can't SSH to instance ##{instance}" unless server
  server
end