rspec-puppet 2.7.9 → 2.7.10
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 +6 -1
- data/lib/rspec-puppet/cache.rb +6 -11
- data/lib/rspec-puppet/matchers/create_generic.rb +0 -5
- data/lib/rspec-puppet/matchers/parameter_matcher.rb +4 -3
- data/lib/rspec-puppet/monkey_patches.rb +0 -18
- data/lib/rspec-puppet/support.rb +2 -10
- metadata +2 -3
- data/lib/rspec-puppet/sensitive.rb +0 -47
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38af21b6f0c4e9fcfeb90c063d299c725fd80d63e6d74b44d0a6e6f937f6d955
|
4
|
+
data.tar.gz: 977523988ad9525e31c461040c33894e1cbd79c9180252f9521f8b8172ac111b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8145ad0c55a4c52f7032f67ea2f73dc7fb72f162c32214e8b3e5aa5bd69efe1bd0ded6c2e36cff165e2e8f51734e0f94017c74f07ad0ce3b1bbeca90463ad34
|
7
|
+
data.tar.gz: 149c839eb092309b0e3bb1be2c0887aed4dc0ebe8fb9ea2b4b5b562a797df8b39800486e24e181dc7d44abdddbe94bc9938978e0d5862e35fa73581203475545
|
data/CHANGELOG.md
CHANGED
@@ -2,10 +2,15 @@
|
|
2
2
|
All notable changes to this project will be documented in this file. This
|
3
3
|
project adheres to [Semantic Versioning](http://semver.org/).
|
4
4
|
|
5
|
-
## [2.7.
|
5
|
+
## [2.7.10]
|
6
|
+
|
6
7
|
### Fixed
|
7
8
|
* Fix issues with removal of `default_env` method in Puppet 6.17.0.
|
8
9
|
|
10
|
+
## [2.7.9]
|
11
|
+
|
12
|
+
This release had unintended breaking changes and was withdrawn.
|
13
|
+
|
9
14
|
## [2.7.8]
|
10
15
|
|
11
16
|
### Fixed
|
data/lib/rspec-puppet/cache.rb
CHANGED
@@ -11,17 +11,12 @@ module RSpec::Puppet
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def get(*args, &blk)
|
14
|
+
# decouple the hash key from whatever the blk might do to it
|
14
15
|
key = Marshal.load(Marshal.dump(args))
|
15
|
-
if
|
16
|
-
|
17
|
-
|
18
|
-
@lra.insert(-1, @lra.delete_at(@lra.index(args)))
|
19
|
-
else
|
20
|
-
# Cache miss
|
21
|
-
# Ensure room by evicting least recently used if no space left
|
16
|
+
if !@cache.has_key? key
|
17
|
+
@cache[key] = (blk || @default_proc).call(*args)
|
18
|
+
@lra << key
|
22
19
|
expire!
|
23
|
-
@cache[args] = (blk || @default_proc).call(*args)
|
24
|
-
@lra << args
|
25
20
|
end
|
26
21
|
|
27
22
|
@cache[key]
|
@@ -30,8 +25,8 @@ module RSpec::Puppet
|
|
30
25
|
private
|
31
26
|
|
32
27
|
def expire!
|
33
|
-
|
34
|
-
@cache.delete(
|
28
|
+
expired = @lra.slice!(0, @lra.size - MAX_ENTRIES)
|
29
|
+
expired.each { |key| @cache.delete(key) } if expired
|
35
30
|
end
|
36
31
|
end
|
37
32
|
end
|
@@ -89,11 +89,6 @@ module RSpec::Puppet
|
|
89
89
|
else
|
90
90
|
RSpec::Puppet::Coverage.cover!(resource)
|
91
91
|
rsrc_hsh = resource.to_hash
|
92
|
-
if resource.respond_to?(:sensitive_parameters)
|
93
|
-
resource.sensitive_parameters.each do |s_param|
|
94
|
-
rsrc_hsh[s_param] = ::Puppet::Pops::Types::PSensitiveType::Sensitive.new(rsrc_hsh[s_param])
|
95
|
-
end
|
96
|
-
end
|
97
92
|
|
98
93
|
if resource.builtin_type?
|
99
94
|
namevar = resource.resource_type.key_attributes.first.to_s
|
@@ -21,7 +21,10 @@ module RSpec::Puppet
|
|
21
21
|
#
|
22
22
|
# @return [true, false]
|
23
23
|
def matches?(resource)
|
24
|
-
|
24
|
+
|
25
|
+
@resource = resource
|
26
|
+
|
27
|
+
actual = @resource[@parameter]
|
25
28
|
expected = @value
|
26
29
|
|
27
30
|
# Puppet flattens an array with a single value into just the value and
|
@@ -62,8 +65,6 @@ module RSpec::Puppet
|
|
62
65
|
check_hash(expected, actual)
|
63
66
|
when Array
|
64
67
|
check_array(expected, actual)
|
65
|
-
when RSpec::Puppet::Sensitive
|
66
|
-
expected == actual
|
67
68
|
else
|
68
69
|
check_string(expected, actual)
|
69
70
|
end
|
@@ -302,24 +302,6 @@ class Pathname
|
|
302
302
|
end
|
303
303
|
end
|
304
304
|
|
305
|
-
# Puppet loads init.pp, then foo.pp, to find class "mod::foo". If
|
306
|
-
# class "mod" has been mocked using pre_condition when testing
|
307
|
-
# "mod::foo", this causes duplicate declaration for "mod".
|
308
|
-
# This monkey patch only loads "init.pp" if "foo.pp" does not exist.
|
309
|
-
class Puppet::Module
|
310
|
-
if [:match_manifests, 'match_manifests'].any? { |r| instance_methods.include?(r) }
|
311
|
-
old_match_manifests = instance_method(:match_manifests)
|
312
|
-
|
313
|
-
define_method(:match_manifests) do |rest|
|
314
|
-
result = old_match_manifests.bind(self).call(rest)
|
315
|
-
if result.length > 1 && File.basename(result[0]) == 'init.pp'
|
316
|
-
result.shift
|
317
|
-
end
|
318
|
-
result
|
319
|
-
end
|
320
|
-
end
|
321
|
-
end
|
322
|
-
|
323
305
|
# Prevent the File type from munging paths (which uses File.expand_path to
|
324
306
|
# normalise paths, which does very bad things to *nix paths on Windows.
|
325
307
|
file_path_munge = Puppet::Type.type(:file).paramclass(:path).instance_method(:unsafe_munge)
|
data/lib/rspec-puppet/support.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'rspec-puppet/cache'
|
2
2
|
require 'rspec-puppet/adapters'
|
3
3
|
require 'rspec-puppet/raw_string'
|
4
|
-
require 'rspec-puppet/sensitive'
|
5
4
|
|
6
5
|
module RSpec::Puppet
|
7
6
|
module Support
|
@@ -441,7 +440,8 @@ module RSpec::Puppet
|
|
441
440
|
end
|
442
441
|
|
443
442
|
def escape_special_chars(string)
|
444
|
-
string.gsub(/\$/, "\\$")
|
443
|
+
string.gsub!(/\$/, "\\$")
|
444
|
+
string
|
445
445
|
end
|
446
446
|
|
447
447
|
def rspec_compatibility
|
@@ -462,14 +462,6 @@ module RSpec::Puppet
|
|
462
462
|
return RSpec::Puppet::RawString.new("#{type}['#{title}']")
|
463
463
|
end
|
464
464
|
|
465
|
-
# Helper to return value wrapped in Sensitive type.
|
466
|
-
#
|
467
|
-
# @param [Object] value to wrap
|
468
|
-
# @return [RSpec::Puppet::Sensitive] a new Sensitive wrapper with the new value
|
469
|
-
def sensitive(value)
|
470
|
-
return RSpec::Puppet::Sensitive.new(value)
|
471
|
-
end
|
472
|
-
|
473
465
|
# @!attribute [r] adapter
|
474
466
|
# @api private
|
475
467
|
# @return [Class < RSpec::Puppet::Adapters::Base]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-puppet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.7.
|
4
|
+
version: 2.7.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Sharpe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-07-
|
11
|
+
date: 2020-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -66,7 +66,6 @@ files:
|
|
66
66
|
- lib/rspec-puppet/monkey_patches/windows/taskschedulerconstants.rb
|
67
67
|
- lib/rspec-puppet/rake_task.rb
|
68
68
|
- lib/rspec-puppet/raw_string.rb
|
69
|
-
- lib/rspec-puppet/sensitive.rb
|
70
69
|
- lib/rspec-puppet/setup.rb
|
71
70
|
- lib/rspec-puppet/spec_helper.rb
|
72
71
|
- lib/rspec-puppet/support.rb
|
@@ -1,47 +0,0 @@
|
|
1
|
-
module RSpec::Puppet
|
2
|
-
if defined?(::Puppet::Pops::Types::PSensitiveType::Sensitive)
|
3
|
-
# A wrapper representing Sensitive data type, eg. in class params.
|
4
|
-
class Sensitive < ::Puppet::Pops::Types::PSensitiveType::Sensitive
|
5
|
-
# Create a new Sensitive object
|
6
|
-
# @param [Object] value to wrap
|
7
|
-
def initialize(value)
|
8
|
-
@value = value
|
9
|
-
end
|
10
|
-
|
11
|
-
# @return the wrapped value
|
12
|
-
def unwrap
|
13
|
-
@value
|
14
|
-
end
|
15
|
-
|
16
|
-
# @return true
|
17
|
-
def sensitive?
|
18
|
-
true
|
19
|
-
end
|
20
|
-
|
21
|
-
# @return inspect of the wrapped value, inside Sensitive()
|
22
|
-
def inspect
|
23
|
-
"Sensitive(#{@value.inspect})"
|
24
|
-
end
|
25
|
-
|
26
|
-
# Check for equality with another value.
|
27
|
-
# If compared to Puppet Sensitive type, it compares the wrapped values.
|
28
|
-
|
29
|
-
# @param other [#unwrap, Object] value to compare to
|
30
|
-
def == other
|
31
|
-
if other.respond_to? :unwrap
|
32
|
-
return unwrap == other.unwrap
|
33
|
-
else
|
34
|
-
super
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
else
|
39
|
-
#:nocov:
|
40
|
-
class Sensitive
|
41
|
-
def initialize(value)
|
42
|
-
raise 'The use of the Sensitive data type is not supported by this Puppet version'
|
43
|
-
end
|
44
|
-
end
|
45
|
-
#:nocov:
|
46
|
-
end
|
47
|
-
end
|