mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[glesys|compute] add reboot and compute test params
This commit adds the reboot feature as well as updated get() call and compute test parameters to be able to run server tests
This commit is contained in:
parent
907ff6f8db
commit
27d4dc348a
5 changed files with 38 additions and 8 deletions
|
@ -21,6 +21,7 @@ module Fog
|
|||
request :server_details
|
||||
request :server_status
|
||||
request :start
|
||||
request :reboot
|
||||
request :stop
|
||||
# Templates
|
||||
request :template_list
|
||||
|
|
|
@ -40,6 +40,11 @@ module Fog
|
|||
connection.stop(:serverid => identity)
|
||||
end
|
||||
|
||||
def reboot
|
||||
requires :identity
|
||||
connection.reboot(:serverid => identity)
|
||||
end
|
||||
|
||||
def destroy
|
||||
requires :identity
|
||||
connection.destroy(:serverid => identity, :keepip => keepip)
|
||||
|
|
|
@ -16,14 +16,20 @@ module Fog
|
|||
|
||||
def get(identifier)
|
||||
return nil if identifier.nil? || identifier == ""
|
||||
details = connection.server_details(identifier).body['response']
|
||||
status = connection.server_status(identifier).body['response']
|
||||
if details.empty? || status.empty?
|
||||
nil
|
||||
else
|
||||
status['server'].merge!({ :serverid => identifier})
|
||||
details['server'].merge!(status['server'])
|
||||
new(details['server'])
|
||||
|
||||
begin
|
||||
details = connection.server_details(identifier).body['response']
|
||||
status = connection.server_status(identifier).body['response']
|
||||
|
||||
if details.empty? || status.empty?
|
||||
nil
|
||||
else
|
||||
status['server'].merge!({ :serverid => identifier})
|
||||
details['server'].merge!(status['server'])
|
||||
new(details['server'])
|
||||
end
|
||||
rescue
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
|
|
14
lib/fog/glesys/requests/compute/reboot.rb
Normal file
14
lib/fog/glesys/requests/compute/reboot.rb
Normal file
|
@ -0,0 +1,14 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Glesys
|
||||
class Real
|
||||
|
||||
def reboot(param)
|
||||
request("/server/reboot", param)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -44,6 +44,10 @@ def compute_providers
|
|||
:mocked => true
|
||||
},
|
||||
:glesys => {
|
||||
:server_attributes => {
|
||||
:rootpassword => "secret_password_#{Time.now.to_i}",
|
||||
:hostname => "fog.example#{Time.now.to_i}.com"
|
||||
},
|
||||
:mocked => false
|
||||
},
|
||||
:hp => {
|
||||
|
|
Loading…
Reference in a new issue