mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
(#9241) Add current_time request
Without this patch, no actual API calls are being made through the Fog layer to the underlying rbvmobi later and ultimately to the vSphere target API. This patch adds a simple current_time request which is similar to a "ping" The layers and API are exercised fully using this simple API call to retrieve the current time on the remote system. This provides: >> Fog::Compute[:vsphere].current_time Tue Aug 30 20:46:27 UTC 2011 >> Fog::Compute[:vsphere].requests [:current_time]
This commit is contained in:
parent
ec32398811
commit
cf75fb1358
2 changed files with 24 additions and 0 deletions
|
@ -8,6 +8,9 @@ module Fog
|
|||
recognizes :vsphere_port, :vsphere_path, :vsphere_ns
|
||||
recognizes :vsphere_rev, :vsphere_ssl, :vsphere_expected_pubkey_hash
|
||||
|
||||
request_path 'fog/vsphere/requests/compute'
|
||||
request :current_time
|
||||
|
||||
class Mock
|
||||
|
||||
def initialize(options={})
|
||||
|
|
21
lib/fog/vsphere/requests/compute/current_time.rb
Normal file
21
lib/fog/vsphere/requests/compute/current_time.rb
Normal file
|
@ -0,0 +1,21 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Vsphere
|
||||
class Real
|
||||
|
||||
def current_time
|
||||
@connection.serviceInstance.CurrentTime
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Mock
|
||||
|
||||
def current_time
|
||||
Time.now.utc
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue