mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[ibm] Restarting should return success, changing expiration should only return time
This commit is contained in:
parent
81344bd96a
commit
432475cded
2 changed files with 9 additions and 8 deletions
|
@ -78,18 +78,17 @@ module Fog
|
||||||
|
|
||||||
def reboot
|
def reboot
|
||||||
requires :id
|
requires :id
|
||||||
connection.modify_instance(id, 'state' => 'restart')
|
connection.modify_instance(id, 'state' => 'restart').body['success']
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
requires :id
|
requires :id
|
||||||
data = connection.delete_instance(id)
|
connection.delete_instance(id).body['success']
|
||||||
data.body['success']
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def rename(name)
|
def rename(name)
|
||||||
requires :id
|
requires :id
|
||||||
if connection.modify_instance(id, {'name' => name}).body["success"]
|
if connection.modify_instance(id, 'name' => name).body["success"]
|
||||||
attributes[:name] = name
|
attributes[:name] = name
|
||||||
else
|
else
|
||||||
return false
|
return false
|
||||||
|
@ -136,11 +135,13 @@ module Fog
|
||||||
# Sets expiration time - Pass an instance of Time.
|
# Sets expiration time - Pass an instance of Time.
|
||||||
def expire_at(time)
|
def expire_at(time)
|
||||||
expiry_time = (time.tv_sec * 1000).to_i
|
expiry_time = (time.tv_sec * 1000).to_i
|
||||||
success = connection.set_instance_expiration(id, expiry_time).body["expirationTime"] == expiry_time
|
data = connection.modify_instance(id, 'expirationTime' => expiry_time)
|
||||||
if success
|
if data.body['expirationTime'] == expiry_time
|
||||||
attributes[:expires_at] = expiry_time
|
attributes[:expires_at] = expiry_time
|
||||||
|
true
|
||||||
|
else
|
||||||
|
false
|
||||||
end
|
end
|
||||||
success
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Expires the instance immediately
|
# Expires the instance immediately
|
||||||
|
|
|
@ -57,7 +57,7 @@ module Fog
|
||||||
elsif params['expirationTime']
|
elsif params['expirationTime']
|
||||||
self.data[:instances][instance_id]["expirationTime"] = params['expirationTime']
|
self.data[:instances][instance_id]["expirationTime"] = params['expirationTime']
|
||||||
response.status = 200
|
response.status = 200
|
||||||
response.body = { "success" => true }
|
response.body = { 'expirationTime' => params['expirationTime'] }
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
response.status = 404
|
response.status = 404
|
||||||
|
|
Loading…
Add table
Reference in a new issue