ridley 4.4.0 → 4.4.1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/ridley/chef/config.rb +74 -11
- data/lib/ridley/version.rb +1 -1
- data/ridley.gemspec +0 -1
- data/spec/unit/ridley_spec.rb +27 -6
- metadata +2 -16
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 32e1dbb729d85a4c08c66b4b7d07a5fd26b0bdb9
|
|
4
|
+
data.tar.gz: 6f3c4bee09d4a1bff4e2260a2c66c35b39fdf9d5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bc76d74cd487011835a6fb0b698d58d977393e826c3d0c56f68e26a1278e901e35898f211e618d7babcbf7070291c8ce0b03a0a38e5ece4acb2527a1d1fb9991
|
|
7
|
+
data.tar.gz: 15f8611da50402f310681d3f1c4cae1cdea4aad2fe9a79eb8d0d683c0e49b2cb26c14ad017d7a0cec6cd5a6e7cf572806879d1eb7ae512b10d94ab9b9019219f
|
data/CHANGELOG.md
CHANGED
data/lib/ridley/chef/config.rb
CHANGED
|
@@ -1,23 +1,86 @@
|
|
|
1
|
-
require '
|
|
2
|
-
require 'chef-config/workstation_config_loader'
|
|
1
|
+
require 'buff/config/ruby'
|
|
3
2
|
require 'socket'
|
|
4
3
|
|
|
5
4
|
module Ridley::Chef
|
|
6
|
-
class Config
|
|
5
|
+
class Config < Buff::Config::Ruby
|
|
6
|
+
class << self
|
|
7
|
+
# Return the most sensible path to the Chef configuration file. This can
|
|
8
|
+
# be configured by setting a value for the 'RIDLEY_CHEF_CONFIG' environment
|
|
9
|
+
# variable.
|
|
10
|
+
#
|
|
11
|
+
# @return [String, nil]
|
|
12
|
+
def location
|
|
13
|
+
possibles = []
|
|
14
|
+
|
|
15
|
+
possibles << ENV['RIDLEY_CHEF_CONFIG'] if ENV['RIDLEY_CHEF_CONFIG']
|
|
16
|
+
possibles << File.join(ENV['KNIFE_HOME'], 'knife.rb') if ENV['KNIFE_HOME']
|
|
17
|
+
possibles << File.join(working_dir, 'knife.rb') if working_dir
|
|
18
|
+
|
|
19
|
+
# Ascending search for .chef directory siblings
|
|
20
|
+
Pathname.new(working_dir).ascend do |file|
|
|
21
|
+
sibling_chef = File.join(file, '.chef')
|
|
22
|
+
possibles << File.join(sibling_chef, 'knife.rb')
|
|
23
|
+
end if working_dir
|
|
24
|
+
|
|
25
|
+
possibles << File.join(ENV['HOME'], '.chef', 'knife.rb') if ENV['HOME']
|
|
26
|
+
possibles.compact!
|
|
27
|
+
|
|
28
|
+
location = possibles.find { |loc| File.exists?(File.expand_path(loc)) }
|
|
29
|
+
|
|
30
|
+
File.expand_path(location) unless location.nil?
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
private
|
|
34
|
+
|
|
35
|
+
# The current working directory
|
|
36
|
+
#
|
|
37
|
+
# @return [String]
|
|
38
|
+
def working_dir
|
|
39
|
+
ENV['PWD'] || Dir.pwd
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
set_assignment_mode :carefree
|
|
44
|
+
|
|
45
|
+
attribute :node_name,
|
|
46
|
+
default: -> { Socket.gethostname }
|
|
47
|
+
attribute :chef_server_url,
|
|
48
|
+
default: 'http://localhost:4000'
|
|
49
|
+
attribute :client_key,
|
|
50
|
+
default: -> { platform_specific_path('/etc/chef/client.pem') }
|
|
51
|
+
attribute :validation_key,
|
|
52
|
+
default: -> { platform_specific_path('/etc/chef/validation.pem') }
|
|
53
|
+
attribute :validation_client_name,
|
|
54
|
+
default: 'chef-validator'
|
|
55
|
+
|
|
56
|
+
attribute :cookbook_copyright,
|
|
57
|
+
default: 'YOUR_NAME'
|
|
58
|
+
attribute :cookbook_email,
|
|
59
|
+
default: 'YOUR_EMAIL'
|
|
60
|
+
attribute :cookbook_license,
|
|
61
|
+
default: 'reserved'
|
|
62
|
+
|
|
63
|
+
attribute :knife,
|
|
64
|
+
default: {}
|
|
65
|
+
|
|
66
|
+
# Prior to Chef 11, the cache implementation was based on
|
|
67
|
+
# moneta and configured via cache_options[:path]. Knife configs
|
|
68
|
+
# generated with Chef 11 will have `syntax_check_cache_path`, but older
|
|
69
|
+
# configs will have `cache_options[:path]`. `cache_options` is marked
|
|
70
|
+
# deprecated in chef/config.rb but doesn't currently trigger a warning.
|
|
71
|
+
# See also: CHEF-3715
|
|
72
|
+
attribute :syntax_check_cache_path,
|
|
73
|
+
default: -> { Dir.mktmpdir }
|
|
74
|
+
attribute :cache_options,
|
|
75
|
+
default: -> { { path: defined?(syntax_check_cache_path) ? syntax_check_cache_path : Dir.mktmpdir } }
|
|
76
|
+
|
|
7
77
|
# Create a new Chef Config object.
|
|
8
78
|
#
|
|
9
79
|
# @param [#to_s] path
|
|
10
80
|
# the path to the configuration file
|
|
11
81
|
# @param [Hash] options
|
|
12
82
|
def initialize(path, options = {})
|
|
13
|
-
|
|
14
|
-
ChefConfig::Config.merge!(options)
|
|
15
|
-
ChefConfig::Config.export_proxies # Set proxy settings as environment variables
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
# The configuration as a hash
|
|
19
|
-
def to_hash
|
|
20
|
-
ChefConfig::Config.save(true)
|
|
83
|
+
super(path || self.class.location, options)
|
|
21
84
|
end
|
|
22
85
|
end
|
|
23
86
|
end
|
data/lib/ridley/version.rb
CHANGED
data/ridley.gemspec
CHANGED
|
@@ -25,7 +25,6 @@ Gem::Specification.new do |s|
|
|
|
25
25
|
s.add_dependency 'buff-shell_out', '~> 0.1'
|
|
26
26
|
s.add_dependency 'celluloid', '~> 0.16.0'
|
|
27
27
|
s.add_dependency 'celluloid-io', '~> 0.16.1'
|
|
28
|
-
s.add_dependency 'chef-config'
|
|
29
28
|
s.add_dependency 'erubis'
|
|
30
29
|
s.add_dependency 'faraday', '~> 0.9.0'
|
|
31
30
|
s.add_dependency 'hashie', '>= 2.0.2', '< 4.0.0'
|
data/spec/unit/ridley_spec.rb
CHANGED
|
@@ -37,29 +37,43 @@ describe Ridley do
|
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
it "creates a Ridley connection from the Chef config" do
|
|
40
|
-
expect(Ridley::Client).to receive(:new).with(
|
|
40
|
+
expect(Ridley::Client).to receive(:new).with({
|
|
41
41
|
client_key: 'username.pem',
|
|
42
42
|
client_name: 'username',
|
|
43
43
|
validator_client: 'validator',
|
|
44
44
|
validator_path: 'validator.pem',
|
|
45
45
|
server_url: 'https://api.opscode.com',
|
|
46
|
+
|
|
47
|
+
cookbook_copyright: 'YOUR_NAME',
|
|
48
|
+
cookbook_email: 'YOUR_EMAIL',
|
|
49
|
+
cookbook_license: 'reserved',
|
|
50
|
+
|
|
51
|
+
knife: {},
|
|
52
|
+
|
|
46
53
|
syntax_check_cache_path: "/foo/bar",
|
|
47
54
|
cache_options: { path: "~/.chef/checksums" },
|
|
48
|
-
)
|
|
55
|
+
}).and_return(nil)
|
|
49
56
|
|
|
50
57
|
subject.from_chef_config(path)
|
|
51
58
|
end
|
|
52
59
|
|
|
53
60
|
it "allows the user to override attributes" do
|
|
54
|
-
expect(Ridley::Client).to receive(:new).with(
|
|
61
|
+
expect(Ridley::Client).to receive(:new).with({
|
|
55
62
|
client_key: 'bacon.pem',
|
|
56
63
|
client_name: 'bacon',
|
|
57
64
|
validator_client: 'validator',
|
|
58
65
|
validator_path: 'validator.pem',
|
|
59
66
|
server_url: 'https://api.opscode.com',
|
|
67
|
+
|
|
68
|
+
cookbook_copyright: 'YOUR_NAME',
|
|
69
|
+
cookbook_email: 'YOUR_EMAIL',
|
|
70
|
+
cookbook_license: 'reserved',
|
|
71
|
+
|
|
72
|
+
knife: {},
|
|
73
|
+
|
|
60
74
|
syntax_check_cache_path: "/foo/bar",
|
|
61
75
|
cache_options: { path: "~/.chef/checksums" },
|
|
62
|
-
)
|
|
76
|
+
})
|
|
63
77
|
|
|
64
78
|
subject.from_chef_config(path, client_key: 'bacon.pem', client_name: 'bacon')
|
|
65
79
|
end
|
|
@@ -74,15 +88,22 @@ describe Ridley do
|
|
|
74
88
|
end
|
|
75
89
|
|
|
76
90
|
it "does a knife.rb search" do
|
|
77
|
-
expect(Ridley::Client).to receive(:new).with(
|
|
91
|
+
expect(Ridley::Client).to receive(:new).with({
|
|
78
92
|
client_key: 'username.pem',
|
|
79
93
|
client_name: 'username',
|
|
80
94
|
validator_client: 'validator',
|
|
81
95
|
validator_path: 'validator.pem',
|
|
82
96
|
server_url: 'https://api.opscode.com',
|
|
97
|
+
|
|
98
|
+
cookbook_copyright: 'YOUR_NAME',
|
|
99
|
+
cookbook_email: 'YOUR_EMAIL',
|
|
100
|
+
cookbook_license: 'reserved',
|
|
101
|
+
|
|
102
|
+
knife: {},
|
|
103
|
+
|
|
83
104
|
syntax_check_cache_path: "/foo/bar",
|
|
84
105
|
cache_options: { path: "~/.chef/checksums" },
|
|
85
|
-
)
|
|
106
|
+
}).and_return(nil)
|
|
86
107
|
|
|
87
108
|
Dir.chdir(tmp_path) do
|
|
88
109
|
ENV['PWD'] = Dir.pwd
|
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: 4.4.
|
|
4
|
+
version: 4.4.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jamie Winsor
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2016-01-
|
|
12
|
+
date: 2016-01-12 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: addressable
|
|
@@ -123,20 +123,6 @@ dependencies:
|
|
|
123
123
|
- - "~>"
|
|
124
124
|
- !ruby/object:Gem::Version
|
|
125
125
|
version: 0.16.1
|
|
126
|
-
- !ruby/object:Gem::Dependency
|
|
127
|
-
name: chef-config
|
|
128
|
-
requirement: !ruby/object:Gem::Requirement
|
|
129
|
-
requirements:
|
|
130
|
-
- - ">="
|
|
131
|
-
- !ruby/object:Gem::Version
|
|
132
|
-
version: '0'
|
|
133
|
-
type: :runtime
|
|
134
|
-
prerelease: false
|
|
135
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
136
|
-
requirements:
|
|
137
|
-
- - ">="
|
|
138
|
-
- !ruby/object:Gem::Version
|
|
139
|
-
version: '0'
|
|
140
126
|
- !ruby/object:Gem::Dependency
|
|
141
127
|
name: erubis
|
|
142
128
|
requirement: !ruby/object:Gem::Requirement
|