mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[misc] to_json calls to use MultiJson
This commit is contained in:
parent
dc78e464bc
commit
7cbf1861aa
101 changed files with 111 additions and 108 deletions
5
bin/fog
5
bin/fog
|
@ -19,7 +19,10 @@ end
|
|||
|
||||
if ARGV.length > 1
|
||||
|
||||
puts(instance_eval(ARGV[1..-1].join(' ')).to_json)
|
||||
require 'multi_json'
|
||||
|
||||
result = instance_eval(ARGV[1..-1].join(' '))
|
||||
puts(MultiJson.encode(result))
|
||||
|
||||
else
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ module Fog
|
|||
'Action' => 'PutGroupPolicy',
|
||||
'GroupName' => group_name,
|
||||
'PolicyName' => policy_name,
|
||||
'PolicyDocument' => policy_document.to_json,
|
||||
'PolicyDocument' => MultiJson.encode(policy_document),
|
||||
:parser => Fog::Parsers::AWS::IAM::Basic.new
|
||||
)
|
||||
end
|
||||
|
|
|
@ -24,7 +24,7 @@ module Fog
|
|||
request(
|
||||
'Action' => 'PutUserPolicy',
|
||||
'PolicyName' => policy_name,
|
||||
'PolicyDocument' => policy_document.to_json,
|
||||
'PolicyDocument' => MultiJson.encode(policy_document),
|
||||
'UserName' => user_name,
|
||||
:parser => Fog::Parsers::AWS::IAM::Basic.new
|
||||
)
|
||||
|
|
|
@ -85,7 +85,7 @@ module Fog
|
|||
end
|
||||
end
|
||||
if !response.body.empty? && parse_json && response.headers['Content-Type'] =~ %r{application/json}
|
||||
response.body = ::MultiJson.decode(response.body)
|
||||
response.body = MultiJson.decode(response.body)
|
||||
end
|
||||
response
|
||||
end
|
||||
|
|
|
@ -83,7 +83,7 @@ module Fog
|
|||
end
|
||||
end
|
||||
unless response.body.empty?
|
||||
response.body = ::MultiJson.decode(response.body)
|
||||
response.body = MultiJson.decode(response.body)
|
||||
end
|
||||
response
|
||||
end
|
||||
|
|
|
@ -106,7 +106,7 @@ module Fog
|
|||
response = authenticated_request(params)
|
||||
end
|
||||
unless response.body.empty?
|
||||
response = ::MultiJson.decode(response.body)
|
||||
response = MultiJson.decode(response.body)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -119,7 +119,7 @@ module Fog
|
|||
auth_url = options[:brightbox_auth_url] || @auth_url
|
||||
|
||||
connection = Fog::Connection.new(auth_url)
|
||||
@authentication_body = {'client_id' => @brightbox_client_id, 'grant_type' => 'none'}.to_json
|
||||
@authentication_body = MultiJson.encode({'client_id' => @brightbox_client_id, 'grant_type' => 'none'})
|
||||
|
||||
response = connection.request({
|
||||
:path => "/token",
|
||||
|
@ -131,7 +131,7 @@ module Fog
|
|||
:method => 'POST',
|
||||
:body => @authentication_body
|
||||
})
|
||||
@oauth_token = ::MultiJson.decode(response.body)["access_token"]
|
||||
@oauth_token = MultiJson.decode(response.body)["access_token"]
|
||||
return @oauth_token
|
||||
end
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ module Fog
|
|||
end
|
||||
|
||||
unless response.body.empty?
|
||||
response.body = ::MultiJson.decode(response.body)
|
||||
response.body = MultiJson.decode(response.body)
|
||||
end
|
||||
|
||||
response
|
||||
|
|
|
@ -96,7 +96,7 @@ module Fog
|
|||
response = @connection.request(params.merge!({:host => @host}))
|
||||
|
||||
unless response.body.empty?
|
||||
response.body = ::MultiJson.decode(response.body)
|
||||
response.body = MultiJson.decode(response.body)
|
||||
if data = response.body['ERRORARRAY'].first
|
||||
error = case data['ERRORCODE']
|
||||
when 5
|
||||
|
|
|
@ -177,7 +177,7 @@ module Fog
|
|||
commands = [
|
||||
%{mkdir .ssh},
|
||||
%{passwd -l #{username}},
|
||||
%{echo "#{attributes.to_json}" >> ~/attributes.json}
|
||||
%{echo "#{MultiJson.encode(attributes)}" >> ~/attributes.json}
|
||||
]
|
||||
if public_key
|
||||
commands << %{echo "#{public_key}" >> ~/.ssh/authorized_keys}
|
||||
|
|
|
@ -113,7 +113,7 @@ module Fog
|
|||
%{mkdir .ssh},
|
||||
%{echo "#{public_key}" >> ~/.ssh/authorized_keys},
|
||||
%{passwd -l #{username}},
|
||||
%{echo "#{attributes.to_json}" >> ~/attributes.json}
|
||||
%{echo "#{MultiJson.encode(attributes)}" >> ~/attributes.json}
|
||||
])
|
||||
rescue Errno::ECONNREFUSED
|
||||
sleep(1)
|
||||
|
|
|
@ -92,8 +92,8 @@ module Fog
|
|||
%{mkdir .ssh},
|
||||
%{echo "#{public_key}" >> ~/.ssh/authorized_keys},
|
||||
%{passwd -l root},
|
||||
%{echo "#{attributes.to_json}" >> ~/attributes.json},
|
||||
%{echo "#{metadata.to_json}" >> ~/metadata.json}
|
||||
%{echo "#{MultiJson.encode(attributes)}" >> ~/attributes.json},
|
||||
%{echo "#{MultiJson.encode(metadata)}" >> ~/metadata.json}
|
||||
])
|
||||
rescue Errno::ECONNREFUSED
|
||||
sleep(1)
|
||||
|
|
|
@ -104,8 +104,8 @@ module Fog
|
|||
%{mkdir .ssh},
|
||||
%{echo "#{public_key}" >> ~/.ssh/authorized_keys},
|
||||
%{passwd -l #{username}},
|
||||
%{echo "#{attributes.to_json}" >> ~/attributes.json},
|
||||
%{echo "#{metadata.to_json}" >> ~/metadata.json}
|
||||
%{echo "#{MultiJson.encode(attributes)}" >> ~/attributes.json},
|
||||
%{echo "#{MultiJson.encode(metadata)}" >> ~/metadata.json}
|
||||
])
|
||||
rescue Errno::ECONNREFUSED
|
||||
sleep(1)
|
||||
|
|
|
@ -95,7 +95,7 @@ module Fog
|
|||
%{mkdir .ssh},
|
||||
%{echo "#{public_key}" >> ~/.ssh/authorized_keys},
|
||||
%{passwd -l #{username}},
|
||||
%{echo "#{attributes.to_json}" >> ~/attributes.json}
|
||||
%{echo "#{MultiJson.encode(attributes)}" >> ~/attributes.json}
|
||||
])
|
||||
rescue Errno::ECONNREFUSED
|
||||
sleep(1)
|
||||
|
|
|
@ -167,8 +167,8 @@ module Fog
|
|||
# %{mkdir .ssh},
|
||||
# %{echo "#{public_key}" >> ~/.ssh/authorized_keys},
|
||||
# %{passwd -l #{username}},
|
||||
# %{echo "#{attributes.to_json}" >> ~/attributes.json},
|
||||
# %{echo "#{metadata.to_json}" >> ~/metadata.json}
|
||||
# %{echo "#{MultiJson.encode(attributes)}" >> ~/attributes.json},
|
||||
# %{echo "#{MultiJson.encode(metadata)}" >> ~/metadata.json}
|
||||
# ])
|
||||
# rescue Errno::ECONNREFUSED
|
||||
# sleep(1)
|
||||
|
|
|
@ -104,7 +104,7 @@ module Fog
|
|||
# Because the response is some weird xml-json thing, we need to try and mung
|
||||
# the values out with a prefix, and if there is an empty data entry return an
|
||||
# empty version of the expected type (if provided)
|
||||
response = ::MultiJson.decode(response.body)
|
||||
response = MultiJson.decode(response.body)
|
||||
if options.has_key? :response_prefix
|
||||
keys = options[:response_prefix].split('/')
|
||||
keys.each do |k|
|
||||
|
|
|
@ -120,7 +120,7 @@ module Fog
|
|||
end
|
||||
end
|
||||
unless response.body.empty?
|
||||
response.body = ::MultiJson.decode(response.body)
|
||||
response.body = MultiJson.decode(response.body)
|
||||
end
|
||||
response
|
||||
end
|
||||
|
|
|
@ -10,7 +10,7 @@ module Fog
|
|||
:method => 'POST',
|
||||
:path => "/1.0/servers/#{identifier}/activate_console",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ module Fog
|
|||
:method => 'POST',
|
||||
:path => "/1.0/load_balancers/#{identifier}/add_listeners",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ module Fog
|
|||
:method => 'POST',
|
||||
:path => "/1.0/load_balancers/#{identifier}/add_nodes",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ module Fog
|
|||
:method => 'POST',
|
||||
:path => "/1.0/api_clients",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ module Fog
|
|||
:method => 'POST',
|
||||
:path => "/1.0/cloud_ips",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ module Fog
|
|||
:method => 'POST',
|
||||
:path => "/1.0/images",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ module Fog
|
|||
:method => 'POST',
|
||||
:path => "/1.0/load_balancers",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ module Fog
|
|||
:method => 'POST',
|
||||
:path => "/1.0/servers",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ module Fog
|
|||
:method => 'DELETE',
|
||||
:path => "/1.0/api_clients/#{identifier}",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ module Fog
|
|||
:method => 'DELETE',
|
||||
:path => "/1.0/cloud_ips/#{identifier}",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ module Fog
|
|||
:method => 'DELETE',
|
||||
:path => "/1.0/images/#{identifier}",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ module Fog
|
|||
:method => 'DELETE',
|
||||
:path => "/1.0/load_balancers/#{identifier}",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ module Fog
|
|||
:method => 'DELETE',
|
||||
:path => "/1.0/servers/#{identifier}",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ module Fog
|
|||
:method => 'GET',
|
||||
:path => "/1.0/account",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ module Fog
|
|||
:method => 'GET',
|
||||
:path => "/1.0/api_clients/#{identifier}",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ module Fog
|
|||
:method => 'GET',
|
||||
:path => "/1.0/cloud_ips/#{identifier}",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ module Fog
|
|||
:method => 'GET',
|
||||
:path => "/1.0/images/#{identifier}",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ module Fog
|
|||
:method => 'GET',
|
||||
:path => "/1.0/interfaces/#{identifier}",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ module Fog
|
|||
:method => 'GET',
|
||||
:path => "/1.0/load_balancers/#{identifier}",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ module Fog
|
|||
:method => 'GET',
|
||||
:path => "/1.0/servers/#{identifier}",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ module Fog
|
|||
:method => 'GET',
|
||||
:path => "/1.0/server_types/#{identifier}",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ module Fog
|
|||
:method => 'GET',
|
||||
:path => "/1.0/users/#{identifier}",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ module Fog
|
|||
:method => 'GET',
|
||||
:path => "/1.0/zones/#{identifier}",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ module Fog
|
|||
:method => 'GET',
|
||||
:path => "/1.0/api_clients",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ module Fog
|
|||
:method => 'GET',
|
||||
:path => "/1.0/cloud_ips",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ module Fog
|
|||
:method => 'GET',
|
||||
:path => "/1.0/images",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ module Fog
|
|||
:method => 'GET',
|
||||
:path => "/1.0/load_balancers",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ module Fog
|
|||
:method => 'GET',
|
||||
:path => "/1.0/server_types",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ module Fog
|
|||
:method => 'GET',
|
||||
:path => "/1.0/servers",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ module Fog
|
|||
:method => 'GET',
|
||||
:path => "/1.0/users",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ module Fog
|
|||
:method => 'GET',
|
||||
:path => "/1.0/zones",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ module Fog
|
|||
:method => 'POST',
|
||||
:path => "/1.0/cloud_ips/#{identifier}/map",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ module Fog
|
|||
:method => 'POST',
|
||||
:path => "/1.0/load_balancers/#{identifier}/remove_listeners",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ module Fog
|
|||
:method => 'POST',
|
||||
:path => "/1.0/load_balancers/#{identifier}/remove_nodes",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ module Fog
|
|||
:method => 'POST',
|
||||
:path => "/1.0/account/reset_ftp_password",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ module Fog
|
|||
:method => 'POST',
|
||||
:path => "/1.0/servers/#{identifier}/resize",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ module Fog
|
|||
:method => 'POST',
|
||||
:path => "/1.0/servers/#{identifier}/shutdown",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ module Fog
|
|||
:method => 'POST',
|
||||
:path => "/1.0/servers/#{identifier}/snapshot",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ module Fog
|
|||
:method => 'POST',
|
||||
:path => "/1.0/servers/#{identifier}/start",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ module Fog
|
|||
:method => 'POST',
|
||||
:path => "/1.0/servers/#{identifier}/stop",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ module Fog
|
|||
:method => 'POST',
|
||||
:path => "/1.0/cloud_ips/#{identifier}/unmap",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ module Fog
|
|||
:method => 'PUT',
|
||||
:path => "/1.0/account",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ module Fog
|
|||
:method => 'PUT',
|
||||
:path => "/1.0/api_clients/#{identifier}",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ module Fog
|
|||
:method => 'PUT',
|
||||
:path => "/1.0/images/#{identifier}",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ module Fog
|
|||
:method => 'PUT',
|
||||
:path => "/1.0/load_balancers/#{identifier}",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ module Fog
|
|||
:method => 'PUT',
|
||||
:path => "/1.0/servers/#{identifier}",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ module Fog
|
|||
:method => 'PUT',
|
||||
:path => "/1.0/users/#{identifier}",
|
||||
:headers => {"Content-Type" => "application/json"},
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ module Fog
|
|||
:label => name,
|
||||
:size => size,
|
||||
:rootPass => password,
|
||||
:stackScriptUDFResponses => options.to_json
|
||||
:stackScriptUDFResponses => MultiJson.encode(options)
|
||||
}
|
||||
)
|
||||
end
|
||||
|
|
|
@ -25,7 +25,7 @@ module Fog
|
|||
data['image']['name'] = options['name']
|
||||
end
|
||||
request(
|
||||
:body => data.to_json,
|
||||
:body => MultiJson.encode(data),
|
||||
:expects => 202,
|
||||
:method => 'POST',
|
||||
:path => "images"
|
||||
|
|
|
@ -56,7 +56,7 @@ module Fog
|
|||
end
|
||||
end
|
||||
request(
|
||||
:body => data.to_json,
|
||||
:body => MultiJson.encode(data),
|
||||
:expects => [200, 202],
|
||||
:method => 'POST',
|
||||
:path => 'servers.json'
|
||||
|
|
|
@ -7,12 +7,12 @@ module Fog
|
|||
#
|
||||
# ==== Parameters
|
||||
# * server_id<~Integer> - Id of server to reboot
|
||||
# * body<~.to_json object> - Body of the request, describes the action (see reboot_server as an example)
|
||||
# * body<~String> - Body of the request, describes the action (see reboot_server as an example)
|
||||
# * expect<~Integer> - expected return, 202 except for confirm resize (204)
|
||||
#
|
||||
def server_action(server_id, body, expects=202)
|
||||
request(
|
||||
:body => body.to_json,
|
||||
:body => MultiJson.encode(body),
|
||||
:expects => expects,
|
||||
:method => 'POST',
|
||||
:path => "servers/#{server_id}/action.json"
|
||||
|
|
|
@ -12,7 +12,7 @@ module Fog
|
|||
# * name<~String> - New name for server
|
||||
def update_server(server_id, options = {})
|
||||
request(
|
||||
:body => { 'server' => options }.to_json,
|
||||
:body => MultiJson.encode({ 'server' => options }),
|
||||
:expects => 204,
|
||||
:method => 'PUT',
|
||||
:path => "servers/#{server_id}.json"
|
||||
|
|
|
@ -6,7 +6,7 @@ module Fog
|
|||
def add_balancer_node(options = {})
|
||||
request(
|
||||
:path => "/network/loadbalancer/addnode",
|
||||
:body => {:params => options}.to_json
|
||||
:body => MultiJson.encode({:params => options})
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ module Fog
|
|||
def clone_server(options = {})
|
||||
request(
|
||||
:path => "/storm/server/clone",
|
||||
:body => {:params => options}.to_json
|
||||
:body => MultiJson.encode({:params => options})
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ module Fog
|
|||
def create_server(options = {})
|
||||
request(
|
||||
:path => "/storm/server/create",
|
||||
:body => {:params => options}.to_json
|
||||
:body => MultiJson.encode({:params => options})
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ module Fog
|
|||
def delete_server(options = {})
|
||||
request(
|
||||
:path => "/storm/server/destroy",
|
||||
:body => {:params => options}.to_json
|
||||
:body => MultiJson.encode({:params => options})
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ module Fog
|
|||
def get_server(options = {})
|
||||
request(
|
||||
:path => "/storm/server/details",
|
||||
:body => {:params => options}.to_json
|
||||
:body => MultiJson.encode({:params => options})
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ module Fog
|
|||
def get_stats(options = {})
|
||||
request(
|
||||
:path => "/monitoring/load/stats",
|
||||
:body => {:params => options}.to_json
|
||||
:body => MultiJson.encode({:params => options})
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ module Fog
|
|||
def list_balancers(options = {})
|
||||
request(
|
||||
:path => "/network/loadbalancer/list",
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ module Fog
|
|||
def list_configs(options = {})
|
||||
request(
|
||||
:path => "/storm/config/list",
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ module Fog
|
|||
def list_images(options = {})
|
||||
request(
|
||||
:path => "/server/image/list",
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ module Fog
|
|||
def list_private_ips(options = {})
|
||||
request(
|
||||
:path => "/network/private/get",
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ module Fog
|
|||
def list_servers(options = {})
|
||||
request(
|
||||
:path => "/storm/server/list",
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ module Fog
|
|||
def list_templates(options = {})
|
||||
request(
|
||||
:path => "/server/template/list",
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ module Fog
|
|||
def reboot_server(options = {})
|
||||
request(
|
||||
:path => "/storm/server/reboot",
|
||||
:body => {:params => options}.to_json
|
||||
:body => MultiJson.encode({:params => options})
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ module Fog
|
|||
def remove_balancer_node(options = {})
|
||||
request(
|
||||
:path => "/network/loadbalancer/removenode",
|
||||
:body => {:params => options}.to_json
|
||||
:body => MultiJson.encode({:params => options})
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ module Fog
|
|||
def resize_server(options = {})
|
||||
request(
|
||||
:path => "/storm/server/resize",
|
||||
:body => {:params => options}.to_json
|
||||
:body => MultiJson.encode({:params => options})
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ module Fog
|
|||
end
|
||||
end
|
||||
unless response.body.empty?
|
||||
response.body = ::MultiJson.decode(response.body)
|
||||
response.body = MultiJson.decode(response.body)
|
||||
end
|
||||
if response.body.keys.include?('full_error')
|
||||
raise(Fog::Compute::StormOnDemand::Error, response.body.inspect)
|
||||
|
|
|
@ -117,7 +117,7 @@ module Fog
|
|||
|
||||
def to_json(options = {})
|
||||
require 'multi_json'
|
||||
self.map {|member| member.attributes}.to_json(options)
|
||||
MultiJson.encode(self.map {|member| member.attributes})
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -39,7 +39,7 @@ module Fog
|
|||
|
||||
def to_json(options = {})
|
||||
require 'multi_json'
|
||||
attributes.to_json(options)
|
||||
MultiJson.encode(attributes)
|
||||
end
|
||||
|
||||
def wait_for(timeout=Fog.timeout, interval=1, &block)
|
||||
|
|
|
@ -82,7 +82,7 @@ module Fog
|
|||
response = @connection.request(params.merge!({:host => @host}))
|
||||
|
||||
unless response.body.empty?
|
||||
response.body = ::MultiJson.decode(response.body)
|
||||
response.body = MultiJson.decode(response.body)
|
||||
end
|
||||
response
|
||||
end
|
||||
|
|
|
@ -117,7 +117,7 @@ module Fog
|
|||
end
|
||||
|
||||
unless response.body.empty?
|
||||
response.body = ::MultiJson.decode(response.body)
|
||||
response.body = MultiJson.decode(response.body)
|
||||
end
|
||||
|
||||
response
|
||||
|
|
|
@ -69,7 +69,7 @@ module Fog
|
|||
response = @connection.request(params.merge!({:host => @host}))
|
||||
|
||||
unless response.body.empty?
|
||||
response.body = ::MultiJson.decode(response.body)
|
||||
response.body = MultiJson.decode(response.body)
|
||||
if data = response.body['ERRORARRAY'].first
|
||||
error = case data['ERRORCODE']
|
||||
when 5
|
||||
|
|
|
@ -14,7 +14,7 @@ module Fog
|
|||
def create_domain(name)
|
||||
body = { "domain" => { "name" => name } }
|
||||
request(
|
||||
:body => body.to_json,
|
||||
:body => MultiJson.encode(body),
|
||||
:expects => 201,
|
||||
:method => 'POST',
|
||||
:path => '/domains'
|
||||
|
|
|
@ -36,7 +36,7 @@ module Fog
|
|||
|
||||
body["record"].merge!(options)
|
||||
|
||||
request( :body => body.to_json,
|
||||
request( :body => MultiJson.encode(body),
|
||||
:expects => 201,
|
||||
:method => 'POST',
|
||||
:path => "/domains/#{domain}/records" )
|
||||
|
|
|
@ -30,7 +30,7 @@ module Fog
|
|||
|
||||
body = { "record" => options }
|
||||
|
||||
request( :body => body.to_json,
|
||||
request( :body => MultiJson.encode(body),
|
||||
:expects => 200,
|
||||
:method => "PUT",
|
||||
:path => "/domains/#{domain}/records/#{record_id}" )
|
||||
|
|
|
@ -52,7 +52,7 @@ module Fog
|
|||
:expects => 201,
|
||||
:method => "POST",
|
||||
:path => "/V1.2/domains/#{domain}/records",
|
||||
:body => body.to_json
|
||||
:body => MultiJson.encode(body)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ module Fog
|
|||
:expects => 201,
|
||||
:method => 'PUT',
|
||||
:path => "/V1.2/secondary/#{secondary_name}",
|
||||
:body => body.to_json
|
||||
:body => MultiJson.encode(body)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ module Fog
|
|||
:expects => 200,
|
||||
:method => "PUT",
|
||||
:path => "/V1.2/domains/#{domain}/records/#{record_id}",
|
||||
:body => options.to_json
|
||||
:body => MultiJson.encode(options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ module Fog
|
|||
:expects => 201,
|
||||
:method => 'PUT',
|
||||
:path => "/V1.2/secondary/#{secondary_name}",
|
||||
:body => body.to_json
|
||||
:body => MultiJson.encode(body)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ module Fog
|
|||
end
|
||||
end
|
||||
if !response.body.empty? && parse_json && response.headers['Content-Type'] =~ %r{application/json}
|
||||
response.body = ::MultiJson.decode(response.body)
|
||||
response.body = MultiJson.decode(response.body)
|
||||
end
|
||||
response
|
||||
end
|
||||
|
|
|
@ -27,7 +27,7 @@ module Fog
|
|||
:method => 'GET',
|
||||
:query => {'policy' => nil}
|
||||
})
|
||||
response.body = ::MultiJson.decode(response.body) unless response.body.nil?
|
||||
response.body = MultiJson.decode(response.body) unless response.body.nil?
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -27,7 +27,7 @@ module Fog
|
|||
|
||||
def post_object_hidden_fields(options = {})
|
||||
if options['policy']
|
||||
options['policy'] = options['policy'].to_json
|
||||
options['policy'] = MultiJson.encode(options['policy'])
|
||||
options['AWSAccessKeyId'] = @aws_access_key_id
|
||||
string_to_sign = Base64.encode64(options['policy']).chomp!
|
||||
signed_string = @hmac.sign(string_to_sign)
|
||||
|
|
|
@ -14,7 +14,7 @@ module Fog
|
|||
|
||||
def put_bucket_policy(bucket_name, policy)
|
||||
request({
|
||||
:body => policy.to_json,
|
||||
:body => MultiJson.encode(policy),
|
||||
:expects => 204,
|
||||
:headers => {},
|
||||
:host => "#{bucket_name}.#{@host}",
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue