chef-utils 15.17.4 → 16.0.257

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9c63cf36e52894706bb69cc46b832f6de68ac9e723add175c3c8e07914c7e903
4
- data.tar.gz: 8b274d868da78c3427e4786b630770fb5761199553699291120f00e315e3fc1c
3
+ metadata.gz: 2392a6ca0ae1cdc3b3d28e3d67f91ce523fbc2a646fd820bbc2a85b1ae7909a6
4
+ data.tar.gz: 17920fff50553a5b998a29ff4e266863b89536795fc0242a9d416936077d1ee6
5
5
  SHA512:
6
- metadata.gz: f9469abcdff8e386071e0384c17b3fbb9f54af6ba6c65e76b4662bc75ee752d47498ccad458da61eb357aedb8b27dba172f5c70cc7d819f001ba1566af828eea
7
- data.tar.gz: '03884e36728e3e3cbbd242e7e9fee94191c4d776b3a526a4cb3e5ebb4cab8dcf4363d04b1ebf9affb4090a7eeb755c72d504666ccc08cc62acdc221f07f5a9e8'
6
+ metadata.gz: 2a3953269db596512b08c5c64b942594c0e8cda63744c79dfc20821074dff10485a7fe82865f83770893a3f1a5522a3699bd0ddbf75500bb6e90a9682264f41c
7
+ data.tar.gz: '0888b423c1cc56416191a4999ffac0bed59d4c36db79aa8f30e664dfed3fe3e0551b6b7daa67d08496d55695bbf87bf4cdcfee7f47f793fbd0ede586ea6413b9'
data/Rakefile CHANGED
@@ -6,6 +6,7 @@ begin
6
6
  require "rspec/core/rake_task"
7
7
  desc "Run standard specs"
8
8
  RSpec::Core::RakeTask.new(:spec) do |t|
9
+ t.verbose = false
9
10
  t.pattern = FileList["spec/**/*_spec.rb"]
10
11
  end
11
12
  rescue LoadError
data/chef-utils.gemspec CHANGED
@@ -1,4 +1,5 @@
1
- lib = File.expand_path("lib", __dir__)
1
+ # coding: utf-8
2
+ lib = File.expand_path("../lib", __FILE__)
2
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
4
  require "chef-utils/version"
4
5
 
data/lib/chef-utils.rb CHANGED
@@ -36,15 +36,14 @@ module ChefUtils
36
36
  include ChefUtils::DSL::Cloud
37
37
  include ChefUtils::DSL::Introspection
38
38
  include ChefUtils::DSL::OS
39
+ include ChefUtils::DSL::PathSanity
39
40
  include ChefUtils::DSL::Platform
40
41
  include ChefUtils::DSL::PlatformFamily
41
42
  include ChefUtils::DSL::PlatformVersion
42
43
  include ChefUtils::DSL::TrainHelpers
43
44
  include ChefUtils::DSL::Virtualization
45
+ include ChefUtils::DSL::Which
44
46
  include ChefUtils::DSL::Windows
45
- # FIXME: include ChefUtils::DSL::Which in Chef 16.0
46
- # FIXME: include ChefUtils::DSL::PathSanity in Chef 16.0
47
- # FIXME: include ChefUtils::DSL::TrainHelpers in Chef 16.0
48
47
  # ChefUtils::DSL::Service is deliberately excluded
49
48
 
50
49
  CANARY = 1 # used as a guard for requires
@@ -110,17 +110,17 @@ module ChefUtils
110
110
  # @return [Boolean]
111
111
  #
112
112
  def arm?(node = __getnode)
113
- %w{armv6l armv7l armhf aarch64 arm64 arch64}.include?(node["kernel"]["machine"])
113
+ %w{armhf aarch64 arm64 arch64}.include?(node["kernel"]["machine"])
114
114
  end
115
115
 
116
- # Determine if the current architecture is 32-bit ARM hard float.
116
+ # Determine if the current architecture is 32-bit ARM.
117
117
  #
118
118
  # @since 15.5
119
119
  #
120
120
  # @return [Boolean]
121
121
  #
122
122
  def armhf?(node = __getnode)
123
- %w{armv6l armv7l armhf}.include?(node["kernel"]["machine"])
123
+ %w{armhf}.include?(node["kernel"]["machine"])
124
124
  end
125
125
 
126
126
  # Determine if the current architecture is s390x.
@@ -301,7 +301,7 @@ module ChefUtils
301
301
  end
302
302
 
303
303
  # RedHat distros -- fedora and rhel platform_families, nothing else. This is most likely not as useful as the
304
- # "fedora_derived?" helper.
304
+ # "fedora_dervied?" helper.
305
305
  #
306
306
  # @param [Chef::Node] node the node to check
307
307
  # @since 15.5
@@ -25,7 +25,7 @@ module ChefUtils
25
25
  # Lookup an executable through the systems search PATH. Allows specifying an array
26
26
  # of executables to look for. The first executable that is found, along any path entry,
27
27
  # will be the preferred one and returned first. The extra_path will override any default
28
- # extra_paths which are added (allowing the user to pass an empty array to remove them).
28
+ # extra_paths which are added (allwing the user to pass an empty array to remove them).
29
29
  #
30
30
  # When passed a block the block will be called with the full pathname of any executables
31
31
  # which are found, and the block should return truthy or falsey values to further filter
@@ -34,7 +34,7 @@ module ChefUtils
34
34
  # This is syntactic sugar for `where(...).first`
35
35
  #
36
36
  # This helper can be used in target mode in chef or with train using the appropriate
37
- # wiring externally.
37
+ # wiring extenerally.
38
38
  #
39
39
  # @example Find the most appropriate python executable, searching through the system PATH
40
40
  # plus additionally the "/usr/libexec" directory, which has the dnf libraries
@@ -55,14 +55,14 @@ module ChefUtils
55
55
  # Lookup all the instances of an an executable that can be found through the systems search PATH.
56
56
  # Allows specifying an array of executables to look for. All the instances of the first executable
57
57
  # that is found will be returned first. The extra_path will override any default extra_paths
58
- # which are added (allowing the user to pass an empty array to remove them).
58
+ # which are added (allwing the user to pass an empty array to remove them).
59
59
  #
60
60
  # When passed a block the block will be called with the full pathname of any executables
61
61
  # which are found, and the block should return truthy or falsey values to further filter
62
62
  # the executable based on arbitrary criteria.
63
63
  #
64
64
  # This helper can be used in target mode in chef or with train using the appropriate
65
- # wiring externally.
65
+ # wiring extenerally.
66
66
  #
67
67
  # @example Find all the python executables, searching through the system PATH plus additionally
68
68
  # the "/usr/libexec" directory, which have the dnf libraries installed and available.
@@ -20,7 +20,7 @@ require_relative "../internal"
20
20
  module ChefUtils
21
21
  module DSL
22
22
  module Windows
23
- require "chef-utils/version_string"
23
+ require_relative "../version_string"
24
24
 
25
25
  include Internal
26
26
 
@@ -27,7 +27,7 @@ module ChefUtils
27
27
  #
28
28
  # This gem may be used by gems like mixlib-shellout which can be consumed by external non-Chef utilities,
29
29
  # so including brittle code here which depends on the existence of the chef-client will cause broken
30
- # behavior downstream. You must practice defensive coding, and not make assumptions about running within chef-client.
30
+ # behavior downstream. You must practice defensive coding, and not make assumptions about runnign within chef-client.
31
31
  #
32
32
  # Other consumers may mix in the helper classes and then override the methods here and provide their own custom
33
33
  # wiring and override what is provided here. They are marked as private because no downstream user should ever touch
@@ -14,6 +14,6 @@
14
14
  # limitations under the License.
15
15
 
16
16
  module ChefUtils
17
- CHEFUTILS_ROOT = File.expand_path("..", __dir__)
18
- VERSION = "15.17.4".freeze
17
+ CHEFUTILS_ROOT = File.expand_path("../..", __FILE__)
18
+ VERSION = "16.0.257".freeze
19
19
  end
@@ -27,8 +27,13 @@ module ChefUtils
27
27
  #
28
28
  # @param val [String] Version string to parse.
29
29
  def initialize(val)
30
- super
31
- @parsed_version = ::Gem::Version.create(self)
30
+ val = "" unless val
31
+ super(val)
32
+ begin
33
+ @parsed_version = ::Gem::Version.create(self)
34
+ rescue ArgumentError
35
+ @parsed_version = nil
36
+ end
32
37
  end
33
38
 
34
39
  # @!group Compat wrappers for String
@@ -135,7 +140,12 @@ module ChefUtils
135
140
  when Regexp
136
141
  super
137
142
  else
138
- Gem::Requirement.create(other) =~ parsed_version
143
+ begin
144
+ Gem::Requirement.create(other) =~ parsed_version
145
+ rescue ArgumentError
146
+ # one side of the comparison wasn't parseable
147
+ super
148
+ end
139
149
  end
140
150
  end
141
151
 
@@ -131,17 +131,6 @@ RSpec.describe ChefUtils::DSL::Architecture do
131
131
 
132
132
  arch_reports_true_for(:armhf?, :_32_bit?, :arm?)
133
133
  end
134
- context "on armv6l" do
135
- let(:arch) { "armv6l" }
136
-
137
- arch_reports_true_for(:armhf?, :_32_bit?, :arm?)
138
- end
139
- context "on armv7l" do
140
- let(:arch) { "armv7l" }
141
-
142
- arch_reports_true_for(:armhf?, :_32_bit?, :arm?)
143
- end
144
-
145
134
  context "on s390" do
146
135
  let(:arch) { "s390" }
147
136
 
@@ -21,7 +21,6 @@ RSpec.describe ChefUtils::DSL::Introspection do
21
21
  class IntrospectionTestClass
22
22
  include ChefUtils::DSL::Introspection
23
23
  attr_accessor :node
24
-
25
24
  def initialize(node)
26
25
  @node = node
27
26
  end
@@ -32,7 +31,7 @@ RSpec.describe ChefUtils::DSL::Introspection do
32
31
  let(:test_instance) { IntrospectionTestClass.new(node) }
33
32
 
34
33
  context "#docker?" do
35
- # FIXME: use a real VividMash for these tests instead of stubbing
34
+ # FIXME: use a real VividMash for these tests insted of stubbing
36
35
  it "is false by default" do
37
36
  expect(node).to receive(:read).with("virtualization", "systems", "docker").and_return(nil)
38
37
  expect(ChefUtils.docker?(node)).to be false
@@ -89,7 +89,7 @@ RSpec.describe ChefUtils::DSL::PlatformFamily do
89
89
  end
90
90
 
91
91
  context "on centos6" do
92
- let(:options) { { platform: "centos", version: "6.9" } }
92
+ let(:options) { { platform: "centos", version: "6.10" } }
93
93
 
94
94
  pf_reports_true_for(:rhel?, :rpm_based?, :fedora_derived?, :redhat_based?, :el?, :rhel6?)
95
95
  end
@@ -167,7 +167,7 @@ RSpec.describe ChefUtils::DSL::PlatformFamily do
167
167
  end
168
168
 
169
169
  context "on redhat6" do
170
- let(:options) { { platform: "redhat", version: "6.9" } }
170
+ let(:options) { { platform: "redhat", version: "6.10" } }
171
171
 
172
172
  pf_reports_true_for(:rhel?, :rpm_based?, :fedora_derived?, :redhat_based?, :el?, :rhel6?)
173
173
  end
@@ -58,7 +58,6 @@ RSpec.describe ChefUtils::DSL::Platform do
58
58
  class ThingWithANode
59
59
  include ChefUtils::DSL::Platform
60
60
  attr_accessor :node
61
-
62
61
  def initialize(node)
63
62
  @node = node
64
63
  end
@@ -70,7 +69,6 @@ RSpec.describe ChefUtils::DSL::Platform do
70
69
  attr_accessor :node
71
70
  end
72
71
  attr_accessor :run_context
73
-
74
72
  def initialize(node)
75
73
  @run_context = RunContext.new
76
74
  run_context.node = node
@@ -80,7 +78,6 @@ RSpec.describe ChefUtils::DSL::Platform do
80
78
  class ThingWithTheDSL
81
79
  include ChefUtils
82
80
  attr_accessor :node
83
-
84
81
  def initialize(node)
85
82
  @node = node
86
83
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 15.17.4
4
+ version: 16.0.257
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chef Software, Inc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-16 00:00:00.000000000 Z
11
+ date: 2020-04-27 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email:
@@ -76,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
76
  - !ruby/object:Gem::Version
77
77
  version: '0'
78
78
  requirements: []
79
- rubygems_version: 3.0.3.1
79
+ rubygems_version: 3.1.2
80
80
  signing_key:
81
81
  specification_version: 4
82
82
  summary: Basic utility functions for Core Chef development