Class: EY::CloudClient::Instance

Inherits:
Object
  • Object
show all
Defined in:
lib/engineyard-cloud-client/models/instance.rb

Instance Method Summary collapse

Instance Method Details

#has_app_code?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/engineyard-cloud-client/models/instance.rb', line 9

def has_app_code?
  !["db_master", "db_slave"].include?(role.to_s)
end

#provisioned?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/engineyard-cloud-client/models/instance.rb', line 17

def provisioned?
  hostname && role && status != "starting" # not foolproof, but help throw out bad instances
end

#removeObject



21
22
23
# File 'lib/engineyard-cloud-client/models/instance.rb', line 21

def remove
  environment.remove_instance(self)
end

#running?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/engineyard-cloud-client/models/instance.rb', line 13

def running?
  status == "running"
end

#sort_attributesObject



25
26
27
28
29
# File 'lib/engineyard-cloud-client/models/instance.rb', line 25

def sort_attributes
  # Shift app_master above app since that's how it's usually shown
  sort_role = role == 'app' ? 'app_slave' : role
  [sort_string(sort_role), sort_string(name), sort_string(hostname)]
end