diff --git a/lib/fog/ibm/models/compute/server.rb b/lib/fog/ibm/models/compute/server.rb index 43c1230a6..becd622c8 100644 --- a/lib/fog/ibm/models/compute/server.rb +++ b/lib/fog/ibm/models/compute/server.rb @@ -6,24 +6,24 @@ module Fog class Server < Fog::Compute::Server - STATES = [ - "New", # => 0 - "Provisioning", # => 1 - "Failed", # => 2 - "Removed", # => 3 - "Rejected", # => 4 - "Active", # => 5 - "Unknown", # => 6 - "Deprovisioning", # => 7 - "Restarting", # => 8 - "Starting", # => 9 - "Stopping", # => 10 - "Stopped", # => 11 - "Deprovisioning pending", # => 12 - "Restart pending",# => 13 - "Attaching", # => 14 - "Detaching" # => 15 - ] + STATES = { + 0 => 'New', + 1 => 'Provisioning', + 2 => 'Failed', + 3 => 'Removed', + 4 => 'Rejected', + 5 => 'Active', + 6 => 'Unknown', + 7 => 'Deprovisioning', + 8 => 'Restarting', + 9 => 'Starting', + 10 => 'Stopping', + 11 => 'Stopped', + 12 => 'Deprovisioning pending', + 13 => 'Restart pending', + 14 => 'Attaching', + 15 => 'Detaching' + } identity :id @@ -73,7 +73,7 @@ module Fog end def state - STATES[attributes[:state].to_i] + STATES[attributes[:state]] end def ready? diff --git a/lib/fog/ibm/models/storage/volume.rb b/lib/fog/ibm/models/storage/volume.rb index d25f77c9e..1fbed5761 100644 --- a/lib/fog/ibm/models/storage/volume.rb +++ b/lib/fog/ibm/models/storage/volume.rb @@ -5,23 +5,23 @@ module Fog class IBM class Volume < Fog::Model - STATUS = [ - "New", # => 0 - "Creating", # => 1 - "Deleting", # => 2 - "Deleted", # => 3 - "Detached", # => 4 - "Attached", # => 5 - "Failed", # => 6 - "Deletion pending", # => 7 - "Being cloned", # => 8 - "Cloning", # => 9 - "Attaching", # => 10 - "Detaching", # => 11 - "Copying", # => 12 - "Importing", # => 13 - "Transfer retrying" # => 14 - ] + STATES = { + 0 => 'New', + 1 => 'Creating', + 2 => 'Deleting', + 3 => 'Deleted', + 4 => 'Detached', + 5 => 'Attached', + 6 => 'Failed', + 7 => 'Deletion pending', + 8 => 'Being cloned', + 9 => 'Cloning', + 10 => 'Attaching', + 11 => 'Detaching', + 12 => 'Copying', + 13 => 'Importing', + 14 => 'Transfer retrying', + } identity :id @@ -41,7 +41,7 @@ module Fog attribute :clone_status, :aliases => 'cloneStatus' def attached? - status == "Attached" + state == "Attached" end def attach(instance_id) @@ -76,8 +76,8 @@ module Fog # Are we ready to be attached to an instance? def ready? - # TODO: Not sure if this is the only status we should be matching. - status == "Detached" + # TODO: Not sure if this is the only state we should be matching. + state == "Detached" end def save @@ -88,8 +88,8 @@ module Fog true end - def status - STATUS[attributes[:state].to_i] + def state + STATES[attributes[:state]] end end diff --git a/tests/ibm/models/compute/server_tests.rb b/tests/ibm/models/compute/server_tests.rb index 02b1b5583..2a19baf47 100644 --- a/tests/ibm/models/compute/server_tests.rb +++ b/tests/ibm/models/compute/server_tests.rb @@ -43,7 +43,7 @@ Shindo.tests('Fog::Compute[:ibm] | server', ['ibm']) do returns(true) { @server.ready? } end - tests('Fog::Compute::IBM::Server#status') do + tests('Fog::Compute::IBM::Server#state') do returns("Active") { @server.state } end diff --git a/tests/ibm/models/storage/volume_tests.rb b/tests/ibm/models/storage/volume_tests.rb index a0855ad6d..cf9f6a7ed 100644 --- a/tests/ibm/models/storage/volume_tests.rb +++ b/tests/ibm/models/storage/volume_tests.rb @@ -47,8 +47,8 @@ Shindo.tests('Fog::Storage[:ibm] | volume', ['ibm']) do returns(true) { @volume.ready? } end - tests('Fog::Storage::IBM::Volume#status') do - returns("Detached") { @volume.status } + tests('Fog::Storage::IBM::Volume#state') do + returns("Detached") { @volume.state } end tests('Fog::Storage::IBM::Volume#destroy') do