ridley 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,6 +14,22 @@ module Ridley
|
|
14
14
|
raise Errors::ArgumentError, "A path to a validator is required for bootstrapping"
|
15
15
|
end
|
16
16
|
end
|
17
|
+
|
18
|
+
# A hash of default options to be used in the Context initializer
|
19
|
+
#
|
20
|
+
# @return [Hash]
|
21
|
+
def default_options
|
22
|
+
@default_options ||= {
|
23
|
+
validator_client: "chef-validator",
|
24
|
+
hints: Hash.new,
|
25
|
+
attributes: Hash.new,
|
26
|
+
run_list: Array.new,
|
27
|
+
chef_version: Ridley::CHEF_VERSION,
|
28
|
+
environment: "_default",
|
29
|
+
sudo: true,
|
30
|
+
template: Bootstrapper.default_template
|
31
|
+
}
|
32
|
+
end
|
17
33
|
end
|
18
34
|
|
19
35
|
# @return [String]
|
@@ -61,22 +77,23 @@ module Ridley
|
|
61
77
|
# @option options [String] :template
|
62
78
|
# bootstrap template to use (default: omnibus)
|
63
79
|
def initialize(host, options = {})
|
80
|
+
options = self.class.default_options.merge(options)
|
64
81
|
self.class.validate_options(options)
|
65
82
|
|
66
83
|
@host = host
|
67
84
|
@server_url = options[:server_url]
|
68
85
|
@validator_path = options[:validator_path]
|
69
86
|
@node_name = options[:node_name]
|
70
|
-
@validator_client = options[:validator_client]
|
87
|
+
@validator_client = options[:validator_client]
|
71
88
|
@bootstrap_proxy = options[:bootstrap_proxy]
|
72
89
|
@encrypted_data_bag_secret_path = options[:encrypted_data_bag_secret_path]
|
73
|
-
@hints = options[:hints]
|
74
|
-
@attributes = options[:attributes]
|
75
|
-
@run_list = options[:run_list]
|
76
|
-
@chef_version = options[:chef_version]
|
77
|
-
@environment = options[:environment]
|
78
|
-
@sudo = options[:sudo]
|
79
|
-
@template_file = options[:template]
|
90
|
+
@hints = options[:hints]
|
91
|
+
@attributes = options[:attributes]
|
92
|
+
@run_list = options[:run_list]
|
93
|
+
@chef_version = options[:chef_version]
|
94
|
+
@environment = options[:environment]
|
95
|
+
@sudo = options[:sudo]
|
96
|
+
@template_file = options[:template]
|
80
97
|
end
|
81
98
|
|
82
99
|
# @return [String]
|
data/lib/ridley/connection.rb
CHANGED
@@ -17,6 +17,16 @@ module Ridley
|
|
17
17
|
raise ArgumentError, "Missing required option(s): #{missing.join(', ')}"
|
18
18
|
end
|
19
19
|
end
|
20
|
+
|
21
|
+
# A hash of default options to be used in the Connection initializer
|
22
|
+
#
|
23
|
+
# @return [Hash]
|
24
|
+
def default_options
|
25
|
+
{
|
26
|
+
thread_count: DEFAULT_THREAD_COUNT,
|
27
|
+
ssh: Hash.new
|
28
|
+
}
|
29
|
+
end
|
20
30
|
end
|
21
31
|
|
22
32
|
extend Forwardable
|
@@ -88,13 +98,14 @@ module Ridley
|
|
88
98
|
# @option options [URI, String, Hash] :proxy
|
89
99
|
# URI, String, or Hash of HTTP proxy options
|
90
100
|
def initialize(options = {})
|
101
|
+
options = self.class.default_options.merge(options)
|
91
102
|
self.class.validate_options(options)
|
92
103
|
|
93
104
|
@client_name = options[:client_name]
|
94
105
|
@client_key = File.expand_path(options[:client_key])
|
95
106
|
@organization = options[:organization]
|
96
|
-
@thread_count =
|
97
|
-
@ssh =
|
107
|
+
@thread_count = options[:thread_count]
|
108
|
+
@ssh = options[:ssh]
|
98
109
|
@validator_client = options[:validator_client]
|
99
110
|
@validator_path = options[:validator_path]
|
100
111
|
@encrypted_data_bag_secret_path = options[:encrypted_data_bag_secret_path]
|
@@ -34,13 +34,17 @@ module Ridley
|
|
34
34
|
def bootstrap(connection, *args)
|
35
35
|
options = args.last.is_a?(Hash) ? args.pop : Hash.new
|
36
36
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
37
|
+
default_options = {
|
38
|
+
server_url: connection.server_url,
|
39
|
+
ssh_user: connection.ssh[:user],
|
40
|
+
ssh_password: connection.ssh[:password],
|
41
|
+
ssh_timeout: connection.ssh[:timeout],
|
42
|
+
validator_path: connection.validator_path,
|
43
|
+
validator_client: connection.validator_client,
|
44
|
+
encrypted_data_bag_secret_path: connection.encrypted_data_bag_secret_path
|
45
|
+
}
|
46
|
+
|
47
|
+
options = default_options.merge(options)
|
44
48
|
|
45
49
|
Bootstrapper.new(args, options).run
|
46
50
|
end
|
data/lib/ridley/version.rb
CHANGED
@@ -16,6 +16,20 @@ describe Ridley::Bootstrapper::Context do
|
|
16
16
|
subject { Ridley::Bootstrapper::Context }
|
17
17
|
|
18
18
|
describe "::new" do
|
19
|
+
it "sets a default value of 'true' to 'sudo'" do
|
20
|
+
options.delete(:sudo)
|
21
|
+
obj = subject.new(host, options)
|
22
|
+
|
23
|
+
obj.send(:sudo).should be_true
|
24
|
+
end
|
25
|
+
|
26
|
+
it "sets the value of sudo to 'false' if provided" do
|
27
|
+
options.merge!(sudo: false)
|
28
|
+
obj = subject.new(host, options)
|
29
|
+
|
30
|
+
obj.send(:sudo).should be_false
|
31
|
+
end
|
32
|
+
|
19
33
|
context "when validator_path is not specified" do
|
20
34
|
let(:options) { Hash.new }
|
21
35
|
|
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.5.
|
4
|
+
version: 0.5.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-11-
|
12
|
+
date: 2012-11-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|
@@ -305,7 +305,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
305
305
|
version: '0'
|
306
306
|
segments:
|
307
307
|
- 0
|
308
|
-
hash:
|
308
|
+
hash: -675121695435893823
|
309
309
|
requirements: []
|
310
310
|
rubyforge_project:
|
311
311
|
rubygems_version: 1.8.23
|