1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Merge pull request #367 from dylanegan/mocked_console_output

Provide mocked console output
This commit is contained in:
Wesley Beary 2011-06-21 12:51:55 -07:00
commit 570fc0ab3c
2 changed files with 7 additions and 2 deletions

View file

@ -38,7 +38,7 @@ module Fog
response.status = 200
response.body = {
'instanceId' => instance_id,
'output' => nil,
'output' => (Time.now - instance['launchTime'] >= Fog::Mock.delay) ? nil : Fog::AWS::Mock.console_output,
'requestId' => Fog::AWS::Mock.request_id,
'timestamp' => Time.now
}

View file

@ -1,6 +1,7 @@
require 'fog/core'
require 'fog/core/parser'
require 'openssl' # For RSA key pairs
require 'base64' # For console output
module Fog
module AWS
@ -78,6 +79,11 @@ module Fog
sprintf("%0.10f", rand / 100).to_f
end
def self.console_output
# "[ 0.000000] Linux version 2.6.18-xenU-ec2-v1.2 (root@domU-12-31-39-07-51-82) (gcc version 4.1.2 20070626 (Red Hat 4.1.2-13)) #2 SMP Wed Aug 19 09:04:38 EDT 2009"
Base64.decode64("WyAwLjAwMDAwMF0gTGludXggdmVyc2lvbiAyLjYuMTgteGVuVS1lYzItdjEu\nMiAocm9vdEBkb21VLTEyLTMxLTM5LTA3LTUxLTgyKSAoZ2NjIHZlcnNpb24g\nNC4xLjIgMjAwNzA2MjYgKFJlZCBIYXQgNC4xLjItMTMpKSAjMiBTTVAgV2Vk\nIEF1ZyAxOSAwOTowNDozOCBFRFQgMjAwOQ==\n")
end
def self.dns_name_for(ip_address)
"ec2-#{ip_address.gsub('.','-')}.compute-1.amazonaws.com"
end
@ -173,7 +179,6 @@ module Fog
def self.volume_id
"vol-#{Fog::Mock.random_hex(8)}"
end
end
end
end