mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Fixes for tags for pre7 api, more ssh-agent improvements Refs: kevinykchan/knife-joyent#37
This commit is contained in:
parent
ffa3e89ebb
commit
f0dcb04b91
5 changed files with 12 additions and 11 deletions
|
@ -186,23 +186,22 @@ module Fog
|
|||
|
||||
key = @key_manager.known_identities.keys.first
|
||||
|
||||
if key.kind_of? OpenSSL::PKey::RSA
|
||||
digest = @key_manager.sign(key, date)[15..-1]
|
||||
sig = if key.kind_of? OpenSSL::PKey::RSA
|
||||
@key_manager.sign(key, date)[15..-1]
|
||||
else
|
||||
key = OpenSSL::PKey::DSA.new(File.read(@joyent_keyfile), @joyent_keyphrase)
|
||||
digest = key.sign('sha1', date)
|
||||
key.sign('sha1', date)
|
||||
end
|
||||
|
||||
signature = Base64.encode64(digest).delete("\r\n")
|
||||
|
||||
key_id = "/#{@joyent_username}/keys/#{@joyent_keyname}"
|
||||
|
||||
key_type = key.class.to_s.split('::').last.downcase.to_sym
|
||||
|
||||
unless [:rsa, :dsa].include? key_type
|
||||
raise Joyent::Errors::Unauthorized.new('Invalid key type -- only rsa or dsa key is supported')
|
||||
end
|
||||
|
||||
signature = Base64.encode64(sig).delete("\r\n")
|
||||
|
||||
{
|
||||
"Date" => date,
|
||||
"Authorization" => "Signature keyId=\"#{key_id}\",algorithm=\"#{key_type}-sha1\" #{signature}"
|
||||
|
|
|
@ -20,9 +20,9 @@ module Fog
|
|||
# https://us-west-1.api.joyentcloud.com/docs#cloudapi-http-responses
|
||||
#
|
||||
# HTTP Status Codes
|
||||
#
|
||||
#
|
||||
# Your client should check for each of the following status codes from any API request:
|
||||
#
|
||||
#
|
||||
# Response Code Description
|
||||
|
||||
# 400 Bad Request Invalid HTTP Request
|
||||
|
|
|
@ -26,7 +26,9 @@ module Fog
|
|||
|
||||
def get(machine_id)
|
||||
data = service.get_machine(machine_id).body
|
||||
new(data)
|
||||
server = new(data)
|
||||
server.tags = server.list_tags if server.tags.nil?
|
||||
server
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -6,7 +6,7 @@ module Fog
|
|||
request(
|
||||
:path => "/my/machines/#{machine_id}",
|
||||
:method => "DELETE",
|
||||
:expects => [200, 204]
|
||||
:expects => [200, 204, 410]
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -20,7 +20,7 @@ module Fog
|
|||
request(
|
||||
:method => "GET",
|
||||
:path => "/my/machines/#{uuid}",
|
||||
:expects => 200
|
||||
:expects => [200, 410]
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue