When a node is powered off, it can be resized to a different instance. This can only occur when the machine is off and therefore a check has been added.
|
def resize_instance(machine) |
|
unless machine.status == 'stopped' |
|
raise RuntimeError, <<~ERROR.chomp |
|
The instance must be stopped to resize it |
|
ERROR |
|
end |
|
|
|
puts "Resizing #{machine.name} to #{instance_type}" |
|
machine.modify_instance_type(instance_type) |
|
end |
This is going to cause issue as it relies on the output from machine.status to be stopped. This is the raw response from AWS and may not work with other providers.
Provider specific implementation should be abstracted into the Cloudware::Providers::<provider interface>::Machine classes. This way the code base is decoupled from idiosyncrasies of the individual providers.
In this case, something to the follow affect should be implemented:
module Cloudware
module Providers
class Base
def is_stopped?
raise NotImplementedError
end
end
class AWSInterface
def is_stopped?
status == 'stopped'
end
end
class AzureInterface
def is_stopped?
...
end
end
end
end
When a node is powered off, it can be resized to a different instance. This can only occur when the machine is off and therefore a check has been added.
flight-cloud/lib/cloudware/commands/power.rb
Lines 111 to 120 in 6a86429
This is going to cause issue as it relies on the output from
machine.statusto bestopped. This is the raw response fromAWSand may not work with other providers.Provider specific implementation should be abstracted into the
Cloudware::Providers::<provider interface>::Machineclasses. This way the code base is decoupled from idiosyncrasies of the individual providers.In this case, something to the follow affect should be implemented: