mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[ibm] Make usage of #state rather than #status consistent
This commit is contained in:
parent
399ea807c6
commit
c60420318f
4 changed files with 44 additions and 44 deletions
|
@ -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?
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue