lib/fog/openstack/compute.rb in fog-1.6.0 vs lib/fog/openstack/compute.rb in fog-1.7.0

- old
+ new

@@ -150,13 +150,17 @@ request :update_quota # Hosts request :list_hosts request :get_host_details - + class Mock + attr_reader :auth_token + attr_reader :auth_token_expiration + attr_reader :current_user + attr_reader :current_tenant def self.data @data ||= Hash.new do |hash, key| hash[key] = { :last_modified => { @@ -203,10 +207,23 @@ end def initialize(options={}) @openstack_username = options[:openstack_username] @openstack_tenant = options[:openstack_tenant] + @openstack_auth_uri = URI.parse(options[:openstack_auth_url]) + + @auth_token = Fog::Mock.random_base64(64) + @auth_token_expiration = (Time.now.utc + 86400).iso8601 + + management_url = URI.parse(options[:openstack_auth_url]) + management_url.port = 8774 + management_url.path = '/v1.1/1' + @openstack_management_url = management_url.to_s + + identity_public_endpoint = URI.parse(options[:openstack_auth_url]) + identity_public_endpoint.port = 5000 + @openstack_identity_public_endpoint = identity_public_endpoint.to_s end def data self.class.data["#{@openstack_username}-#{@openstack_tenant}"] end @@ -224,10 +241,11 @@ end end class Real attr_reader :auth_token + attr_reader :auth_token_expiration attr_reader :current_user attr_reader :current_tenant def initialize(options={}) @openstack_auth_token = options[:openstack_auth_token] @@ -336,9 +354,10 @@ @current_user = credentials[:user] @current_tenant = credentials[:tenant] @openstack_must_reauthenticate = false @auth_token = credentials[:token] + @auth_token_expiration = credentials[:expires] @openstack_management_url = credentials[:server_management_url] @openstack_identity_public_endpoint = credentials[:identity_public_endpoint] uri = URI.parse(@openstack_management_url) else @auth_token = @openstack_auth_token