ridley 0.12.2 → 0.12.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +5 -1
- data/Gemfile +1 -1
- data/lib/ridley/bootstrap_bindings/windows_template_binding.rb +1 -1
- data/lib/ridley/chef/cookbook/metadata.rb +1 -1
- data/lib/ridley/chef_objects/node_object.rb +0 -1
- data/lib/ridley/connection.rb +10 -1
- data/lib/ridley/host_connector/winrm/worker.rb +7 -0
- data/lib/ridley/middleware/chef_auth.rb +2 -0
- data/lib/ridley/middleware/chef_response.rb +3 -1
- data/lib/ridley/middleware/follow_redirects.rb +2 -0
- data/lib/ridley/middleware/gzip.rb +19 -0
- data/lib/ridley/middleware/parse_json.rb +8 -6
- data/lib/ridley/middleware/retry.rb +2 -0
- data/lib/ridley/middleware.rb +6 -22
- data/lib/ridley/mixin/bootstrap_binding.rb +2 -2
- data/lib/ridley/resources/environment_resource.rb +1 -1
- data/lib/ridley/resources/node_resource.rb +6 -2
- data/lib/ridley/resources/sandbox_resource.rb +2 -2
- data/lib/ridley/version.rb +1 -1
- data/lib/ridley.rb +1 -15
- data/ridley.gemspec +11 -14
- data/spec/spec_helper.rb +3 -11
- data/spec/support/chef_server.rb +3 -4
- data/spec/unit/ridley/chef/cookbook_spec.rb +1 -1
- data/spec/unit/ridley/chef_objects/node_object_spec.rb +1 -4
- data/spec/unit/ridley/host_connector/winrm/worker_spec.rb +4 -2
- data/spec/unit/ridley/middleware/gzip_spec.rb +59 -0
- data/spec/unit/ridley/resources/node_resource_spec.rb +23 -6
- data/spec/unit/ridley/resources/sandbox_resource_spec.rb +2 -2
- metadata +37 -82
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/lib/ridley/connection.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'open-uri'
|
2
2
|
require 'retryable'
|
3
3
|
require 'tempfile'
|
4
|
+
require 'zlib'
|
4
5
|
|
5
6
|
module Ridley
|
6
7
|
# @author Jamie Winsor <reset@riotgames.com>
|
@@ -48,6 +49,7 @@ module Ridley
|
|
48
49
|
|
49
50
|
options[:builder] = Faraday::Builder.new do |b|
|
50
51
|
b.response :json
|
52
|
+
b.response :gzip
|
51
53
|
b.request :retry,
|
52
54
|
max: @retries,
|
53
55
|
interval: @retry_interval,
|
@@ -141,7 +143,14 @@ module Ridley
|
|
141
143
|
defer {
|
142
144
|
retryable(tries: retries, on: OpenURI::HTTPError, sleep: retry_interval) do
|
143
145
|
open(target, 'rb', headers) do |remote|
|
144
|
-
|
146
|
+
body = remote.read
|
147
|
+
case remote.content_encoding
|
148
|
+
when ['gzip']
|
149
|
+
body = Zlib::GzipReader.new(StringIO.new(body), encoding: 'ASCII-8BIT').read
|
150
|
+
when ['deflate']
|
151
|
+
body = Zlib::Inflate.inflate(body)
|
152
|
+
end
|
153
|
+
local.write(body)
|
145
154
|
end
|
146
155
|
end
|
147
156
|
|
@@ -87,6 +87,13 @@ module Ridley
|
|
87
87
|
# @return [WinRM::WinRMWebService]
|
88
88
|
def winrm
|
89
89
|
@winrm_client ||= begin
|
90
|
+
require 'active_support/core_ext/kernel/reporting'
|
91
|
+
# Silencing warnings because not all versions of GSSAPI support all of the GSSAPI methods
|
92
|
+
# the gssapi gem attempts to attach to and these warnings are dumped to STDERR.
|
93
|
+
silence_warnings do
|
94
|
+
require 'winrm'
|
95
|
+
end
|
96
|
+
|
90
97
|
client = ::WinRM::WinRMWebService.new(winrm_endpoint, :plaintext,
|
91
98
|
user: user, pass: password, disable_sspi: true, basic_auth_only: true)
|
92
99
|
client.set_timeout(6000)
|
@@ -19,7 +19,7 @@ module Ridley
|
|
19
19
|
def on_complete(env)
|
20
20
|
log.debug { "==> handling Chef response" }
|
21
21
|
log.debug { "request env: #{env}" }
|
22
|
-
|
22
|
+
|
23
23
|
unless self.class.success?(env)
|
24
24
|
log.debug { "** error encounted in Chef response" }
|
25
25
|
raise Errors::HTTPError.fabricate(env)
|
@@ -28,3 +28,5 @@ module Ridley
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
31
|
+
|
32
|
+
Faraday.register_middleware(:response, chef_response: Ridley::Middleware::ChefResponse)
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'zlib'
|
2
|
+
|
3
|
+
module Ridley
|
4
|
+
module Middleware
|
5
|
+
# @author Jamie Winsor <reset@riotgames.com>
|
6
|
+
class Gzip < Faraday::Response::Middleware
|
7
|
+
def on_complete(env)
|
8
|
+
case env[:response_headers][CONTENT_ENCODING].to_s.downcase
|
9
|
+
when 'gzip'
|
10
|
+
env[:body] = Zlib::GzipReader.new(StringIO.new(env[:body]), encoding: 'ASCII-8BIT').read
|
11
|
+
when 'deflate'
|
12
|
+
env[:body] = Zlib::Inflate.inflate(env[:body])
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
Faraday.register_middleware(:response, gzip: Ridley::Middleware::ChefResponse)
|
@@ -5,8 +5,8 @@ module Ridley
|
|
5
5
|
include Ridley::Logging
|
6
6
|
|
7
7
|
JSON_TYPE = 'application/json'.freeze
|
8
|
-
|
9
|
-
BRACKETS = [
|
8
|
+
|
9
|
+
BRACKETS = [
|
10
10
|
"[",
|
11
11
|
"{"
|
12
12
|
].freeze
|
@@ -17,10 +17,10 @@ module Ridley
|
|
17
17
|
"\r",
|
18
18
|
"\t"
|
19
19
|
].freeze
|
20
|
-
|
20
|
+
|
21
21
|
class << self
|
22
22
|
include Ridley::Logging
|
23
|
-
|
23
|
+
|
24
24
|
# Takes a string containing JSON and converts it to a Ruby hash
|
25
25
|
# symbols for keys
|
26
26
|
#
|
@@ -28,13 +28,13 @@ module Ridley
|
|
28
28
|
#
|
29
29
|
# @return [Hash]
|
30
30
|
def parse(body)
|
31
|
-
result =
|
31
|
+
result = JSON.parse(body)
|
32
32
|
result.is_a?(Hash) ? Hashie::Mash.new(result) : result
|
33
33
|
end
|
34
34
|
|
35
35
|
# Extracts the type of the response from the response headers
|
36
36
|
# of a Faraday request env. 'text/html' will be returned if no
|
37
|
-
# content-type is specified in the response
|
37
|
+
# content-type is specified in the response
|
38
38
|
#
|
39
39
|
# @example
|
40
40
|
# env = {
|
@@ -108,3 +108,5 @@ module Ridley
|
|
108
108
|
end
|
109
109
|
end
|
110
110
|
end
|
111
|
+
|
112
|
+
Faraday.register_middleware(:response, json: Ridley::Middleware::ParseJson)
|
data/lib/ridley/middleware.rb
CHANGED
@@ -1,27 +1,11 @@
|
|
1
1
|
module Ridley
|
2
2
|
# @author Jamie Winsor <reset@riotgames.com>
|
3
3
|
module Middleware
|
4
|
-
CONTENT_TYPE
|
5
|
-
|
6
|
-
require_relative 'middleware/parse_json'
|
7
|
-
require_relative 'middleware/chef_response'
|
8
|
-
require_relative 'middleware/chef_auth'
|
9
|
-
require_relative 'middleware/follow_redirects'
|
10
|
-
require_relative 'middleware/retry'
|
11
|
-
|
12
|
-
Faraday.register_middleware :request,
|
13
|
-
chef_auth: -> { Ridley::Middleware::ChefAuth }
|
14
|
-
|
15
|
-
Faraday.register_middleware :request,
|
16
|
-
retry: -> { Ridley::Middleware::Retry }
|
17
|
-
|
18
|
-
Faraday.register_middleware :response,
|
19
|
-
json: -> { Ridley::Middleware::ParseJson }
|
20
|
-
|
21
|
-
Faraday.register_middleware :response,
|
22
|
-
follow_redirects: -> { Ridley::Middleware::FollowRedirects }
|
23
|
-
|
24
|
-
Faraday.register_middleware :response,
|
25
|
-
chef_response: -> { Ridley::Middleware::ChefResponse }
|
4
|
+
CONTENT_TYPE = 'content-type'.freeze
|
5
|
+
CONTENT_ENCODING = 'content-encoding'.freeze
|
26
6
|
end
|
27
7
|
end
|
8
|
+
|
9
|
+
Dir["#{File.dirname(__FILE__)}/middleware/*.rb"].sort.each do |path|
|
10
|
+
require_relative "middleware/#{File.basename(path, '.rb')}"
|
11
|
+
end
|
@@ -54,7 +54,7 @@ module Ridley
|
|
54
54
|
|
55
55
|
# @return [String]
|
56
56
|
def first_boot
|
57
|
-
|
57
|
+
JSON.fast_generate(attributes.merge(run_list: run_list))
|
58
58
|
end
|
59
59
|
|
60
60
|
# The validation key to create a new client for the node
|
@@ -74,4 +74,4 @@ module Ridley
|
|
74
74
|
end
|
75
75
|
|
76
76
|
end
|
77
|
-
end
|
77
|
+
end
|
@@ -18,7 +18,7 @@ module Ridley
|
|
18
18
|
def cookbook_versions(environment, run_list = [])
|
19
19
|
run_list = Array(run_list).flatten
|
20
20
|
chef_id = environment.respond_to?(:chef_id) ? environment.chef_id : environment
|
21
|
-
request(:post, "#{self.class.resource_path}/#{chef_id}/cookbook_versions",
|
21
|
+
request(:post, "#{self.class.resource_path}/#{chef_id}/cookbook_versions", JSON.fast_generate(run_list: run_list))
|
22
22
|
rescue AbortError => ex
|
23
23
|
if ex.cause.is_a?(Errors::HTTPNotFound)
|
24
24
|
abort Errors::ResourceNotFound.new(ex)
|
@@ -161,12 +161,16 @@ module Ridley
|
|
161
161
|
# @option options [Hash] :attributes
|
162
162
|
# attributes of normal precedence to merge
|
163
163
|
#
|
164
|
-
# @raise [Errors::
|
164
|
+
# @raise [Errors::ResourceNotFound]
|
165
165
|
# if the target node is not found
|
166
166
|
#
|
167
167
|
# @return [Ridley::NodeResource]
|
168
168
|
def merge_data(target, options = {})
|
169
|
-
find(target)
|
169
|
+
unless node = find(target)
|
170
|
+
abort Errors::ResourceNotFound.new
|
171
|
+
end
|
172
|
+
|
173
|
+
update(node.merge_data(options))
|
170
174
|
end
|
171
175
|
end
|
172
176
|
end
|
@@ -34,7 +34,7 @@ module Ridley
|
|
34
34
|
sumhash = { checksums: Hash.new }.tap do |chks|
|
35
35
|
Array(checksums).each { |chk| chks[:checksums][chk] = nil }
|
36
36
|
end
|
37
|
-
new(request(:post, self.class.resource_path,
|
37
|
+
new(request(:post, self.class.resource_path, JSON.fast_generate(sumhash)))
|
38
38
|
end
|
39
39
|
|
40
40
|
# @param [#chef_id] object
|
@@ -46,7 +46,7 @@ module Ridley
|
|
46
46
|
# @return [Hash]
|
47
47
|
def commit(object)
|
48
48
|
chef_id = object.respond_to?(:chef_id) ? object.chef_id : object
|
49
|
-
request(:put, "#{self.class.resource_path}/#{chef_id}",
|
49
|
+
request(:put, "#{self.class.resource_path}/#{chef_id}", JSON.fast_generate(is_completed: true))
|
50
50
|
rescue AbortError => ex
|
51
51
|
case ex.cause
|
52
52
|
when Ridley::Errors::HTTPBadRequest; abort Ridley::Errors::SandboxCommitError.new(ex.message)
|
data/lib/ridley/version.rb
CHANGED
data/lib/ridley.rb
CHANGED
@@ -1,27 +1,13 @@
|
|
1
|
-
require 'active_support/core_ext/kernel/reporting'
|
2
|
-
# Silencing warnings because not all versions of GSSAPI support all of the GSSAPI methods
|
3
|
-
# the gssapi gem attempts to attach to and these warnings are dumped to STDERR.
|
4
|
-
silence_warnings do
|
5
|
-
# Requiring winrm before all other gems because of https://github.com/WinRb/WinRM/issues/39
|
6
|
-
require 'winrm'
|
7
|
-
end
|
8
|
-
|
9
1
|
require 'active_support/inflector'
|
10
2
|
require 'addressable/uri'
|
11
3
|
require 'celluloid'
|
12
4
|
require 'chozo'
|
13
5
|
require 'faraday'
|
14
6
|
require 'forwardable'
|
15
|
-
require '
|
7
|
+
require 'json'
|
16
8
|
require 'pathname'
|
17
9
|
require 'solve'
|
18
10
|
|
19
|
-
if jruby?
|
20
|
-
require 'json/pure'
|
21
|
-
else
|
22
|
-
require 'json/ext'
|
23
|
-
end
|
24
|
-
|
25
11
|
JSON.create_id = nil
|
26
12
|
|
27
13
|
# @author Jamie Winsor <reset@riotgames.com>
|
data/ridley.gemspec
CHANGED
@@ -17,21 +17,18 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.version = Ridley::VERSION
|
18
18
|
s.required_ruby_version = ">= 1.9.1"
|
19
19
|
|
20
|
-
s.add_runtime_dependency 'json', '>= 1.5.0'
|
21
|
-
s.add_runtime_dependency 'multi_json', '>= 1.0.4'
|
22
|
-
s.add_runtime_dependency 'chozo', '>= 0.6.0'
|
23
|
-
s.add_runtime_dependency 'mixlib-log', '>= 1.3.0'
|
24
|
-
s.add_runtime_dependency 'mixlib-shellout', '>= 1.1.0'
|
25
|
-
s.add_runtime_dependency 'mixlib-config', '>= 1.1.0'
|
26
|
-
s.add_runtime_dependency 'mixlib-authentication', '>= 1.3.0'
|
27
20
|
s.add_runtime_dependency 'addressable'
|
28
|
-
s.add_runtime_dependency '
|
29
|
-
s.add_runtime_dependency '
|
30
|
-
s.add_runtime_dependency 'solve', '>= 0.4.4'
|
31
|
-
s.add_runtime_dependency 'celluloid', '~> 0.14.0'
|
32
|
-
s.add_runtime_dependency 'net-ssh'
|
21
|
+
s.add_runtime_dependency 'chozo', '>= 0.6.0'
|
22
|
+
s.add_runtime_dependency 'celluloid', '~> 0.14.0'
|
33
23
|
s.add_runtime_dependency 'erubis'
|
34
|
-
s.add_runtime_dependency '
|
24
|
+
s.add_runtime_dependency 'faraday', '>= 0.8.4'
|
25
|
+
s.add_runtime_dependency 'mixlib-log', '>= 1.3.0'
|
26
|
+
s.add_runtime_dependency 'mixlib-shellout', '>= 1.1.0'
|
27
|
+
s.add_runtime_dependency 'mixlib-config', '>= 1.1.0'
|
28
|
+
s.add_runtime_dependency 'mixlib-authentication', '>= 1.3.0'
|
29
|
+
s.add_runtime_dependency 'net-http-persistent', '>= 2.8'
|
30
|
+
s.add_runtime_dependency 'net-ssh'
|
35
31
|
s.add_runtime_dependency 'retryable'
|
36
|
-
s.add_runtime_dependency '
|
32
|
+
s.add_runtime_dependency 'solve', '>= 0.4.4'
|
33
|
+
s.add_runtime_dependency 'winrm', '~> 1.1.0'
|
37
34
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -19,15 +19,11 @@ def setup_rspec
|
|
19
19
|
config.filter_run focus: true
|
20
20
|
config.run_all_when_everything_filtered = true
|
21
21
|
|
22
|
+
config.before(:suite) { Ridley::RSpec::ChefServer.start }
|
23
|
+
|
22
24
|
config.before(:all) do
|
23
|
-
Celluloid.logger = nil
|
24
|
-
Ridley.logger = nil
|
25
|
+
Ridley.logger = Celluloid.logger = nil
|
25
26
|
WebMock.disable_net_connect!(allow_localhost: true, net_http_connect_on_start: true)
|
26
|
-
Ridley::RSpec::ChefServer.start
|
27
|
-
end
|
28
|
-
|
29
|
-
config.after(:all) do
|
30
|
-
Ridley::RSpec::ChefServer.stop
|
31
27
|
end
|
32
28
|
|
33
29
|
config.before(:each) do
|
@@ -36,10 +32,6 @@ def setup_rspec
|
|
36
32
|
clean_tmp_path
|
37
33
|
Ridley::RSpec::ChefServer.server.clear_data
|
38
34
|
end
|
39
|
-
|
40
|
-
config.after(:each) do
|
41
|
-
Ridley::RSpec::ChefServer.server.clear_data
|
42
|
-
end
|
43
35
|
end
|
44
36
|
end
|
45
37
|
|
data/spec/support/chef_server.rb
CHANGED
@@ -17,15 +17,14 @@ module Ridley::RSpec
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def server
|
20
|
-
@server ||= ChefZero::Server.new(port: PORT
|
20
|
+
@server ||= ChefZero::Server.new(port: PORT)
|
21
21
|
end
|
22
22
|
|
23
23
|
def server_url
|
24
|
-
"http://localhost
|
24
|
+
(@server && @server.url) || "http://localhost/#{PORT}"
|
25
25
|
end
|
26
26
|
|
27
27
|
def start
|
28
|
-
Thin::Logging.silent = true
|
29
28
|
server.start_background
|
30
29
|
server.on_response do |request, response|
|
31
30
|
request_log << [ request, response ]
|
@@ -71,7 +70,7 @@ module Ridley::RSpec
|
|
71
70
|
private
|
72
71
|
|
73
72
|
def load_data(key, name, hash)
|
74
|
-
ChefServer.server.load_data(key.to_s => { name =>
|
73
|
+
ChefServer.server.load_data(key.to_s => { name => JSON.fast_generate(hash) })
|
75
74
|
end
|
76
75
|
end
|
77
76
|
end
|
@@ -46,7 +46,7 @@ describe Ridley::Chef::Cookbook do
|
|
46
46
|
before do
|
47
47
|
FileUtils.mkdir_p(cookbook_path)
|
48
48
|
File.open(File.join(cookbook_path, 'metadata.json'), 'w+') do |f|
|
49
|
-
f.write
|
49
|
+
f.write JSON.fast_generate(name: "rspec_test")
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
@@ -209,10 +209,7 @@ describe Ridley::NodeObject do
|
|
209
209
|
end
|
210
210
|
|
211
211
|
describe "#merge_data" do
|
212
|
-
before(:each)
|
213
|
-
subject.name = "reset.riotgames.com"
|
214
|
-
subject.should_receive(:update)
|
215
|
-
end
|
212
|
+
before(:each) { subject.name = "reset.riotgames.com" }
|
216
213
|
|
217
214
|
it "appends items to the run_list" do
|
218
215
|
subject.merge_data(run_list: ["cook::one", "cook::two"])
|
@@ -25,7 +25,9 @@ describe Ridley::HostConnector::WinRM::Worker do
|
|
25
25
|
describe "#winrm" do
|
26
26
|
subject { winrm_worker.winrm }
|
27
27
|
|
28
|
-
it
|
28
|
+
it "returns a WinRM::WinRMWebService" do
|
29
|
+
expect(subject).to be_a(::WinRM::WinRMWebService)
|
30
|
+
end
|
29
31
|
end
|
30
32
|
|
31
33
|
describe "#get_command" do
|
@@ -83,7 +85,7 @@ describe Ridley::HostConnector::WinRM::Worker do
|
|
83
85
|
it "returns an :error with the response" do
|
84
86
|
status, response = run
|
85
87
|
expect(status).to eq(:error)
|
86
|
-
expect(response.stderr).to eq("stderr")
|
88
|
+
expect(response.stderr).to eq("stderr")
|
87
89
|
end
|
88
90
|
end
|
89
91
|
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Ridley::Middleware::Gzip do
|
4
|
+
let(:env) do
|
5
|
+
Hashie::Mash.new(
|
6
|
+
'response_headers' => {
|
7
|
+
'content-encoding' => nil
|
8
|
+
},
|
9
|
+
'body' => nil
|
10
|
+
)
|
11
|
+
end
|
12
|
+
|
13
|
+
subject { described_class.new }
|
14
|
+
|
15
|
+
describe "#on_complete" do
|
16
|
+
let(:run) { subject.on_complete(env) }
|
17
|
+
|
18
|
+
context "when content-encoding is set to 'gzip'" do
|
19
|
+
let(:secret) { "this is a secret zipped message" }
|
20
|
+
|
21
|
+
before do
|
22
|
+
env['response_headers']['content-encoding'] = 'gzip'
|
23
|
+
io = StringIO.new
|
24
|
+
writer = Zlib::GzipWriter.new(io)
|
25
|
+
writer.write(secret)
|
26
|
+
writer.close
|
27
|
+
env['body'] = io.string
|
28
|
+
end
|
29
|
+
|
30
|
+
it "unzips the commpressed body" do
|
31
|
+
run
|
32
|
+
expect(env['body']).to eq(secret)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
context "when content-encoding is set to 'deflate'" do
|
37
|
+
let(:secret) { "this is a secret deflated message" }
|
38
|
+
|
39
|
+
before do
|
40
|
+
env['response_headers']['content-encoding'] = 'deflate'
|
41
|
+
env['body'] = Zlib::Deflate.deflate(secret)
|
42
|
+
end
|
43
|
+
|
44
|
+
it "inflates the compressed body" do
|
45
|
+
run
|
46
|
+
expect(env['body']).to eq(secret)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
context "when content-encoding is set to nothing" do
|
51
|
+
before { env['body'] = 'not changed' }
|
52
|
+
|
53
|
+
it "does not manipulate the body of the request" do
|
54
|
+
run
|
55
|
+
expect(env['body']).to eq('not changed')
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -136,14 +136,31 @@ describe Ridley::NodeResource do
|
|
136
136
|
|
137
137
|
describe "#merge_data" do
|
138
138
|
subject { instance }
|
139
|
+
let(:node) { double('node') }
|
140
|
+
let(:data) { double('data') }
|
139
141
|
|
140
|
-
|
141
|
-
data = double('data')
|
142
|
-
node = double('node')
|
143
|
-
node.should_receive(:merge_data).with(data)
|
144
|
-
subject.should_receive(:find).and_return(node)
|
142
|
+
before { subject.stub(find: nil) }
|
145
143
|
|
146
|
-
|
144
|
+
context "when a node with the given name exists" do
|
145
|
+
before { subject.should_receive(:find).and_return(node) }
|
146
|
+
|
147
|
+
it "finds the target node, sends it the merge_data message, and updates it" do
|
148
|
+
updated = double('updated')
|
149
|
+
node.should_receive(:merge_data).with(data).and_return(updated)
|
150
|
+
subject.should_receive(:update).with(updated)
|
151
|
+
|
152
|
+
subject.merge_data(node, data)
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
context "when a node with the given name does not exist" do
|
157
|
+
before { subject.should_receive(:find).with(node).and_return(nil) }
|
158
|
+
|
159
|
+
it "raises a ResourceNotFound error" do
|
160
|
+
expect {
|
161
|
+
subject.merge_data(node, data)
|
162
|
+
}.to raise_error(Ridley::Errors::ResourceNotFound)
|
163
|
+
end
|
147
164
|
end
|
148
165
|
end
|
149
166
|
end
|
@@ -17,7 +17,7 @@ describe Ridley::SandboxResource do
|
|
17
17
|
|
18
18
|
before(:each) do
|
19
19
|
connection.stub(:post).
|
20
|
-
with(subject.class.resource_path,
|
20
|
+
with(subject.class.resource_path, JSON.fast_generate(checksums: checksums)).
|
21
21
|
and_return(response)
|
22
22
|
end
|
23
23
|
|
@@ -77,7 +77,7 @@ describe Ridley::SandboxResource do
|
|
77
77
|
end
|
78
78
|
|
79
79
|
it "sends a /PUT to the sandbox resource with is_complete set to true" do
|
80
|
-
connection.should_receive(:put).with(sandbox_path,
|
80
|
+
connection.should_receive(:put).with(sandbox_path, JSON.fast_generate(is_completed: true)).and_return(response)
|
81
81
|
|
82
82
|
subject.commit(sandbox_id)
|
83
83
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ridley
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.
|
4
|
+
version: 0.12.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,32 +9,16 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
12
|
+
date: 2013-05-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ! '>='
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: 1.5.0
|
22
|
-
type: :runtime
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ! '>='
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: 1.5.0
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: multi_json
|
15
|
+
name: addressable
|
32
16
|
requirement: !ruby/object:Gem::Requirement
|
33
17
|
none: false
|
34
18
|
requirements:
|
35
19
|
- - ! '>='
|
36
20
|
- !ruby/object:Gem::Version
|
37
|
-
version:
|
21
|
+
version: '0'
|
38
22
|
type: :runtime
|
39
23
|
prerelease: false
|
40
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -42,7 +26,7 @@ dependencies:
|
|
42
26
|
requirements:
|
43
27
|
- - ! '>='
|
44
28
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
29
|
+
version: '0'
|
46
30
|
- !ruby/object:Gem::Dependency
|
47
31
|
name: chozo
|
48
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -60,29 +44,29 @@ dependencies:
|
|
60
44
|
- !ruby/object:Gem::Version
|
61
45
|
version: 0.6.0
|
62
46
|
- !ruby/object:Gem::Dependency
|
63
|
-
name:
|
47
|
+
name: celluloid
|
64
48
|
requirement: !ruby/object:Gem::Requirement
|
65
49
|
none: false
|
66
50
|
requirements:
|
67
|
-
- -
|
51
|
+
- - ~>
|
68
52
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
53
|
+
version: 0.14.0
|
70
54
|
type: :runtime
|
71
55
|
prerelease: false
|
72
56
|
version_requirements: !ruby/object:Gem::Requirement
|
73
57
|
none: false
|
74
58
|
requirements:
|
75
|
-
- -
|
59
|
+
- - ~>
|
76
60
|
- !ruby/object:Gem::Version
|
77
|
-
version:
|
61
|
+
version: 0.14.0
|
78
62
|
- !ruby/object:Gem::Dependency
|
79
|
-
name:
|
63
|
+
name: erubis
|
80
64
|
requirement: !ruby/object:Gem::Requirement
|
81
65
|
none: false
|
82
66
|
requirements:
|
83
67
|
- - ! '>='
|
84
68
|
- !ruby/object:Gem::Version
|
85
|
-
version:
|
69
|
+
version: '0'
|
86
70
|
type: :runtime
|
87
71
|
prerelease: false
|
88
72
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -90,15 +74,15 @@ dependencies:
|
|
90
74
|
requirements:
|
91
75
|
- - ! '>='
|
92
76
|
- !ruby/object:Gem::Version
|
93
|
-
version:
|
77
|
+
version: '0'
|
94
78
|
- !ruby/object:Gem::Dependency
|
95
|
-
name:
|
79
|
+
name: faraday
|
96
80
|
requirement: !ruby/object:Gem::Requirement
|
97
81
|
none: false
|
98
82
|
requirements:
|
99
83
|
- - ! '>='
|
100
84
|
- !ruby/object:Gem::Version
|
101
|
-
version:
|
85
|
+
version: 0.8.4
|
102
86
|
type: :runtime
|
103
87
|
prerelease: false
|
104
88
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -106,9 +90,9 @@ dependencies:
|
|
106
90
|
requirements:
|
107
91
|
- - ! '>='
|
108
92
|
- !ruby/object:Gem::Version
|
109
|
-
version:
|
93
|
+
version: 0.8.4
|
110
94
|
- !ruby/object:Gem::Dependency
|
111
|
-
name: mixlib-
|
95
|
+
name: mixlib-log
|
112
96
|
requirement: !ruby/object:Gem::Requirement
|
113
97
|
none: false
|
114
98
|
requirements:
|
@@ -124,13 +108,13 @@ dependencies:
|
|
124
108
|
- !ruby/object:Gem::Version
|
125
109
|
version: 1.3.0
|
126
110
|
- !ruby/object:Gem::Dependency
|
127
|
-
name:
|
111
|
+
name: mixlib-shellout
|
128
112
|
requirement: !ruby/object:Gem::Requirement
|
129
113
|
none: false
|
130
114
|
requirements:
|
131
115
|
- - ! '>='
|
132
116
|
- !ruby/object:Gem::Version
|
133
|
-
version:
|
117
|
+
version: 1.1.0
|
134
118
|
type: :runtime
|
135
119
|
prerelease: false
|
136
120
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -138,15 +122,15 @@ dependencies:
|
|
138
122
|
requirements:
|
139
123
|
- - ! '>='
|
140
124
|
- !ruby/object:Gem::Version
|
141
|
-
version:
|
125
|
+
version: 1.1.0
|
142
126
|
- !ruby/object:Gem::Dependency
|
143
|
-
name:
|
127
|
+
name: mixlib-config
|
144
128
|
requirement: !ruby/object:Gem::Requirement
|
145
129
|
none: false
|
146
130
|
requirements:
|
147
131
|
- - ! '>='
|
148
132
|
- !ruby/object:Gem::Version
|
149
|
-
version:
|
133
|
+
version: 1.1.0
|
150
134
|
type: :runtime
|
151
135
|
prerelease: false
|
152
136
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -154,15 +138,15 @@ dependencies:
|
|
154
138
|
requirements:
|
155
139
|
- - ! '>='
|
156
140
|
- !ruby/object:Gem::Version
|
157
|
-
version:
|
141
|
+
version: 1.1.0
|
158
142
|
- !ruby/object:Gem::Dependency
|
159
|
-
name:
|
143
|
+
name: mixlib-authentication
|
160
144
|
requirement: !ruby/object:Gem::Requirement
|
161
145
|
none: false
|
162
146
|
requirements:
|
163
147
|
- - ! '>='
|
164
148
|
- !ruby/object:Gem::Version
|
165
|
-
version: 3.
|
149
|
+
version: 1.3.0
|
166
150
|
type: :runtime
|
167
151
|
prerelease: false
|
168
152
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -170,15 +154,15 @@ dependencies:
|
|
170
154
|
requirements:
|
171
155
|
- - ! '>='
|
172
156
|
- !ruby/object:Gem::Version
|
173
|
-
version: 3.
|
157
|
+
version: 1.3.0
|
174
158
|
- !ruby/object:Gem::Dependency
|
175
|
-
name:
|
159
|
+
name: net-http-persistent
|
176
160
|
requirement: !ruby/object:Gem::Requirement
|
177
161
|
none: false
|
178
162
|
requirements:
|
179
163
|
- - ! '>='
|
180
164
|
- !ruby/object:Gem::Version
|
181
|
-
version:
|
165
|
+
version: '2.8'
|
182
166
|
type: :runtime
|
183
167
|
prerelease: false
|
184
168
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -186,23 +170,7 @@ dependencies:
|
|
186
170
|
requirements:
|
187
171
|
- - ! '>='
|
188
172
|
- !ruby/object:Gem::Version
|
189
|
-
version:
|
190
|
-
- !ruby/object:Gem::Dependency
|
191
|
-
name: celluloid
|
192
|
-
requirement: !ruby/object:Gem::Requirement
|
193
|
-
none: false
|
194
|
-
requirements:
|
195
|
-
- - ~>
|
196
|
-
- !ruby/object:Gem::Version
|
197
|
-
version: 0.14.0
|
198
|
-
type: :runtime
|
199
|
-
prerelease: false
|
200
|
-
version_requirements: !ruby/object:Gem::Requirement
|
201
|
-
none: false
|
202
|
-
requirements:
|
203
|
-
- - ~>
|
204
|
-
- !ruby/object:Gem::Version
|
205
|
-
version: 0.14.0
|
173
|
+
version: '2.8'
|
206
174
|
- !ruby/object:Gem::Dependency
|
207
175
|
name: net-ssh
|
208
176
|
requirement: !ruby/object:Gem::Requirement
|
@@ -220,7 +188,7 @@ dependencies:
|
|
220
188
|
- !ruby/object:Gem::Version
|
221
189
|
version: '0'
|
222
190
|
- !ruby/object:Gem::Dependency
|
223
|
-
name:
|
191
|
+
name: retryable
|
224
192
|
requirement: !ruby/object:Gem::Requirement
|
225
193
|
none: false
|
226
194
|
requirements:
|
@@ -236,29 +204,13 @@ dependencies:
|
|
236
204
|
- !ruby/object:Gem::Version
|
237
205
|
version: '0'
|
238
206
|
- !ruby/object:Gem::Dependency
|
239
|
-
name:
|
240
|
-
requirement: !ruby/object:Gem::Requirement
|
241
|
-
none: false
|
242
|
-
requirements:
|
243
|
-
- - ! '>='
|
244
|
-
- !ruby/object:Gem::Version
|
245
|
-
version: '2.8'
|
246
|
-
type: :runtime
|
247
|
-
prerelease: false
|
248
|
-
version_requirements: !ruby/object:Gem::Requirement
|
249
|
-
none: false
|
250
|
-
requirements:
|
251
|
-
- - ! '>='
|
252
|
-
- !ruby/object:Gem::Version
|
253
|
-
version: '2.8'
|
254
|
-
- !ruby/object:Gem::Dependency
|
255
|
-
name: retryable
|
207
|
+
name: solve
|
256
208
|
requirement: !ruby/object:Gem::Requirement
|
257
209
|
none: false
|
258
210
|
requirements:
|
259
211
|
- - ! '>='
|
260
212
|
- !ruby/object:Gem::Version
|
261
|
-
version:
|
213
|
+
version: 0.4.4
|
262
214
|
type: :runtime
|
263
215
|
prerelease: false
|
264
216
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -266,7 +218,7 @@ dependencies:
|
|
266
218
|
requirements:
|
267
219
|
- - ! '>='
|
268
220
|
- !ruby/object:Gem::Version
|
269
|
-
version:
|
221
|
+
version: 0.4.4
|
270
222
|
- !ruby/object:Gem::Dependency
|
271
223
|
name: winrm
|
272
224
|
requirement: !ruby/object:Gem::Requirement
|
@@ -339,6 +291,7 @@ files:
|
|
339
291
|
- lib/ridley/middleware/chef_auth.rb
|
340
292
|
- lib/ridley/middleware/chef_response.rb
|
341
293
|
- lib/ridley/middleware/follow_redirects.rb
|
294
|
+
- lib/ridley/middleware/gzip.rb
|
342
295
|
- lib/ridley/middleware/parse_json.rb
|
343
296
|
- lib/ridley/middleware/retry.rb
|
344
297
|
- lib/ridley/mixin.rb
|
@@ -420,6 +373,7 @@ files:
|
|
420
373
|
- spec/unit/ridley/host_connector_spec.rb
|
421
374
|
- spec/unit/ridley/middleware/chef_auth_spec.rb
|
422
375
|
- spec/unit/ridley/middleware/chef_response_spec.rb
|
376
|
+
- spec/unit/ridley/middleware/gzip_spec.rb
|
423
377
|
- spec/unit/ridley/middleware/parse_json_spec.rb
|
424
378
|
- spec/unit/ridley/mixin/bootstrap_binding_spec.rb
|
425
379
|
- spec/unit/ridley/resource_spec.rb
|
@@ -455,7 +409,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
455
409
|
version: '0'
|
456
410
|
segments:
|
457
411
|
- 0
|
458
|
-
hash:
|
412
|
+
hash: 3894427319828211488
|
459
413
|
requirements: []
|
460
414
|
rubyforge_project:
|
461
415
|
rubygems_version: 1.8.23
|
@@ -524,6 +478,7 @@ test_files:
|
|
524
478
|
- spec/unit/ridley/host_connector_spec.rb
|
525
479
|
- spec/unit/ridley/middleware/chef_auth_spec.rb
|
526
480
|
- spec/unit/ridley/middleware/chef_response_spec.rb
|
481
|
+
- spec/unit/ridley/middleware/gzip_spec.rb
|
527
482
|
- spec/unit/ridley/middleware/parse_json_spec.rb
|
528
483
|
- spec/unit/ridley/mixin/bootstrap_binding_spec.rb
|
529
484
|
- spec/unit/ridley/resource_spec.rb
|