chef-utils 17.2.29 → 17.3.48

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: 860b9ebe97ac8f22fcdeebb27bf112b4535edcffbb189dc7543ab4c30a1542cb
4
- data.tar.gz: 7a3e2aab7feb50f45f4a57679d5644a8a4beab2b96eeaaf86032c2bdf6392aca
3
+ metadata.gz: 366412a4aa6db05ee93b4355836e6788bfd92994f4d441188c6e537c727eabd5
4
+ data.tar.gz: 12cdaa1dd130b9069a7d8118b86b9fb9adb4e72b342d30a13fdc45982e7dfe10
5
5
  SHA512:
6
- metadata.gz: 5c749b979ec103b8f2b052cf2054747adc4e837f69251269412e37f2af6b90c3007dd41c94622de06d40d76964eb0f56d975d02d9965b22117a66e629ba8075d
7
- data.tar.gz: be28ce9afeead797ba7783a8e60635061589c1e5b4343b76f8e927d1d82e25d04da7bd0910728270839259c45e7a0292b0a6e0cc481093aa4d7d14528f7f6465
6
+ metadata.gz: bbe832bb7d939eaa7e98bc8654c4d4604e2642b4fbd20b8daa6658a06e73e8f9333ab8c9e5bd2c5ea9df51460d03bcd437272dbeafddbcccafd8bfd9b9d7d04c
7
+ data.tar.gz: a0e3c8a65b9abb138409e857f599dfd5de27045430539d8772406666e3c00d7aaaa12a45f002dfd614a53d40db7f21e7d8b016745adb67998bd25840ef85e01a
@@ -77,7 +77,7 @@ module ChefUtils
77
77
  # @return [Boolean]
78
78
  #
79
79
  def macos?(node = __getnode)
80
- node["platform_family"] == "mac_os_x"
80
+ node ? node["platform_family"] == "mac_os_x" : macos_ruby?
81
81
  end
82
82
  # chef-sugar backcompat method
83
83
  alias_method :osx?, :macos?
@@ -86,6 +86,17 @@ module ChefUtils
86
86
  # chef-sugar backcompat method
87
87
  alias_method :mac_os_x?, :macos?
88
88
 
89
+ # Determine if the Ruby VM is currently running on a Mac node (This is useful primarily for internal use
90
+ # by Chef Infra Client before the node object exists).
91
+ #
92
+ # @since 17.3
93
+ #
94
+ # @return [Boolean]
95
+ #
96
+ def macos_ruby?
97
+ !!(RUBY_PLATFORM =~ /darwin/)
98
+ end
99
+
89
100
  # Determine if the current node is a member of the 'rhel' platform family (Red Hat, CentOS, Oracle or Scientific Linux, but NOT Amazon Linux or Fedora).
90
101
  #
91
102
  # @param [Chef::Node] node the node to check
@@ -45,7 +45,7 @@ module ChefUtils
45
45
  pool ||= ChefUtils::DefaultThreadPool.instance.pool
46
46
 
47
47
  futures = map do |item|
48
- future = Concurrent::Future.execute(executor: pool) do
48
+ Concurrent::Future.execute(executor: pool) do
49
49
  yield item
50
50
  end
51
51
  end
@@ -16,5 +16,5 @@
16
16
 
17
17
  module ChefUtils
18
18
  CHEFUTILS_ROOT = File.expand_path("..", __dir__)
19
- VERSION = "17.2.29"
19
+ VERSION = "17.3.48"
20
20
  end
@@ -25,7 +25,7 @@ def pf_reports_true_for(*args)
25
25
  expect(described_class.send(method, node)).to be true
26
26
  end
27
27
  end
28
- (PLATFORM_FAMILY_HELPERS - [ :windows_ruby? ] - args).each do |method|
28
+ (PLATFORM_FAMILY_HELPERS - %i{windows_ruby? macos_ruby?} - args).each do |method|
29
29
  it "reports false for #{method}" do
30
30
  expect(described_class.send(method, node)).to be false
31
31
  end
@@ -41,7 +41,7 @@ RSpec.describe ChefUtils::DSL::PlatformFamily do
41
41
  end
42
42
  end
43
43
 
44
- ( PLATFORM_FAMILY_HELPERS - [ :windows_ruby? ]).each do |helper|
44
+ ( PLATFORM_FAMILY_HELPERS - %i{windows_ruby? macos_ruby?}).each do |helper|
45
45
  it "has the #{helper} in the ChefUtils module" do
46
46
  expect(ChefUtils).to respond_to(helper)
47
47
  end
@@ -220,4 +220,16 @@ RSpec.describe ChefUtils::DSL::PlatformFamily do
220
220
  end
221
221
  end
222
222
  end
223
+
224
+ context "node-independent mac APIs" do
225
+ if RUBY_PLATFORM.match?(/darwin/)
226
+ it "reports true for :macos_ruby?" do
227
+ expect(described_class.macos_ruby?).to be true
228
+ end
229
+ else
230
+ it "reports false for :macos_ruby?" do
231
+ expect(described_class.macos_ruby?).to be false
232
+ end
233
+ end
234
+ end
223
235
  end
@@ -112,7 +112,7 @@ RSpec.describe ChefUtils::ParallelMap do
112
112
  end
113
113
 
114
114
  it "recursive parallel_each will not deadlock" do
115
- ans = Timeout.timeout(30) do
115
+ Timeout.timeout(30) do
116
116
  (1..2).parallel_each { |i| (1..2).parallel_each { |i| i } }
117
117
  end
118
118
  end
@@ -125,7 +125,7 @@ RSpec.describe ChefUtils::ParallelMap do
125
125
  end
126
126
 
127
127
  it "parallel_each is lazy" do
128
- ans = Timeout.timeout(30) do
128
+ Timeout.timeout(30) do
129
129
  (1..).lazy.parallel_each { |i| i }.first(5)
130
130
  end
131
131
  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: 17.2.29
4
+ version: 17.3.48
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-06-09 00:00:00.000000000 Z
11
+ date: 2021-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -94,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
94
  - !ruby/object:Gem::Version
95
95
  version: '0'
96
96
  requirements: []
97
- rubygems_version: 3.2.15
97
+ rubygems_version: 3.2.22
98
98
  signing_key:
99
99
  specification_version: 4
100
100
  summary: Basic utility functions for Core Chef Infra development