1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[Rackspace|Compute] updated ready method on Image to raise an exception if an error state occurs. This is similar to the behavior of Server.

This commit is contained in:
Kyle Rames 2013-01-15 08:04:56 -06:00
parent 4a1bfa99ed
commit c2122b7ac1

View file

@ -46,9 +46,14 @@ module Fog
metadata.from_hash(hash)
end
def ready?
state == ACTIVE
def ready?(ready_state = ACTIVE, error_states=[ERROR])
if error_states
error_states = Array(error_states)
raise "Image should have transitioned to '#{ready_state}' not '#{state}'" if error_states.include?(state)
end
state == ready_state
end
def destroy
requires :identity