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

changed status to state for conformity and fixed alias for flavor_id

This commit is contained in:
DoubleMalt 2013-03-21 13:28:41 +01:00 committed by Sergio Rubio
parent dcfdf36ba2
commit 2dbf7eff37
6 changed files with 18 additions and 18 deletions

View file

@ -38,7 +38,7 @@ docean.servers.each do |server|
# remember, servers are droplets
server.id
server.name
server.status
server.state
server.backups_enabled
server.image_id
server.flavor_id # server 'size' in DigitalOcean's API parlance

View file

@ -10,10 +10,10 @@ module Fog
identity :id
attribute :name
attribute :status
attribute :state, :aliases => 'status'
attribute :image_id
attribute :region_id
attribute :flavor_id, :aliases => :size_id
attribute :flavor_id, :aliases => 'size_id'
# Not documented in their API, but
# available nevertheless
attribute :ip_address
@ -134,7 +134,7 @@ module Fog
#
# @return [Boolean]
def ready?
status == 'active'
state == 'active'
end
# DigitalOcean API does not support updating server state

View file

@ -21,7 +21,7 @@ Shindo.tests("Fog::Compute[:digitalocean] | server model", ['digitalocean', 'com
attributes = [
:id,
:name,
:status,
:state,
:backups_active,
:ip_address,
:flavor_id,
@ -37,20 +37,20 @@ Shindo.tests("Fog::Compute[:digitalocean] | server model", ['digitalocean', 'com
test('#reboot') do
pending if Fog.mocking?
server.reboot
server.wait_for { server.status == 'off' }
server.status == 'off'
server.wait_for { server.state == 'off' }
server.state == 'off'
end
test('#power_cycle') do
pending if Fog.mocking?
server.wait_for { server.ready? }
server.power_cycle
server.wait_for { server.status == 'off' }
server.status == 'off'
server.wait_for { server.state == 'off' }
server.state == 'off'
end
test('#stop') do
server.stop
server.wait_for { server.status == 'off' }
server.status == 'off'
server.wait_for { server.state == 'off' }
server.state == 'off'
end
test('#start') do
server.start
@ -62,8 +62,8 @@ Shindo.tests("Fog::Compute[:digitalocean] | server model", ['digitalocean', 'com
server.start
server.wait_for { server.ready? }
server.shutdown
server.wait_for { server.status == 'off' }
server.status == 'off'
server.wait_for { server.state == 'off' }
server.state == 'off'
end
test('#update') do
begin

View file

@ -9,8 +9,8 @@ Shindo.tests('Fog::Compute[:digitalocean] | power_cycle_server request', ['digit
service.power_cycle_server(server.id).status == 200
end
test('state is off') do
server.wait_for { server.status == 'off' }
server.status == 'off'
server.wait_for { server.state == 'off' }
server.state == 'off'
end
end

View file

@ -7,7 +7,7 @@ Shindo.tests('Fog::Compute[:digitalocean] | power on/off/shutdown requests',
tests('success') do
test('#power_off_server') do
server.wait_for(120) { ready? }
server.wait_for(180) { server.ready? }
service.power_off_server(server.id).body['status'] == 'OK'
end

View file

@ -9,8 +9,8 @@ Shindo.tests('Fog::Compute[:digitalocean] | reboot_server request', ['digitaloce
service.reboot_server(server.id).status == 200
end
test('state is off') do
server.wait_for { server.status == 'off' }
server.status == 'off'
server.wait_for { server.state == 'off' }
server.state == 'off'
end
end