mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Merge pull request #868 from scsmith/multi_json_deprecations
Use MultiJSON #dump and #load rather than #encode and #decode
This commit is contained in:
commit
56403ea5f4
125 changed files with 143 additions and 143 deletions
6
Rakefile
6
Rakefile
|
@ -189,11 +189,11 @@ task :changelog do
|
||||||
changelog << ''
|
changelog << ''
|
||||||
|
|
||||||
require 'multi_json'
|
require 'multi_json'
|
||||||
github_repo_data = MultiJson.decode(Excon.get('http://github.com/api/v2/json/repos/show/fog/fog').body)
|
github_repo_data = MultiJson.load(Excon.get('http://github.com/api/v2/json/repos/show/fog/fog').body)
|
||||||
data = github_repo_data['repository'].reject {|key, value| !['forks', 'open_issues', 'watchers'].include?(key)}
|
data = github_repo_data['repository'].reject {|key, value| !['forks', 'open_issues', 'watchers'].include?(key)}
|
||||||
github_collaborator_data = MultiJson.decode(Excon.get('http://github.com/api/v2/json/repos/show/fog/fog/collaborators').body)
|
github_collaborator_data = MultiJson.load(Excon.get('http://github.com/api/v2/json/repos/show/fog/fog/collaborators').body)
|
||||||
data['collaborators'] = github_collaborator_data['collaborators'].length
|
data['collaborators'] = github_collaborator_data['collaborators'].length
|
||||||
rubygems_data = MultiJson.decode(Excon.get('https://rubygems.org/api/v1/gems/fog.json').body)
|
rubygems_data = MultiJson.load(Excon.get('https://rubygems.org/api/v1/gems/fog.json').body)
|
||||||
data['downloads'] = rubygems_data['downloads']
|
data['downloads'] = rubygems_data['downloads']
|
||||||
stats = []
|
stats = []
|
||||||
for key in data.keys.sort
|
for key in data.keys.sort
|
||||||
|
|
2
bin/fog
2
bin/fog
|
@ -26,7 +26,7 @@ if ARGV.length > 1
|
||||||
require 'multi_json'
|
require 'multi_json'
|
||||||
|
|
||||||
result = instance_eval(ARGV[1..-1].join(' '))
|
result = instance_eval(ARGV[1..-1].join(' '))
|
||||||
puts(MultiJson.encode(result))
|
puts(MultiJson.dump(result))
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ Gem::Specification.new do |s|
|
||||||
s.add_dependency('builder')
|
s.add_dependency('builder')
|
||||||
s.add_dependency('excon', '~>0.13.0')
|
s.add_dependency('excon', '~>0.13.0')
|
||||||
s.add_dependency('formatador', '~>0.2.0')
|
s.add_dependency('formatador', '~>0.2.0')
|
||||||
s.add_dependency('multi_json', '~>1.0')
|
s.add_dependency('multi_json', '~>1.3')
|
||||||
s.add_dependency('mime-types')
|
s.add_dependency('mime-types')
|
||||||
s.add_dependency('net-scp', '~>1.0.4')
|
s.add_dependency('net-scp', '~>1.0.4')
|
||||||
s.add_dependency('net-ssh', '>=2.1.3')
|
s.add_dependency('net-ssh', '>=2.1.3')
|
||||||
|
|
|
@ -125,7 +125,7 @@ module Fog
|
||||||
})
|
})
|
||||||
|
|
||||||
unless response.body.empty?
|
unless response.body.empty?
|
||||||
response.body = MultiJson.decode(response.body)
|
response.body = MultiJson.load(response.body)
|
||||||
end
|
end
|
||||||
|
|
||||||
response
|
response
|
||||||
|
|
|
@ -198,7 +198,7 @@ module Fog
|
||||||
commands = [
|
commands = [
|
||||||
%{mkdir .ssh},
|
%{mkdir .ssh},
|
||||||
%{passwd -l #{username}},
|
%{passwd -l #{username}},
|
||||||
%{echo "#{MultiJson.encode(Fog::JSON.sanitize(attributes))}" >> ~/attributes.json}
|
%{echo "#{MultiJson.dump(Fog::JSON.sanitize(attributes))}" >> ~/attributes.json}
|
||||||
]
|
]
|
||||||
if public_key
|
if public_key
|
||||||
commands << %{echo "#{public_key}" >> ~/.ssh/authorized_keys}
|
commands << %{echo "#{public_key}" >> ~/.ssh/authorized_keys}
|
||||||
|
|
|
@ -31,7 +31,7 @@ module Fog
|
||||||
}
|
}
|
||||||
|
|
||||||
request(
|
request(
|
||||||
:body => MultiJson.encode(body),
|
:body => MultiJson.dump(body),
|
||||||
:headers => {'x-amz-target' => 'DynamoDB_20111205.BatchGetItem'},
|
:headers => {'x-amz-target' => 'DynamoDB_20111205.BatchGetItem'},
|
||||||
:idempotent => true
|
:idempotent => true
|
||||||
)
|
)
|
||||||
|
|
|
@ -43,7 +43,7 @@ module Fog
|
||||||
}
|
}
|
||||||
|
|
||||||
request(
|
request(
|
||||||
:body => MultiJson.encode(body),
|
:body => MultiJson.dump(body),
|
||||||
:headers => {'x-amz-target' => 'DynamoDB_20111205.CreateTable'},
|
:headers => {'x-amz-target' => 'DynamoDB_20111205.CreateTable'},
|
||||||
:idempotent => true
|
:idempotent => true
|
||||||
)
|
)
|
||||||
|
|
|
@ -33,7 +33,7 @@ module Fog
|
||||||
}.merge(options)
|
}.merge(options)
|
||||||
|
|
||||||
request(
|
request(
|
||||||
:body => MultiJson.encode(body),
|
:body => MultiJson.dump(body),
|
||||||
:headers => {'x-amz-target' => 'DynamoDB_20111205.DeleteItem'},
|
:headers => {'x-amz-target' => 'DynamoDB_20111205.DeleteItem'},
|
||||||
:idempotent => true
|
:idempotent => true
|
||||||
)
|
)
|
||||||
|
|
|
@ -30,7 +30,7 @@ module Fog
|
||||||
}
|
}
|
||||||
|
|
||||||
request(
|
request(
|
||||||
:body => MultiJson.encode(body),
|
:body => MultiJson.dump(body),
|
||||||
:headers => {'x-amz-target' => 'DynamoDB_20111205.DeleteTable'},
|
:headers => {'x-amz-target' => 'DynamoDB_20111205.DeleteTable'},
|
||||||
:idempotent => true
|
:idempotent => true
|
||||||
)
|
)
|
||||||
|
|
|
@ -32,7 +32,7 @@ module Fog
|
||||||
}
|
}
|
||||||
|
|
||||||
request(
|
request(
|
||||||
:body => MultiJson.encode(body),
|
:body => MultiJson.dump(body),
|
||||||
:headers => {'x-amz-target' => 'DynamoDB_20111205.DescribeTable'},
|
:headers => {'x-amz-target' => 'DynamoDB_20111205.DescribeTable'},
|
||||||
:idempotent => true
|
:idempotent => true
|
||||||
)
|
)
|
||||||
|
|
|
@ -31,7 +31,7 @@ module Fog
|
||||||
}.merge(options)
|
}.merge(options)
|
||||||
|
|
||||||
request(
|
request(
|
||||||
:body => MultiJson.encode(body),
|
:body => MultiJson.dump(body),
|
||||||
:headers => {'x-amz-target' => 'DynamoDB_20111205.GetItem'},
|
:headers => {'x-amz-target' => 'DynamoDB_20111205.GetItem'},
|
||||||
:idempotent => true
|
:idempotent => true
|
||||||
)
|
)
|
||||||
|
|
|
@ -17,7 +17,7 @@ module Fog
|
||||||
# * 'TableNames'<~Array> - table names
|
# * 'TableNames'<~Array> - table names
|
||||||
def list_tables(options = {})
|
def list_tables(options = {})
|
||||||
request(
|
request(
|
||||||
:body => MultiJson.encode(options),
|
:body => MultiJson.dump(options),
|
||||||
:headers => {'x-amz-target' => 'DynamoDB_20111205.ListTables'},
|
:headers => {'x-amz-target' => 'DynamoDB_20111205.ListTables'},
|
||||||
:idempotent => true
|
:idempotent => true
|
||||||
)
|
)
|
||||||
|
|
|
@ -30,7 +30,7 @@ module Fog
|
||||||
}.merge(options)
|
}.merge(options)
|
||||||
|
|
||||||
request(
|
request(
|
||||||
:body => MultiJson.encode(body),
|
:body => MultiJson.dump(body),
|
||||||
:headers => {'x-amz-target' => 'DynamoDB_20111205.PutItem'}
|
:headers => {'x-amz-target' => 'DynamoDB_20111205.PutItem'}
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
|
@ -33,7 +33,7 @@ module Fog
|
||||||
}.merge(options)
|
}.merge(options)
|
||||||
|
|
||||||
request(
|
request(
|
||||||
:body => MultiJson.encode(body),
|
:body => MultiJson.dump(body),
|
||||||
:headers => {'x-amz-target' => 'DynamoDB_20111205.Query'}
|
:headers => {'x-amz-target' => 'DynamoDB_20111205.Query'}
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
|
@ -33,7 +33,7 @@ module Fog
|
||||||
}.merge(options)
|
}.merge(options)
|
||||||
|
|
||||||
request(
|
request(
|
||||||
:body => MultiJson.encode(body),
|
:body => MultiJson.dump(body),
|
||||||
:headers => {'x-amz-target' => 'DynamoDB_20111205.Scan'},
|
:headers => {'x-amz-target' => 'DynamoDB_20111205.Scan'},
|
||||||
:idempotent => true
|
:idempotent => true
|
||||||
)
|
)
|
||||||
|
|
|
@ -38,7 +38,7 @@ module Fog
|
||||||
}.merge(options)
|
}.merge(options)
|
||||||
|
|
||||||
request(
|
request(
|
||||||
:body => MultiJson.encode(body),
|
:body => MultiJson.dump(body),
|
||||||
:headers => {'x-amz-target' => 'DynamoDB_20111205.UpdateItem'}
|
:headers => {'x-amz-target' => 'DynamoDB_20111205.UpdateItem'}
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
|
@ -34,7 +34,7 @@ module Fog
|
||||||
}
|
}
|
||||||
|
|
||||||
request(
|
request(
|
||||||
:body => MultiJson.encode(body),
|
:body => MultiJson.dump(body),
|
||||||
:headers => {'x-amz-target' => 'DynamoDB_20111205.UpdateTable'},
|
:headers => {'x-amz-target' => 'DynamoDB_20111205.UpdateTable'},
|
||||||
:idempotent => true
|
:idempotent => true
|
||||||
)
|
)
|
||||||
|
|
|
@ -25,7 +25,7 @@ module Fog
|
||||||
'Action' => 'PutGroupPolicy',
|
'Action' => 'PutGroupPolicy',
|
||||||
'GroupName' => group_name,
|
'GroupName' => group_name,
|
||||||
'PolicyName' => policy_name,
|
'PolicyName' => policy_name,
|
||||||
'PolicyDocument' => MultiJson.encode(policy_document),
|
'PolicyDocument' => MultiJson.dump(policy_document),
|
||||||
:parser => Fog::Parsers::AWS::IAM::Basic.new
|
:parser => Fog::Parsers::AWS::IAM::Basic.new
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
|
@ -24,7 +24,7 @@ module Fog
|
||||||
request(
|
request(
|
||||||
'Action' => 'PutUserPolicy',
|
'Action' => 'PutUserPolicy',
|
||||||
'PolicyName' => policy_name,
|
'PolicyName' => policy_name,
|
||||||
'PolicyDocument' => MultiJson.encode(policy_document),
|
'PolicyDocument' => MultiJson.dump(policy_document),
|
||||||
'UserName' => user_name,
|
'UserName' => user_name,
|
||||||
:parser => Fog::Parsers::AWS::IAM::Basic.new
|
:parser => Fog::Parsers::AWS::IAM::Basic.new
|
||||||
)
|
)
|
||||||
|
|
|
@ -27,7 +27,7 @@ module Fog
|
||||||
:method => 'GET',
|
:method => 'GET',
|
||||||
:query => {'policy' => nil}
|
:query => {'policy' => nil}
|
||||||
})
|
})
|
||||||
response.body = MultiJson.decode(response.body) unless response.body.nil?
|
response.body = MultiJson.load(response.body) unless response.body.nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -27,7 +27,7 @@ module Fog
|
||||||
|
|
||||||
def post_object_hidden_fields(options = {})
|
def post_object_hidden_fields(options = {})
|
||||||
if options['policy']
|
if options['policy']
|
||||||
options['policy'] = Base64.encode64(MultiJson.encode(options['policy'])).gsub("\n", "")
|
options['policy'] = Base64.encode64(MultiJson.dump(options['policy'])).gsub("\n", "")
|
||||||
options['AWSAccessKeyId'] = @aws_access_key_id
|
options['AWSAccessKeyId'] = @aws_access_key_id
|
||||||
options['Signature'] = Base64.encode64(@hmac.sign(options['policy'])).gsub("\n", "")
|
options['Signature'] = Base64.encode64(@hmac.sign(options['policy'])).gsub("\n", "")
|
||||||
end
|
end
|
||||||
|
|
|
@ -14,7 +14,7 @@ module Fog
|
||||||
|
|
||||||
def put_bucket_policy(bucket_name, policy)
|
def put_bucket_policy(bucket_name, policy)
|
||||||
request({
|
request({
|
||||||
:body => MultiJson.encode(policy),
|
:body => MultiJson.dump(policy),
|
||||||
:expects => 204,
|
:expects => 204,
|
||||||
:headers => {},
|
:headers => {},
|
||||||
:host => "#{bucket_name}.#{@host}",
|
:host => "#{bucket_name}.#{@host}",
|
||||||
|
|
|
@ -9,7 +9,7 @@ module Fog
|
||||||
request({
|
request({
|
||||||
'Action' => 'GetFederationToken',
|
'Action' => 'GetFederationToken',
|
||||||
'Name' => name,
|
'Name' => name,
|
||||||
'Policy' => MultiJson.encode(policy),
|
'Policy' => MultiJson.dump(policy),
|
||||||
'DurationSeconds' => duration,
|
'DurationSeconds' => duration,
|
||||||
:idempotent => true,
|
:idempotent => true,
|
||||||
:parser => Fog::Parsers::AWS::STS::GetSessionToken.new
|
:parser => Fog::Parsers::AWS::STS::GetSessionToken.new
|
||||||
|
|
|
@ -94,7 +94,7 @@ module Fog
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
unless response.body.empty?
|
unless response.body.empty?
|
||||||
response.body = MultiJson.decode(response.body)
|
response.body = MultiJson.load(response.body)
|
||||||
end
|
end
|
||||||
response
|
response
|
||||||
end
|
end
|
||||||
|
|
|
@ -121,7 +121,7 @@ module Fog
|
||||||
%{mkdir .ssh},
|
%{mkdir .ssh},
|
||||||
%{echo "#{public_key}" >> ~/.ssh/authorized_keys},
|
%{echo "#{public_key}" >> ~/.ssh/authorized_keys},
|
||||||
%{passwd -l #{username}},
|
%{passwd -l #{username}},
|
||||||
%{echo "#{MultiJson.encode(attributes)}" >> ~/attributes.json}
|
%{echo "#{MultiJson.dump(attributes)}" >> ~/attributes.json}
|
||||||
])
|
])
|
||||||
rescue Errno::ECONNREFUSED
|
rescue Errno::ECONNREFUSED
|
||||||
sleep(1)
|
sleep(1)
|
||||||
|
|
|
@ -134,7 +134,7 @@ module Fog
|
||||||
:path => url,
|
:path => url,
|
||||||
:expects => expected_responses
|
:expects => expected_responses
|
||||||
}
|
}
|
||||||
request_options[:body] = MultiJson.encode(options) unless options.nil?
|
request_options[:body] = MultiJson.dump(options) unless options.nil?
|
||||||
make_request(request_options)
|
make_request(request_options)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ module Fog
|
||||||
auth_url = options[:brightbox_auth_url] || @auth_url
|
auth_url = options[:brightbox_auth_url] || @auth_url
|
||||||
|
|
||||||
connection = Fog::Connection.new(auth_url)
|
connection = Fog::Connection.new(auth_url)
|
||||||
@authentication_body = MultiJson.encode({'client_id' => @brightbox_client_id, 'grant_type' => 'none'})
|
@authentication_body = MultiJson.dump({'client_id' => @brightbox_client_id, 'grant_type' => 'none'})
|
||||||
|
|
||||||
response = connection.request({
|
response = connection.request({
|
||||||
:path => "/token",
|
:path => "/token",
|
||||||
|
@ -159,7 +159,7 @@ module Fog
|
||||||
:method => 'POST',
|
:method => 'POST',
|
||||||
:body => @authentication_body
|
:body => @authentication_body
|
||||||
})
|
})
|
||||||
@oauth_token = MultiJson.decode(response.body)["access_token"]
|
@oauth_token = MultiJson.load(response.body)["access_token"]
|
||||||
return @oauth_token
|
return @oauth_token
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ module Fog
|
||||||
response = authenticated_request(params)
|
response = authenticated_request(params)
|
||||||
end
|
end
|
||||||
unless response.body.empty?
|
unless response.body.empty?
|
||||||
response = MultiJson.decode(response.body)
|
response = MultiJson.load(response.body)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ module Fog
|
||||||
:method => 'POST',
|
:method => 'POST',
|
||||||
:path => "/1.0/servers/#{identifier}/resize",
|
:path => "/1.0/servers/#{identifier}/resize",
|
||||||
:headers => {"Content-Type" => "application/json"},
|
:headers => {"Content-Type" => "application/json"},
|
||||||
:body => MultiJson.encode(options)
|
:body => MultiJson.dump(options)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,7 @@ module Fog
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
unless response.body.empty?
|
unless response.body.empty?
|
||||||
response.body = MultiJson.decode(response.body)
|
response.body = MultiJson.load(response.body)
|
||||||
end
|
end
|
||||||
response
|
response
|
||||||
end
|
end
|
||||||
|
|
|
@ -121,7 +121,7 @@ module Fog
|
||||||
%{mkdir .ssh},
|
%{mkdir .ssh},
|
||||||
%{echo "#{public_key}" >> ~/.ssh/authorized_keys},
|
%{echo "#{public_key}" >> ~/.ssh/authorized_keys},
|
||||||
%{passwd -l #{username}},
|
%{passwd -l #{username}},
|
||||||
%{echo "#{MultiJson.encode(attributes)}" >> ~/attributes.json},
|
%{echo "#{MultiJson.dump(attributes)}" >> ~/attributes.json},
|
||||||
])
|
])
|
||||||
rescue Errno::ECONNREFUSED
|
rescue Errno::ECONNREFUSED
|
||||||
sleep(1)
|
sleep(1)
|
||||||
|
|
|
@ -30,7 +30,7 @@ module Fog
|
||||||
data['server'].merge! options if options
|
data['server'].merge! options if options
|
||||||
|
|
||||||
request(
|
request(
|
||||||
:body => MultiJson.encode(data),
|
:body => MultiJson.dump(data),
|
||||||
:expects => [200, 202],
|
:expects => [200, 202],
|
||||||
:method => 'POST',
|
:method => 'POST',
|
||||||
:path => 'servers'
|
:path => 'servers'
|
||||||
|
|
|
@ -19,7 +19,7 @@ module Fog
|
||||||
:expects => [204],
|
:expects => [204],
|
||||||
:method => 'DELETE',
|
:method => 'DELETE',
|
||||||
:path => "servers/#{server_id}/ips",
|
:path => "servers/#{server_id}/ips",
|
||||||
:body => MultiJson.encode(data)
|
:body => MultiJson.dump(data)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -17,7 +17,7 @@ module Fog
|
||||||
:expects => [204],
|
:expects => [204],
|
||||||
:method => 'GET',
|
:method => 'GET',
|
||||||
:path => "servers/#{server_id}/ips/moveip",
|
:path => "servers/#{server_id}/ips/moveip",
|
||||||
:body => MultiJson.encode({'ip'=>"#{ip}"})
|
:body => MultiJson.dump({'ip'=>"#{ip}"})
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,7 +4,7 @@ module Fog
|
||||||
class Real
|
class Real
|
||||||
def server_action(id, action)
|
def server_action(id, action)
|
||||||
request(
|
request(
|
||||||
:body => MultiJson.encode(action),
|
:body => MultiJson.dump(action),
|
||||||
:expects => [204],
|
:expects => [204],
|
||||||
:method => 'POST',
|
:method => 'POST',
|
||||||
:path => "servers/#{id}/action")
|
:path => "servers/#{id}/action")
|
||||||
|
|
|
@ -165,7 +165,7 @@ module Fog
|
||||||
sessionid = cookies['JSESSIONID'].first
|
sessionid = cookies['JSESSIONID'].first
|
||||||
|
|
||||||
# Decode the login response
|
# Decode the login response
|
||||||
response = MultiJson.decode(response.body)
|
response = MultiJson.load(response.body)
|
||||||
|
|
||||||
user = response['loginresponse']
|
user = response['loginresponse']
|
||||||
user.merge!('sessionid' => sessionid)
|
user.merge!('sessionid' => sessionid)
|
||||||
|
@ -188,7 +188,7 @@ module Fog
|
||||||
end
|
end
|
||||||
|
|
||||||
response = issue_request(params,headers)
|
response = issue_request(params,headers)
|
||||||
response = MultiJson.decode(response.body) unless response.body.empty?
|
response = MultiJson.load(response.body) unless response.body.empty?
|
||||||
response
|
response
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -232,7 +232,7 @@ module Fog
|
||||||
})
|
})
|
||||||
|
|
||||||
rescue Excon::Errors::HTTPStatusError => error
|
rescue Excon::Errors::HTTPStatusError => error
|
||||||
error_response = MultiJson.decode(error.response.body)
|
error_response = MultiJson.load(error.response.body)
|
||||||
|
|
||||||
error_code = error_response.values.first['errorcode']
|
error_code = error_response.values.first['errorcode']
|
||||||
error_text = error_response.values.first['errortext']
|
error_text = error_response.values.first['errortext']
|
||||||
|
|
|
@ -122,7 +122,7 @@ module Fog
|
||||||
|
|
||||||
def to_json(options = {})
|
def to_json(options = {})
|
||||||
require 'multi_json'
|
require 'multi_json'
|
||||||
MultiJson.encode(self.map {|member| member.attributes})
|
MultiJson.dump(self.map {|member| member.attributes})
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -39,7 +39,7 @@ module Fog
|
||||||
|
|
||||||
def to_json(options = {})
|
def to_json(options = {})
|
||||||
require 'multi_json'
|
require 'multi_json'
|
||||||
MultiJson.encode(attributes)
|
MultiJson.dump(attributes)
|
||||||
end
|
end
|
||||||
|
|
||||||
def symbolize_keys(hash)
|
def symbolize_keys(hash)
|
||||||
|
|
|
@ -87,7 +87,7 @@ module Fog
|
||||||
response = @connection.request(params.merge!({:host => @host}))
|
response = @connection.request(params.merge!({:host => @host}))
|
||||||
|
|
||||||
unless response.body.empty?
|
unless response.body.empty?
|
||||||
response.body = MultiJson.decode(response.body)
|
response.body = MultiJson.load(response.body)
|
||||||
end
|
end
|
||||||
response
|
response
|
||||||
end
|
end
|
||||||
|
|
|
@ -14,7 +14,7 @@ module Fog
|
||||||
def create_domain(name)
|
def create_domain(name)
|
||||||
body = { "domain" => { "name" => name } }
|
body = { "domain" => { "name" => name } }
|
||||||
request(
|
request(
|
||||||
:body => MultiJson.encode(body),
|
:body => MultiJson.dump(body),
|
||||||
:expects => 201,
|
:expects => 201,
|
||||||
:method => 'POST',
|
:method => 'POST',
|
||||||
:path => '/domains'
|
:path => '/domains'
|
||||||
|
|
|
@ -36,7 +36,7 @@ module Fog
|
||||||
|
|
||||||
body["record"].merge!(options)
|
body["record"].merge!(options)
|
||||||
|
|
||||||
request( :body => MultiJson.encode(body),
|
request( :body => MultiJson.dump(body),
|
||||||
:expects => 201,
|
:expects => 201,
|
||||||
:method => 'POST',
|
:method => 'POST',
|
||||||
:path => "/domains/#{domain}/records" )
|
:path => "/domains/#{domain}/records" )
|
||||||
|
|
|
@ -30,7 +30,7 @@ module Fog
|
||||||
|
|
||||||
body = { "record" => options }
|
body = { "record" => options }
|
||||||
|
|
||||||
request( :body => MultiJson.encode(body),
|
request( :body => MultiJson.dump(body),
|
||||||
:expects => 200,
|
:expects => 200,
|
||||||
:method => "PUT",
|
:method => "PUT",
|
||||||
:path => "/domains/#{domain}/records/#{record_id}" )
|
:path => "/domains/#{domain}/records/#{record_id}" )
|
||||||
|
|
|
@ -119,7 +119,7 @@ module Fog
|
||||||
end
|
end
|
||||||
|
|
||||||
unless response.body.empty?
|
unless response.body.empty?
|
||||||
response.body = MultiJson.decode(response.body)
|
response.body = MultiJson.load(response.body)
|
||||||
end
|
end
|
||||||
|
|
||||||
response
|
response
|
||||||
|
|
|
@ -52,7 +52,7 @@ module Fog
|
||||||
:expects => 201,
|
:expects => 201,
|
||||||
:method => "POST",
|
:method => "POST",
|
||||||
:path => "/V1.2/domains/#{domain}/records",
|
:path => "/V1.2/domains/#{domain}/records",
|
||||||
:body => MultiJson.encode(body)
|
:body => MultiJson.dump(body)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ module Fog
|
||||||
:expects => 201,
|
:expects => 201,
|
||||||
:method => 'PUT',
|
:method => 'PUT',
|
||||||
:path => "/V1.2/secondary/#{secondary_name}",
|
:path => "/V1.2/secondary/#{secondary_name}",
|
||||||
:body => MultiJson.encode(body)
|
:body => MultiJson.dump(body)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ module Fog
|
||||||
:expects => 200,
|
:expects => 200,
|
||||||
:method => "PUT",
|
:method => "PUT",
|
||||||
:path => "/V1.2/domains/#{domain}/records/#{record_id}",
|
:path => "/V1.2/domains/#{domain}/records/#{record_id}",
|
||||||
:body => MultiJson.encode(options)
|
:body => MultiJson.dump(options)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ module Fog
|
||||||
:expects => 201,
|
:expects => 201,
|
||||||
:method => 'PUT',
|
:method => 'PUT',
|
||||||
:path => "/V1.2/secondary/#{secondary_name}",
|
:path => "/V1.2/secondary/#{secondary_name}",
|
||||||
:body => MultiJson.encode(body)
|
:body => MultiJson.dump(body)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ module Fog
|
||||||
if response.status == 307
|
if response.status == 307
|
||||||
response = poll_job(response)
|
response = poll_job(response)
|
||||||
elsif !response.body.empty?
|
elsif !response.body.empty?
|
||||||
response.body = MultiJson.decode(response.body)
|
response.body = MultiJson.load(response.body)
|
||||||
end
|
end
|
||||||
|
|
||||||
response
|
response
|
||||||
|
|
|
@ -15,7 +15,7 @@ module Fog
|
||||||
def post_record(type, zone, fqdn, rdata, options = {})
|
def post_record(type, zone, fqdn, rdata, options = {})
|
||||||
options.merge!('rdata' => rdata)
|
options.merge!('rdata' => rdata)
|
||||||
request(
|
request(
|
||||||
:body => MultiJson.encode(options),
|
:body => MultiJson.dump(options),
|
||||||
:expects => 200,
|
:expects => 200,
|
||||||
:method => :post,
|
:method => :post,
|
||||||
:path => ["#{type.to_s.upcase}Record", zone, fqdn].join('/')
|
:path => ["#{type.to_s.upcase}Record", zone, fqdn].join('/')
|
||||||
|
|
|
@ -8,7 +8,7 @@ module Fog
|
||||||
:expects => 200,
|
:expects => 200,
|
||||||
:method => :post,
|
:method => :post,
|
||||||
:path => "Session",
|
:path => "Session",
|
||||||
:body => MultiJson.encode({
|
:body => MultiJson.dump({
|
||||||
:customer_name => @dynect_customer,
|
:customer_name => @dynect_customer,
|
||||||
:user_name => @dynect_username,
|
:user_name => @dynect_username,
|
||||||
:password => @dynect_password
|
:password => @dynect_password
|
||||||
|
|
|
@ -13,7 +13,7 @@ module Fog
|
||||||
# * serial_style<~String> - style of serial number, in ['day', 'epoch', 'increment', 'minute']. Defaults to increment
|
# * serial_style<~String> - style of serial number, in ['day', 'epoch', 'increment', 'minute']. Defaults to increment
|
||||||
|
|
||||||
def post_zone(rname, ttl, zone, options = {})
|
def post_zone(rname, ttl, zone, options = {})
|
||||||
body = MultiJson.encode({
|
body = MultiJson.dump({
|
||||||
:rname => rname,
|
:rname => rname,
|
||||||
:token => auth_token,
|
:token => auth_token,
|
||||||
:ttl => ttl
|
:ttl => ttl
|
||||||
|
|
|
@ -14,7 +14,7 @@ module Fog
|
||||||
|
|
||||||
def put_zone(zone, options = {})
|
def put_zone(zone, options = {})
|
||||||
request(
|
request(
|
||||||
:body => MultiJson.encode(options),
|
:body => MultiJson.dump(options),
|
||||||
:expects => 200,
|
:expects => 200,
|
||||||
:method => :put,
|
:method => :put,
|
||||||
:path => 'Zone/' << zone
|
:path => 'Zone/' << zone
|
||||||
|
|
|
@ -94,7 +94,7 @@ module Fog
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
data.body = MultiJson.decode(data.body)
|
data.body = MultiJson.load(data.body)
|
||||||
|
|
||||||
response_code = data.body['response']['status']['code']
|
response_code = data.body['response']['status']['code']
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ module Fog
|
||||||
end
|
end
|
||||||
|
|
||||||
unless response.body.empty?
|
unless response.body.empty?
|
||||||
response.body = MultiJson.decode(response.body)
|
response.body = MultiJson.load(response.body)
|
||||||
end
|
end
|
||||||
|
|
||||||
response
|
response
|
||||||
|
|
|
@ -76,8 +76,8 @@ module Fog
|
||||||
%{mkdir .ssh},
|
%{mkdir .ssh},
|
||||||
%{echo "#{public_key}" >> ~/.ssh/authorized_keys},
|
%{echo "#{public_key}" >> ~/.ssh/authorized_keys},
|
||||||
%{passwd -l root},
|
%{passwd -l root},
|
||||||
%{echo "#{MultiJson.encode(attributes)}" >> ~/attributes.json},
|
%{echo "#{MultiJson.dump(attributes)}" >> ~/attributes.json},
|
||||||
%{echo "#{MultiJson.encode(metadata)}" >> ~/metadata.json}
|
%{echo "#{MultiJson.dump(metadata)}" >> ~/metadata.json}
|
||||||
])
|
])
|
||||||
rescue Errno::ECONNREFUSED
|
rescue Errno::ECONNREFUSED
|
||||||
sleep(1)
|
sleep(1)
|
||||||
|
|
|
@ -13,7 +13,7 @@ module Fog
|
||||||
data = nil
|
data = nil
|
||||||
message = nil
|
message = nil
|
||||||
else
|
else
|
||||||
data = MultiJson.decode(error.response.body)
|
data = MultiJson.load(error.response.body)
|
||||||
message = data['message']
|
message = data['message']
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -144,12 +144,12 @@ module Fog
|
||||||
:host => @host,
|
:host => @host,
|
||||||
:port => @port,
|
:port => @port,
|
||||||
:method => 'POST',
|
:method => 'POST',
|
||||||
:body => MultiJson.encode(request_body),
|
:body => MultiJson.dump(request_body),
|
||||||
:path => @auth_path
|
:path => @auth_path
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
body = MultiJson.decode(response.body)
|
body = MultiJson.load(response.body)
|
||||||
|
|
||||||
### fish out auth_token and endpoint for the service
|
### fish out auth_token and endpoint for the service
|
||||||
auth_token = body['access']['token']['id']
|
auth_token = body['access']['token']['id']
|
||||||
|
|
|
@ -119,7 +119,7 @@ module Fog
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if !response.body.empty? && parse_json && response.headers['Content-Type'] =~ %r{application/json}
|
if !response.body.empty? && parse_json && response.headers['Content-Type'] =~ %r{application/json}
|
||||||
response.body = MultiJson.decode(response.body)
|
response.body = MultiJson.load(response.body)
|
||||||
end
|
end
|
||||||
response
|
response
|
||||||
end
|
end
|
||||||
|
|
|
@ -167,7 +167,7 @@ module Fog
|
||||||
end
|
end
|
||||||
unless response.body.empty?
|
unless response.body.empty?
|
||||||
begin
|
begin
|
||||||
response.body = MultiJson.decode(response.body)
|
response.body = MultiJson.load(response.body)
|
||||||
rescue MultiJson::DecodeError => error
|
rescue MultiJson::DecodeError => error
|
||||||
response.body #### the body is not in JSON format so just return it as it is
|
response.body #### the body is not in JSON format so just return it as it is
|
||||||
end
|
end
|
||||||
|
|
|
@ -199,8 +199,8 @@ module Fog
|
||||||
%{mkdir .ssh},
|
%{mkdir .ssh},
|
||||||
%{echo "#{public_key}" >> ~/.ssh/authorized_keys},
|
%{echo "#{public_key}" >> ~/.ssh/authorized_keys},
|
||||||
%{passwd -l #{username}},
|
%{passwd -l #{username}},
|
||||||
%{echo "#{MultiJson.encode(attributes)}" >> ~/attributes.json},
|
%{echo "#{MultiJson.dump(attributes)}" >> ~/attributes.json},
|
||||||
%{echo "#{MultiJson.encode(metadata)}" >> ~/metadata.json}
|
%{echo "#{MultiJson.dump(metadata)}" >> ~/metadata.json}
|
||||||
])
|
])
|
||||||
rescue Errno::ECONNREFUSED
|
rescue Errno::ECONNREFUSED
|
||||||
sleep(1)
|
sleep(1)
|
||||||
|
|
|
@ -37,7 +37,7 @@ module Fog
|
||||||
end
|
end
|
||||||
|
|
||||||
request(
|
request(
|
||||||
:body => MultiJson.encode(data),
|
:body => MultiJson.dump(data),
|
||||||
:expects => 200,
|
:expects => 200,
|
||||||
:method => 'POST',
|
:method => 'POST',
|
||||||
:path => 'os-keypairs.json'
|
:path => 'os-keypairs.json'
|
||||||
|
|
|
@ -38,7 +38,7 @@ module Fog
|
||||||
}
|
}
|
||||||
|
|
||||||
request(
|
request(
|
||||||
:body => MultiJson.encode(data),
|
:body => MultiJson.dump(data),
|
||||||
:expects => 200,
|
:expects => 200,
|
||||||
:method => 'POST',
|
:method => 'POST',
|
||||||
:path => 'os-security-groups.json'
|
:path => 'os-security-groups.json'
|
||||||
|
|
|
@ -31,7 +31,7 @@ module Fog
|
||||||
}
|
}
|
||||||
|
|
||||||
request(
|
request(
|
||||||
:body => MultiJson.encode(data),
|
:body => MultiJson.dump(data),
|
||||||
:expects => 200,
|
:expects => 200,
|
||||||
:method => 'POST',
|
:method => 'POST',
|
||||||
:path => 'os-security-group-rules.json'
|
:path => 'os-security-group-rules.json'
|
||||||
|
|
|
@ -86,7 +86,7 @@ module Fog
|
||||||
end
|
end
|
||||||
|
|
||||||
request(
|
request(
|
||||||
:body => MultiJson.encode(data),
|
:body => MultiJson.dump(data),
|
||||||
:expects => 202,
|
:expects => 202,
|
||||||
:method => 'POST',
|
:method => 'POST',
|
||||||
:path => 'servers.json'
|
:path => 'servers.json'
|
||||||
|
|
|
@ -12,7 +12,7 @@ module Fog
|
||||||
#
|
#
|
||||||
def server_action(server_id, body, expects=202)
|
def server_action(server_id, body, expects=202)
|
||||||
request(
|
request(
|
||||||
:body => MultiJson.encode(body),
|
:body => MultiJson.dump(body),
|
||||||
:expects => expects,
|
:expects => expects,
|
||||||
:method => 'POST',
|
:method => 'POST',
|
||||||
:path => "servers/#{server_id}/action.json"
|
:path => "servers/#{server_id}/action.json"
|
||||||
|
|
|
@ -12,7 +12,7 @@ module Fog
|
||||||
# * name<~String> - New name for server
|
# * name<~String> - New name for server
|
||||||
def update_server(server_id, options = {})
|
def update_server(server_id, options = {})
|
||||||
request(
|
request(
|
||||||
:body => MultiJson.encode({ 'server' => options }),
|
:body => MultiJson.dump({ 'server' => options }),
|
||||||
:expects => 200,
|
:expects => 200,
|
||||||
:method => 'PUT',
|
:method => 'PUT',
|
||||||
:path => "servers/#{server_id}.json"
|
:path => "servers/#{server_id}.json"
|
||||||
|
|
|
@ -189,7 +189,7 @@ module Fog
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if !response.body.empty? && parse_json && response.headers['Content-Type'] =~ %r{application/json}
|
if !response.body.empty? && parse_json && response.headers['Content-Type'] =~ %r{application/json}
|
||||||
response.body = MultiJson.decode(response.body)
|
response.body = MultiJson.load(response.body)
|
||||||
end
|
end
|
||||||
response
|
response
|
||||||
end
|
end
|
||||||
|
|
|
@ -38,7 +38,7 @@ module Fog
|
||||||
end
|
end
|
||||||
response = super(options)
|
response = super(options)
|
||||||
unless response.body.empty?
|
unless response.body.empty?
|
||||||
response.body = MultiJson.decode(response.body)
|
response.body = MultiJson.load(response.body)
|
||||||
end
|
end
|
||||||
response
|
response
|
||||||
end
|
end
|
||||||
|
|
|
@ -144,7 +144,7 @@ module Fog
|
||||||
}.merge(request[:headers] || {}).merge(@header_method.call)
|
}.merge(request[:headers] || {}).merge(@header_method.call)
|
||||||
|
|
||||||
if request[:body]
|
if request[:body]
|
||||||
request[:body] = MultiJson.encode(request[:body])
|
request[:body] = MultiJson.dump(request[:body])
|
||||||
end
|
end
|
||||||
|
|
||||||
response = @connection.request(request)
|
response = @connection.request(request)
|
||||||
|
@ -161,7 +161,7 @@ module Fog
|
||||||
private
|
private
|
||||||
|
|
||||||
def json_decode(body)
|
def json_decode(body)
|
||||||
parsed = MultiJson.decode(body)
|
parsed = MultiJson.load(body)
|
||||||
decode_time_attrs(parsed)
|
decode_time_attrs(parsed)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -201,7 +201,7 @@ module Fog
|
||||||
commands = [
|
commands = [
|
||||||
%{mkdir .ssh},
|
%{mkdir .ssh},
|
||||||
# %{passwd -l #{username}}, #Not sure if we need this here
|
# %{passwd -l #{username}}, #Not sure if we need this here
|
||||||
# %{echo "#{MultiJson.encode(attributes)}" >> ~/attributes.json}
|
# %{echo "#{MultiJson.dump(attributes)}" >> ~/attributes.json}
|
||||||
]
|
]
|
||||||
if public_key
|
if public_key
|
||||||
commands << %{echo "#{public_key}" >> ~/.ssh/authorized_keys}
|
commands << %{echo "#{public_key}" >> ~/.ssh/authorized_keys}
|
||||||
|
|
|
@ -99,7 +99,7 @@ module Fog
|
||||||
response = @connection.request(params.merge!({:host => @host}))
|
response = @connection.request(params.merge!({:host => @host}))
|
||||||
|
|
||||||
unless response.body.empty?
|
unless response.body.empty?
|
||||||
response.body = MultiJson.decode(response.body)
|
response.body = MultiJson.load(response.body)
|
||||||
if data = response.body['ERRORARRAY'].first
|
if data = response.body['ERRORARRAY'].first
|
||||||
error = case data['ERRORCODE']
|
error = case data['ERRORCODE']
|
||||||
when 5
|
when 5
|
||||||
|
|
|
@ -74,7 +74,7 @@ module Fog
|
||||||
response = @connection.request(params.merge!({:host => @host}))
|
response = @connection.request(params.merge!({:host => @host}))
|
||||||
|
|
||||||
unless response.body.empty?
|
unless response.body.empty?
|
||||||
response.body = MultiJson.decode(response.body)
|
response.body = MultiJson.load(response.body)
|
||||||
if data = response.body['ERRORARRAY'].first
|
if data = response.body['ERRORARRAY'].first
|
||||||
error = case data['ERRORCODE']
|
error = case data['ERRORCODE']
|
||||||
when 5
|
when 5
|
||||||
|
|
|
@ -15,7 +15,7 @@ module Fog
|
||||||
:label => name,
|
:label => name,
|
||||||
:size => size,
|
:size => size,
|
||||||
:rootPass => password,
|
:rootPass => password,
|
||||||
:stackScriptUDFResponses => MultiJson.encode(options)
|
:stackScriptUDFResponses => MultiJson.dump(options)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
|
@ -108,7 +108,7 @@ module Fog
|
||||||
# Because the response is some weird xml-json thing, we need to try and mung
|
# 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
|
# the values out with a prefix, and if there is an empty data entry return an
|
||||||
# empty version of the expected type (if provided)
|
# empty version of the expected type (if provided)
|
||||||
response = MultiJson.decode(response.body)
|
response = MultiJson.load(response.body)
|
||||||
if options.has_key? :response_prefix
|
if options.has_key? :response_prefix
|
||||||
keys = options[:response_prefix].split('/')
|
keys = options[:response_prefix].split('/')
|
||||||
keys.each do |k|
|
keys.each do |k|
|
||||||
|
|
|
@ -13,7 +13,7 @@ module Fog
|
||||||
data = nil
|
data = nil
|
||||||
message = nil
|
message = nil
|
||||||
else
|
else
|
||||||
data = MultiJson.decode(error.response.body)
|
data = MultiJson.load(error.response.body)
|
||||||
message = data['message']
|
message = data['message']
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -91,12 +91,12 @@ module Fog
|
||||||
response = connection.request({
|
response = connection.request({
|
||||||
:expects => [200, 204],
|
:expects => [200, 204],
|
||||||
:headers => {'Content-Type' => 'application/json'},
|
:headers => {'Content-Type' => 'application/json'},
|
||||||
:body => MultiJson.encode(req_body),
|
:body => MultiJson.dump(req_body),
|
||||||
:host => uri.host,
|
:host => uri.host,
|
||||||
:method => 'POST',
|
:method => 'POST',
|
||||||
:path => (uri.path and not uri.path.empty?) ? uri.path : 'v2.0'
|
:path => (uri.path and not uri.path.empty?) ? uri.path : 'v2.0'
|
||||||
})
|
})
|
||||||
body=MultiJson.decode(response.body)
|
body=MultiJson.load(response.body)
|
||||||
|
|
||||||
if svc = body['access']['serviceCatalog'].detect{|x| x['name'] == @compute_service_name}
|
if svc = body['access']['serviceCatalog'].detect{|x| x['name'] == @compute_service_name}
|
||||||
mgmt_url = svc['endpoints'].detect{|x| x['publicURL']}['publicURL']
|
mgmt_url = svc['endpoints'].detect{|x| x['publicURL']}['publicURL']
|
||||||
|
|
|
@ -151,7 +151,7 @@ module Fog
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
unless response.body.empty?
|
unless response.body.empty?
|
||||||
response.body = MultiJson.decode(response.body)
|
response.body = MultiJson.load(response.body)
|
||||||
end
|
end
|
||||||
response
|
response
|
||||||
end
|
end
|
||||||
|
|
|
@ -175,8 +175,8 @@ module Fog
|
||||||
%{mkdir .ssh},
|
%{mkdir .ssh},
|
||||||
%{echo "#{public_key}" >> ~/.ssh/authorized_keys},
|
%{echo "#{public_key}" >> ~/.ssh/authorized_keys},
|
||||||
%{passwd -l #{username}},
|
%{passwd -l #{username}},
|
||||||
%{echo "#{MultiJson.encode(attributes)}" >> ~/attributes.json},
|
%{echo "#{MultiJson.dump(attributes)}" >> ~/attributes.json},
|
||||||
%{echo "#{MultiJson.encode(metadata)}" >> ~/metadata.json}
|
%{echo "#{MultiJson.dump(metadata)}" >> ~/metadata.json}
|
||||||
])
|
])
|
||||||
rescue Errno::ECONNREFUSED
|
rescue Errno::ECONNREFUSED
|
||||||
sleep(1)
|
sleep(1)
|
||||||
|
|
|
@ -29,7 +29,7 @@ module Fog
|
||||||
end
|
end
|
||||||
|
|
||||||
request(
|
request(
|
||||||
:body => MultiJson.encode(data),
|
:body => MultiJson.dump(data),
|
||||||
:expects => [200, 202],
|
:expects => [200, 202],
|
||||||
:method => 'POST',
|
:method => 'POST',
|
||||||
:path => 'servers.json'
|
:path => 'servers.json'
|
||||||
|
|
|
@ -5,7 +5,7 @@ module Fog
|
||||||
|
|
||||||
def server_action(server_id, body, expects=202)
|
def server_action(server_id, body, expects=202)
|
||||||
request(
|
request(
|
||||||
:body => MultiJson.encode(body),
|
:body => MultiJson.dump(body),
|
||||||
:expects => expects,
|
:expects => expects,
|
||||||
:method => 'POST',
|
:method => 'POST',
|
||||||
:path => "servers/#{server_id}/action.json"
|
:path => "servers/#{server_id}/action.json"
|
||||||
|
|
|
@ -6,7 +6,7 @@ module Fog
|
||||||
|
|
||||||
def set_metadata(collection_name, parent_id, metadata = {})
|
def set_metadata(collection_name, parent_id, metadata = {})
|
||||||
request(
|
request(
|
||||||
:body => MultiJson.encode({ 'metadata' => metadata }),
|
:body => MultiJson.dump({ 'metadata' => metadata }),
|
||||||
:expects => 200,
|
:expects => 200,
|
||||||
:method => 'PUT',
|
:method => 'PUT',
|
||||||
:path => "#{collection_name}/#{parent_id}/metadata"
|
:path => "#{collection_name}/#{parent_id}/metadata"
|
||||||
|
|
|
@ -6,7 +6,7 @@ module Fog
|
||||||
|
|
||||||
def update_meta(collection_name, parent_id, key, value)
|
def update_meta(collection_name, parent_id, key, value)
|
||||||
request(
|
request(
|
||||||
:body => MultiJson.encode({ 'meta' => { key => value }}),
|
:body => MultiJson.dump({ 'meta' => { key => value }}),
|
||||||
:expects => 200,
|
:expects => 200,
|
||||||
:method => 'PUT',
|
:method => 'PUT',
|
||||||
:path => "#{collection_name}/#{parent_id}/metadata/#{key}"
|
:path => "#{collection_name}/#{parent_id}/metadata/#{key}"
|
||||||
|
|
|
@ -6,7 +6,7 @@ module Fog
|
||||||
|
|
||||||
def update_metadata(collection_name, parent_id, metadata = {})
|
def update_metadata(collection_name, parent_id, metadata = {})
|
||||||
request(
|
request(
|
||||||
:body => MultiJson.encode({ 'metadata' => metadata }),
|
:body => MultiJson.dump({ 'metadata' => metadata }),
|
||||||
:expects => 200,
|
:expects => 200,
|
||||||
:method => 'POST',
|
:method => 'POST',
|
||||||
:path => "#{collection_name}/#{parent_id}/metadata.json"
|
:path => "#{collection_name}/#{parent_id}/metadata.json"
|
||||||
|
|
|
@ -5,7 +5,7 @@ module Fog
|
||||||
|
|
||||||
def update_server(server_id, options = {})
|
def update_server(server_id, options = {})
|
||||||
request(
|
request(
|
||||||
:body => MultiJson.encode({ 'server' => options }),
|
:body => MultiJson.dump({ 'server' => options }),
|
||||||
:expects => 200,
|
:expects => 200,
|
||||||
:method => 'PUT',
|
:method => 'PUT',
|
||||||
:path => "servers/#{server_id}.json"
|
:path => "servers/#{server_id}.json"
|
||||||
|
|
|
@ -13,7 +13,7 @@ module Fog
|
||||||
data = nil
|
data = nil
|
||||||
message = nil
|
message = nil
|
||||||
else
|
else
|
||||||
data = MultiJson.decode(error.response.body)
|
data = MultiJson.load(error.response.body)
|
||||||
message = data['message']
|
message = data['message']
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,7 @@ module Fog
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if !response.body.empty? && parse_json && response.headers['Content-Type'] =~ %r{application/json}
|
if !response.body.empty? && parse_json && response.headers['Content-Type'] =~ %r{application/json}
|
||||||
response.body = MultiJson.decode(response.body)
|
response.body = MultiJson.load(response.body)
|
||||||
end
|
end
|
||||||
response
|
response
|
||||||
end
|
end
|
||||||
|
|
|
@ -125,7 +125,7 @@ module Fog
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
unless response.body.empty?
|
unless response.body.empty?
|
||||||
response.body = MultiJson.decode(response.body)
|
response.body = MultiJson.load(response.body)
|
||||||
end
|
end
|
||||||
response
|
response
|
||||||
end
|
end
|
||||||
|
|
|
@ -108,7 +108,7 @@ module Fog
|
||||||
raise Fog::Rackspace::Errors::ServiceUnavailable.slurp error
|
raise Fog::Rackspace::Errors::ServiceUnavailable.slurp error
|
||||||
end
|
end
|
||||||
unless response.body.empty?
|
unless response.body.empty?
|
||||||
response.body = MultiJson.decode(response.body)
|
response.body = MultiJson.load(response.body)
|
||||||
end
|
end
|
||||||
response
|
response
|
||||||
end
|
end
|
||||||
|
|
|
@ -136,7 +136,7 @@ module Fog
|
||||||
raise ServiceError.slurp error
|
raise ServiceError.slurp error
|
||||||
end
|
end
|
||||||
unless response.body.empty?
|
unless response.body.empty?
|
||||||
response.body = MultiJson.decode(response.body)
|
response.body = MultiJson.load(response.body)
|
||||||
end
|
end
|
||||||
response
|
response
|
||||||
end
|
end
|
||||||
|
|
|
@ -104,8 +104,8 @@ module Fog
|
||||||
%{mkdir .ssh},
|
%{mkdir .ssh},
|
||||||
%{echo "#{public_key}" >> ~/.ssh/authorized_keys},
|
%{echo "#{public_key}" >> ~/.ssh/authorized_keys},
|
||||||
%{passwd -l #{username}},
|
%{passwd -l #{username}},
|
||||||
%{echo "#{MultiJson.encode(attributes)}" >> ~/attributes.json},
|
%{echo "#{MultiJson.dump(attributes)}" >> ~/attributes.json},
|
||||||
%{echo "#{MultiJson.encode(metadata)}" >> ~/metadata.json}
|
%{echo "#{MultiJson.dump(metadata)}" >> ~/metadata.json}
|
||||||
])
|
])
|
||||||
rescue Errno::ECONNREFUSED
|
rescue Errno::ECONNREFUSED
|
||||||
sleep(1)
|
sleep(1)
|
||||||
|
|
|
@ -23,7 +23,7 @@ module Fog
|
||||||
}
|
}
|
||||||
data['image'].merge!(options)
|
data['image'].merge!(options)
|
||||||
request(
|
request(
|
||||||
:body => MultiJson.encode(data),
|
:body => MultiJson.dump(data),
|
||||||
:expects => 202,
|
:expects => 202,
|
||||||
:method => 'POST',
|
:method => 'POST',
|
||||||
:path => "images"
|
:path => "images"
|
||||||
|
|
|
@ -56,7 +56,7 @@ module Fog
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
request(
|
request(
|
||||||
:body => MultiJson.encode(data),
|
:body => MultiJson.dump(data),
|
||||||
:expects => [200, 202],
|
:expects => [200, 202],
|
||||||
:method => 'POST',
|
:method => 'POST',
|
||||||
:path => 'servers.json'
|
:path => 'servers.json'
|
||||||
|
|
|
@ -12,7 +12,7 @@ module Fog
|
||||||
#
|
#
|
||||||
def server_action(server_id, body, expects=202)
|
def server_action(server_id, body, expects=202)
|
||||||
request(
|
request(
|
||||||
:body => MultiJson.encode(body),
|
:body => MultiJson.dump(body),
|
||||||
:expects => expects,
|
:expects => expects,
|
||||||
:method => 'POST',
|
:method => 'POST',
|
||||||
:path => "servers/#{server_id}/action.json"
|
:path => "servers/#{server_id}/action.json"
|
||||||
|
|
|
@ -12,7 +12,7 @@ module Fog
|
||||||
# * name<~String> - New name for server
|
# * name<~String> - New name for server
|
||||||
def update_server(server_id, options = {})
|
def update_server(server_id, options = {})
|
||||||
request(
|
request(
|
||||||
:body => MultiJson.encode({ 'server' => options }),
|
:body => MultiJson.dump({ 'server' => options }),
|
||||||
:expects => 204,
|
:expects => 204,
|
||||||
:method => 'PUT',
|
:method => 'PUT',
|
||||||
:path => "servers/#{server_id}.json"
|
:path => "servers/#{server_id}.json"
|
||||||
|
|
|
@ -25,7 +25,7 @@ module Fog
|
||||||
:expects => 202,
|
:expects => 202,
|
||||||
:method => 'POST',
|
:method => 'POST',
|
||||||
:path => "domains/#{domain_id}/records",
|
:path => "domains/#{domain_id}/records",
|
||||||
:body => MultiJson.encode(data)
|
:body => MultiJson.dump(data)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -39,7 +39,7 @@ module Fog
|
||||||
:expects => 202,
|
:expects => 202,
|
||||||
:method => 'POST',
|
:method => 'POST',
|
||||||
:path => 'domains',
|
:path => 'domains',
|
||||||
:body => MultiJson.encode(data)
|
:body => MultiJson.dump(data)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -27,7 +27,7 @@ module Fog
|
||||||
:expects => [202, 204],
|
:expects => [202, 204],
|
||||||
:method => 'PUT',
|
:method => 'PUT',
|
||||||
:path => path,
|
:path => path,
|
||||||
:body => MultiJson.encode(data)
|
:body => MultiJson.dump(data)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -28,7 +28,7 @@ module Fog
|
||||||
:expects => [202, 204],
|
:expects => [202, 204],
|
||||||
:method => 'PUT',
|
:method => 'PUT',
|
||||||
:path => path,
|
:path => path,
|
||||||
:body => MultiJson.encode(data)
|
:body => MultiJson.dump(data)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -12,7 +12,7 @@ module Fog
|
||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
request(
|
request(
|
||||||
:body => MultiJson.encode(data),
|
:body => MultiJson.dump(data),
|
||||||
:expects => [200, 202],
|
:expects => [200, 202],
|
||||||
:method => 'POST',
|
:method => 'POST',
|
||||||
:path => "loadbalancers/#{load_balancer_id}/accesslist"
|
:path => "loadbalancers/#{load_balancer_id}/accesslist"
|
||||||
|
|
|
@ -17,7 +17,7 @@ module Fog
|
||||||
data['loadBalancer']['algorithm'] = options[:algorithm] if options.has_key? :algorithm
|
data['loadBalancer']['algorithm'] = options[:algorithm] if options.has_key? :algorithm
|
||||||
|
|
||||||
request(
|
request(
|
||||||
:body => MultiJson.encode(data),
|
:body => MultiJson.dump(data),
|
||||||
:expects => 202,
|
:expects => 202,
|
||||||
:method => 'POST',
|
:method => 'POST',
|
||||||
:path => 'loadbalancers.json'
|
:path => 'loadbalancers.json'
|
||||||
|
|
|
@ -15,7 +15,7 @@ module Fog
|
||||||
data['nodes'][0]['weight'] = options[:weight]
|
data['nodes'][0]['weight'] = options[:weight]
|
||||||
end
|
end
|
||||||
request(
|
request(
|
||||||
:body => MultiJson.encode(data),
|
:body => MultiJson.dump(data),
|
||||||
:expects => [200, 202],
|
:expects => [200, 202],
|
||||||
:method => 'POST',
|
:method => 'POST',
|
||||||
:path => "loadbalancers/#{load_balancer_id}/nodes.json"
|
:path => "loadbalancers/#{load_balancer_id}/nodes.json"
|
||||||
|
|
|
@ -8,7 +8,7 @@ module Fog
|
||||||
'ipVersion' => 'IPV6'
|
'ipVersion' => 'IPV6'
|
||||||
}
|
}
|
||||||
request(
|
request(
|
||||||
:body => MultiJson.encode(data),
|
:body => MultiJson.dump(data),
|
||||||
:expects => [200, 202],
|
:expects => [200, 202],
|
||||||
:method => 'POST',
|
:method => 'POST',
|
||||||
:path => "loadbalancers/#{load_balancer_id}/virtualips.json"
|
:path => "loadbalancers/#{load_balancer_id}/virtualips.json"
|
||||||
|
|
|
@ -9,7 +9,7 @@ module Fog
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
request(
|
request(
|
||||||
:body => MultiJson.encode(data),
|
:body => MultiJson.dump(data),
|
||||||
:expects => [200, 202],
|
:expects => [200, 202],
|
||||||
:path => "loadbalancers/#{load_balancer_id}/connectionlogging",
|
:path => "loadbalancers/#{load_balancer_id}/connectionlogging",
|
||||||
:method => 'PUT'
|
:method => 'PUT'
|
||||||
|
|
|
@ -10,7 +10,7 @@ module Fog
|
||||||
'rateInterval' => rate_interval
|
'rateInterval' => rate_interval
|
||||||
}
|
}
|
||||||
request(
|
request(
|
||||||
:body => MultiJson.encode(data),
|
:body => MultiJson.dump(data),
|
||||||
:expects => [200, 202],
|
:expects => [200, 202],
|
||||||
:path => "loadbalancers/#{load_balancer_id}/connectionthrottle",
|
:path => "loadbalancers/#{load_balancer_id}/connectionthrottle",
|
||||||
:method => 'PUT'
|
:method => 'PUT'
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue