poise 2.5.0 → 2.6.0
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/.kitchen.yml +1 -16
- data/.travis.yml +1 -6
- data/CHANGELOG.md +9 -0
- data/Gemfile +1 -0
- data/lib/poise/backports.rb +1 -0
- data/lib/poise/backports/verify_path.rb +33 -0
- data/lib/poise/helpers/lazy_default.rb +6 -1
- data/lib/poise/version.rb +1 -1
- data/test/{cookbooks/poise_test → cookbook}/attributes/default.rb +0 -0
- data/test/{cookbooks/poise_test → cookbook}/libraries/app.rb +0 -0
- data/test/{cookbooks/poise_test → cookbook}/libraries/app_config.rb +0 -0
- data/test/{cookbooks/poise_test → cookbook}/libraries/inversion.rb +0 -0
- data/test/{cookbooks/poise_test → cookbook}/metadata.rb +0 -0
- data/test/{cookbooks/poise_test → cookbook}/recipes/default.rb +2 -0
- data/test/{cookbooks/poise_test → cookbook}/recipes/inversion.rb +0 -0
- data/{Berksfile → test/gemfiles/chef-12.6.gemfile} +3 -10
- data/test/gemfiles/chef-12.gemfile +1 -1
- data/test/gemfiles/master.gemfile +1 -0
- data/test/spec/backports/verify_path_spec.rb +27 -0
- data/test/spec/helpers/lazy_default_spec.rb +41 -0
- metadata +21 -18
- data/.kitchen.travis.yml +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1545650809810c8ee25795e7b56b933568de0914
|
4
|
+
data.tar.gz: f5a89f28a4da2042b4bd722a2a7b334079535d6d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5d033b6598795b685e866618581578ee0799710f8297ba43fef51540932d9a3d4e03a509b4c07effcf991a1da613164fb1e4c38a32b0dc7945c79f901909456
|
7
|
+
data.tar.gz: ab4f538ab3c09fcbfa5a9950a70c73bde93fb787f070cdcb3c059c00761a73e54eb44c1013ce17ea15af6736616997c99498c2ae5ded3c00d83265ec4584c89c
|
data/.kitchen.yml
CHANGED
@@ -1,18 +1,3 @@
|
|
1
1
|
---
|
2
2
|
#<% require 'poise_boiler' %>
|
3
|
-
<%= PoiseBoiler.kitchen %>
|
4
|
-
|
5
|
-
chef_versions:
|
6
|
-
- '12.0'
|
7
|
-
- '12.1'
|
8
|
-
- '12.2'
|
9
|
-
- '12'
|
10
|
-
|
11
|
-
platforms:
|
12
|
-
- name: ubuntu-12.04
|
13
|
-
|
14
|
-
suites:
|
15
|
-
- name: default
|
16
|
-
run_list:
|
17
|
-
- recipe[poise_test]
|
18
|
-
- recipe[poise_test::inversion]
|
3
|
+
<%= PoiseBoiler.kitchen(platforms: 'ubuntu-14.04') %>
|
data/.travis.yml
CHANGED
@@ -1,16 +1,10 @@
|
|
1
1
|
sudo: false
|
2
2
|
cache: bundler
|
3
3
|
language: ruby
|
4
|
-
addons:
|
5
|
-
apt:
|
6
|
-
packages:
|
7
|
-
- libgecode-dev
|
8
4
|
rvm:
|
9
5
|
- '2.2'
|
10
6
|
env:
|
11
7
|
global:
|
12
|
-
- USE_SYSTEM_GECODE=true
|
13
|
-
- KITCHEN_LOCAL_YAML=.kitchen.travis.yml
|
14
8
|
- secure: ax5czUwK8PVHXu/B3qbRZ8AACqXW4scIElQbn4sBuLp+VyTeutGax1uO6yTi7yv3xJUbEL3Z6gdZD/sOZpSKm8SL0YhkijoSs68HJCsau8cl7fvPJ0+JIlKqWazKEA1PaCmJHQv5J9TEyPyeSxZaIyacqOwOcUTyOkRDGyC+im8=
|
15
9
|
- secure: jEiZqcy6E5WC1nBmfJBSLPpYOUBFdpoo7DsLrvIpKVRpOw7slb+VgIru5AzbONvVD/8CYstgqiVVoGaCP/ywWWqakOQ2thp0BqWN/OVlsuPiemAdLRMMsmekkaFUdAa5l8QUUI0YiTSpSLUXQFWZrXbiARCALGAvDBbsqF1JhgA=
|
16
10
|
- secure: e3TH/N8tcx54wShV7s96OXDXuDbo9YnekLK3L3WrYrCK12gHVcW7xlMxPctGy14h6VaP1PBXJfUjd7cdzmHgudTo8HlR4Ui0kpjp85XrohPsLmVaFDxjAstLFm4VKMpsoKUZoPZY5J8bO9b606p872M5yO4rwKy3bVK/CP6mTBY=
|
@@ -25,4 +19,5 @@ gemfile:
|
|
25
19
|
- test/gemfiles/chef-12.3.gemfile
|
26
20
|
- test/gemfiles/chef-12.4.gemfile
|
27
21
|
- test/gemfiles/chef-12.5.gemfile
|
22
|
+
- test/gemfiles/chef-12.6.gemfile
|
28
23
|
- test/gemfiles/master.gemfile
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## v2.6.0
|
4
|
+
|
5
|
+
* New backwards-compatibility helper: `Poise::Backports::VERIFY_PATH`. Use it
|
6
|
+
like `verify "myapp -t #{Poise::Backports::VERIFY_PATH}" if defined?(verify)`
|
7
|
+
for backwards-compatible usage of file verifications.
|
8
|
+
* Fixed Poise's implementation of lazy defaults to more closely match Chef's
|
9
|
+
even when both are used in conjunction. Lazy defaults will no longer be
|
10
|
+
evaluated when setting a value or getting an existing non-default value.
|
11
|
+
|
3
12
|
## v2.5.0
|
4
13
|
|
5
14
|
* New property for inversion resources: `provider_no_auto`. Set one or more
|
data/Gemfile
CHANGED
data/lib/poise/backports.rb
CHANGED
@@ -0,0 +1,33 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2015, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
|
18
|
+
module Poise
|
19
|
+
module Backports
|
20
|
+
# The correct interpolation key for any version of Chef.
|
21
|
+
# @since 2.6.0
|
22
|
+
# @example
|
23
|
+
# file '/path' do
|
24
|
+
# content my_content
|
25
|
+
# verify "myapp -t #{Poise::Backports::VERIFY_PATH}"
|
26
|
+
# end
|
27
|
+
VERIFY_PATH = if Gem::Version.create(Chef::VERSION) < Gem::Version.create('12.5.0')
|
28
|
+
'%{file}'
|
29
|
+
else
|
30
|
+
'%{path}'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -47,7 +47,12 @@ module Poise
|
|
47
47
|
def set_or_return(symbol, arg, validation)
|
48
48
|
if LazyDefault.needs_polyfill? && validation && validation[:default].is_a?(Chef::DelayedEvaluator)
|
49
49
|
validation = validation.dup
|
50
|
-
|
50
|
+
if (arg.nil? || arg == Poise::NOT_PASSED) && (!instance_variable_defined?(:"@#{symbol}") || instance_variable_get(:"@#{symbol}").nil?)
|
51
|
+
validation[:default] = instance_eval(&validation[:default])
|
52
|
+
else
|
53
|
+
# Clear the default.
|
54
|
+
validation.delete(:default)
|
55
|
+
end
|
51
56
|
end
|
52
57
|
super(symbol, arg, validation)
|
53
58
|
end
|
data/lib/poise/version.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,7 +1,5 @@
|
|
1
1
|
#
|
2
|
-
#
|
3
|
-
#
|
4
|
-
# Copyright 2013, Balanced, Inc.
|
2
|
+
# Copyright 2015, Noah Kantrowitz
|
5
3
|
#
|
6
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
5
|
# you may not use this file except in compliance with the License.
|
@@ -16,11 +14,6 @@
|
|
16
14
|
# limitations under the License.
|
17
15
|
#
|
18
16
|
|
19
|
-
|
20
|
-
extension 'halite'
|
21
|
-
|
22
|
-
cookbook 'poise', gem: 'poise'
|
17
|
+
eval_gemfile File.expand_path('../../../Gemfile', __FILE__)
|
23
18
|
|
24
|
-
|
25
|
-
cookbook 'poise_test', path: 'test/cookbooks/poise_test'
|
26
|
-
end
|
19
|
+
gem 'chef', '~> 12.6.0'
|
@@ -0,0 +1,27 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2015, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
require 'spec_helper'
|
18
|
+
|
19
|
+
# Disable this test if Chef::Resource::File::Verification doesn't exist because
|
20
|
+
# it doesn't matter anyway.
|
21
|
+
describe Poise::Backports::VERIFY_PATH, if: defined?(Chef::Resource::File::Verification) do
|
22
|
+
it do
|
23
|
+
verifier = Chef::Resource::File::Verification.new(nil, "mycmd #{subject}", nil)
|
24
|
+
expect(Chef::GuardInterpreter).to receive(:for_resource).with(nil, 'mycmd /path', nil).and_return(double(evaluate: nil))
|
25
|
+
verifier.verify_command('/path', nil)
|
26
|
+
end
|
27
|
+
end
|
@@ -87,4 +87,45 @@ describe Poise::Helpers::LazyDefault do
|
|
87
87
|
|
88
88
|
it { is_expected.to run_poise_test('test').with(value: [1, 2]) }
|
89
89
|
end # /context with a mutable value
|
90
|
+
|
91
|
+
context 'with a broken default' do
|
92
|
+
resource(:poise_test) do
|
93
|
+
include Poise::Helpers::LWRPPolyfill
|
94
|
+
include described_class
|
95
|
+
attribute(:value, default: lazy { raise RuntimeError })
|
96
|
+
end
|
97
|
+
provider(:poise_test) do
|
98
|
+
def action_run
|
99
|
+
new_resource.value
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
context 'with no value' do
|
104
|
+
recipe do
|
105
|
+
poise_test 'test'
|
106
|
+
end
|
107
|
+
|
108
|
+
it { expect { subject }.to raise_error RuntimeError }
|
109
|
+
end # /context with no value
|
110
|
+
|
111
|
+
context 'with true' do
|
112
|
+
recipe do
|
113
|
+
poise_test 'test' do
|
114
|
+
value true
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
it { is_expected.to run_poise_test('test') }
|
119
|
+
end # /context with true
|
120
|
+
|
121
|
+
context 'with false' do
|
122
|
+
recipe do
|
123
|
+
poise_test 'test' do
|
124
|
+
value false
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
it { is_expected.to run_poise_test('test') }
|
129
|
+
end # /context with false
|
130
|
+
end # /context with a broken default
|
90
131
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: poise
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Noah Kantrowitz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: halite
|
@@ -46,12 +46,10 @@ extensions: []
|
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
48
|
- ".gitignore"
|
49
|
-
- ".kitchen.travis.yml"
|
50
49
|
- ".kitchen.yml"
|
51
50
|
- ".rubocop.yml"
|
52
51
|
- ".travis.yml"
|
53
52
|
- ".yardopts"
|
54
|
-
- Berksfile
|
55
53
|
- CHANGELOG.md
|
56
54
|
- Gemfile
|
57
55
|
- LICENSE
|
@@ -60,6 +58,7 @@ files:
|
|
60
58
|
- lib/poise.rb
|
61
59
|
- lib/poise/backports.rb
|
62
60
|
- lib/poise/backports/not_passed.rb
|
61
|
+
- lib/poise/backports/verify_path.rb
|
63
62
|
- lib/poise/error.rb
|
64
63
|
- lib/poise/helpers.rb
|
65
64
|
- lib/poise/helpers/chefspec_matchers.rb
|
@@ -92,13 +91,13 @@ files:
|
|
92
91
|
- lib/poise/utils/shell_out.rb
|
93
92
|
- lib/poise/version.rb
|
94
93
|
- poise.gemspec
|
95
|
-
- test/
|
96
|
-
- test/
|
97
|
-
- test/
|
98
|
-
- test/
|
99
|
-
- test/
|
100
|
-
- test/
|
101
|
-
- test/
|
94
|
+
- test/cookbook/attributes/default.rb
|
95
|
+
- test/cookbook/libraries/app.rb
|
96
|
+
- test/cookbook/libraries/app_config.rb
|
97
|
+
- test/cookbook/libraries/inversion.rb
|
98
|
+
- test/cookbook/metadata.rb
|
99
|
+
- test/cookbook/recipes/default.rb
|
100
|
+
- test/cookbook/recipes/inversion.rb
|
102
101
|
- test/docker/docker.ca
|
103
102
|
- test/docker/docker.pem
|
104
103
|
- test/gemfiles/chef-12.0.gemfile
|
@@ -107,11 +106,13 @@ files:
|
|
107
106
|
- test/gemfiles/chef-12.3.gemfile
|
108
107
|
- test/gemfiles/chef-12.4.gemfile
|
109
108
|
- test/gemfiles/chef-12.5.gemfile
|
109
|
+
- test/gemfiles/chef-12.6.gemfile
|
110
110
|
- test/gemfiles/chef-12.gemfile
|
111
111
|
- test/gemfiles/master.gemfile
|
112
112
|
- test/integration/default/serverspec/default_spec.rb
|
113
113
|
- test/integration/default/serverspec/inversion_spec.rb
|
114
114
|
- test/spec/backports/not_passed_spec.rb
|
115
|
+
- test/spec/backports/verify_path_spec.rb
|
115
116
|
- test/spec/helpers/chefspec_matchers_spec.rb
|
116
117
|
- test/spec/helpers/defined_in_spec.rb
|
117
118
|
- test/spec/helpers/fused_spec.rb
|
@@ -162,13 +163,13 @@ signing_key:
|
|
162
163
|
specification_version: 4
|
163
164
|
summary: Helpers for writing extensible Chef cookbooks.
|
164
165
|
test_files:
|
165
|
-
- test/
|
166
|
-
- test/
|
167
|
-
- test/
|
168
|
-
- test/
|
169
|
-
- test/
|
170
|
-
- test/
|
171
|
-
- test/
|
166
|
+
- test/cookbook/attributes/default.rb
|
167
|
+
- test/cookbook/libraries/app.rb
|
168
|
+
- test/cookbook/libraries/app_config.rb
|
169
|
+
- test/cookbook/libraries/inversion.rb
|
170
|
+
- test/cookbook/metadata.rb
|
171
|
+
- test/cookbook/recipes/default.rb
|
172
|
+
- test/cookbook/recipes/inversion.rb
|
172
173
|
- test/docker/docker.ca
|
173
174
|
- test/docker/docker.pem
|
174
175
|
- test/gemfiles/chef-12.0.gemfile
|
@@ -177,11 +178,13 @@ test_files:
|
|
177
178
|
- test/gemfiles/chef-12.3.gemfile
|
178
179
|
- test/gemfiles/chef-12.4.gemfile
|
179
180
|
- test/gemfiles/chef-12.5.gemfile
|
181
|
+
- test/gemfiles/chef-12.6.gemfile
|
180
182
|
- test/gemfiles/chef-12.gemfile
|
181
183
|
- test/gemfiles/master.gemfile
|
182
184
|
- test/integration/default/serverspec/default_spec.rb
|
183
185
|
- test/integration/default/serverspec/inversion_spec.rb
|
184
186
|
- test/spec/backports/not_passed_spec.rb
|
187
|
+
- test/spec/backports/verify_path_spec.rb
|
185
188
|
- test/spec/helpers/chefspec_matchers_spec.rb
|
186
189
|
- test/spec/helpers/defined_in_spec.rb
|
187
190
|
- test/spec/helpers/fused_spec.rb
|