chef-utils 17.0.242 → 17.4.25

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8b28b0dd9a34f1242fdeca73f39924515befdec0a2990e4bd56d4d94f071c2aa
4
- data.tar.gz: 49cb4691092f6b0db0567a8975e72c3905682208ff0c089fe3149ef8ee8da4d0
3
+ metadata.gz: b255035b3817144f6c775e50ca8a3b13804c7b72a34d72ff7a305e3f64bba4ac
4
+ data.tar.gz: 1234d2266cbf5852177c8d7cd9aeb85d47de8329fed42990a32be24ef8a602fb
5
5
  SHA512:
6
- metadata.gz: 16f7f528de5d5fb631552951cef5f0e763bffce0c52bb2fb563f8d1cebd16269027dc3a2daf1f151bc58d5901adfb2309d93ecc3b6868e29f75be14b5538511b
7
- data.tar.gz: 705ddfa785ecb1a7448a95f342a3718e5f90996131fe2678c6cd15875f3eee5d5cc7d5b7d38fabfa1500c07df26eac804261360cd13b205a7a24435a8a4ee922
6
+ metadata.gz: 7b92929d90e896090ec0910fb191bfb1705f65df2264170dae8f086d69e9136d173c6a047f1739c70870d1ae811868155e83bfbb64ee5d003f512f20145e77a5
7
+ data.tar.gz: 36a66c072c2bae578b5d618d5e3c355c29caeebca6eaba6887042b07926b7b15c4692ec2fd1b2a499a773d509a0f3897e0d4db5b5d36f270dd4b4af1c9a6ff12
@@ -15,6 +15,25 @@ module ChefUtils
15
15
  PRODUCT = "Chef Automate"
16
16
  end
17
17
 
18
+ class Cli
19
+ # the chef-cli product name
20
+ PRODUCT = "Chef CLI"
21
+
22
+ # the chef-cli gem
23
+ GEM = "chef-cli"
24
+ end
25
+
26
+ class Habitat
27
+ # name of the Habitat product
28
+ PRODUCT = "Chef Habitat"
29
+
30
+ # A short designation for the product
31
+ SHORT = "habitat"
32
+
33
+ # The hab cli binary
34
+ EXEC = "hab"
35
+ end
36
+
18
37
  class Infra
19
38
  # When referencing a product directly, like Chef (Now Chef Infra)
20
39
  PRODUCT = "Chef Infra Client"
@@ -42,6 +61,17 @@ module ChefUtils
42
61
  # The suffix for Chef's /etc/chef, /var/chef and C:\\Chef directories
43
62
  # "chef" => /etc/cinc, /var/cinc, C:\\cinc
44
63
  DIR_SUFFIX = "chef"
64
+
65
+ # The client's gem
66
+ GEM = "chef"
67
+ end
68
+
69
+ class Inspec
70
+ # The InSpec product name
71
+ PRODUCT = "Chef InSpec"
72
+
73
+ # The inspec binary
74
+ EXEC = "inspec"
45
75
  end
46
76
 
47
77
  class Org
@@ -63,6 +93,9 @@ module ChefUtils
63
93
 
64
94
  # knife documentation page
65
95
  KNIFE_DOCS = "https://docs.chef.io/workstation/knife/"
96
+
97
+ # the name of the overall infra product
98
+ PRODUCT = "Chef Infra"
66
99
  end
67
100
 
68
101
  class Server
@@ -88,8 +121,14 @@ module ChefUtils
88
121
  end
89
122
 
90
123
  class Workstation
124
+ # The full marketing name of the product
125
+ PRODUCT = "Chef Workstation"
126
+
91
127
  # The suffix for Chef Workstation's /opt/chef-workstation or C:\\opscode\chef-workstation
92
128
  DIR_SUFFIX = "chef-workstation"
129
+
130
+ # Workstation banner/help text
131
+ DOCS = "https://docs.chef.io/workstation/"
93
132
  end
94
133
 
95
134
  class Zero
@@ -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
@@ -70,7 +70,7 @@ module ChefUtils
70
70
  #
71
71
  def __env_path
72
72
  if __transport_connection
73
- __transport_connection.run_command("echo $PATH").stdout || ""
73
+ __transport_connection.run_command("echo $PATH").stdout.chomp || ""
74
74
  else
75
75
  ENV["PATH"] || ""
76
76
  end
@@ -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.0.242"
19
+ VERSION = "17.4.25"
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.0.242
4
+ version: 17.4.25
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-27 00:00:00.000000000 Z
11
+ date: 2021-08-23 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