From 21e9573576876934d522486545a9084f08468c55 Mon Sep 17 00:00:00 2001 From: Manuel Franco Date: Mon, 18 Apr 2016 11:44:24 +0200 Subject: [PATCH] Fix default API version for Joyent --- lib/fog/joyent/compute.rb | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/lib/fog/joyent/compute.rb b/lib/fog/joyent/compute.rb index eca5662ad..910344383 100644 --- a/lib/fog/joyent/compute.rb +++ b/lib/fog/joyent/compute.rb @@ -6,7 +6,6 @@ module Fog class Joyent < Fog::Service requires :joyent_username - recognizes :joyent_password recognizes :joyent_url recognizes :joyent_keyname @@ -15,7 +14,7 @@ module Fog recognizes :joyent_keyphrase recognizes :joyent_version - secrets :joyent_password, :joyent_keydata, :joyent_keyphrase + secrets :joyent_keydata, :joyent_keyphrase model_path 'fog/joyent/models/compute' request_path 'fog/joyent/requests/compute' @@ -100,7 +99,6 @@ module Fog def initialize(options = {}) @joyent_username = options[:joyent_username] - @joyent_password = options[:joyent_password] end def request(opts) @@ -117,7 +115,7 @@ module Fog @persistent = options[:persistent] || false @joyent_url = options[:joyent_url] || 'https://us-sw-1.api.joyentcloud.com' - @joyent_version = options[:joyent_version] || '~6.5' + @joyent_version = options[:joyent_version] || '~7' @joyent_username = options[:joyent_username] unless @joyent_username @@ -137,7 +135,6 @@ module Fog :keys_only => true, :passphrase => @joyent_keyphrase }) - @header_method = method(:header_for_signature_auth) if options[:joyent_keyfile] if File.exist?(options[:joyent_keyfile]) @@ -154,11 +151,8 @@ module Fog @key_manager.add_key_data(@joyent_keydata) end end - elsif options[:joyent_password] - @joyent_password = options[:joyent_password] - @header_method = method(:header_for_basic_auth) else - raise ArgumentError, "Must provide either a joyent_password or joyent_keyname and joyent_keyfile pair" + raise ArgumentError, "Must provide a joyent_keyname and joyent_keyfile pair" end @connection = Fog::XML::Connection.new( @@ -173,7 +167,7 @@ module Fog "X-Api-Version" => @joyent_version, "Content-Type" => "application/json", "Accept" => "application/json" - }.merge(opts[:headers] || {}).merge(@header_method.call) + }.merge(opts[:headers] || {}).merge(header_for_signature_auth) if opts[:body] opts[:body] = Fog::JSON.encode(opts[:body]) @@ -199,12 +193,6 @@ module Fog decode_time_attrs(parsed) end - def header_for_basic_auth - { - "Authorization" => "Basic #{Base64.encode64("#{@joyent_username}:#{@joyent_password}").delete("\r\n")}" - } - end - def header_for_signature_auth date = Time.now.utc.httpdate