chef-utils 17.1.35 → 17.4.38
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/chef-utils.gemspec +5 -5
- data/lib/chef-utils/dist.rb +39 -0
- data/lib/chef-utils/dsl/platform_family.rb +12 -1
- data/lib/chef-utils/parallel_map.rb +1 -1
- data/lib/chef-utils/version.rb +1 -1
- data/spec/unit/dsl/platform_family_spec.rb +14 -2
- data/spec/unit/parallel_map_spec.rb +2 -2
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e107bc0419240dee131ff15cc131f651fa741c7f18902db4971f518efdded3f
|
4
|
+
data.tar.gz: 38ef265b995ea11a3f7ea5ae7a2eaaf747af79dc9f603cbf4468f9e16355a797
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb9f1a9f2b49a9594ed325772971cd248e1b20932a20dc6f6cf31ad8f7e264481c26eaa836dd23dc25b4457dad7fb426b3d45ee2cccbedb276cddd91c38ed22f
|
7
|
+
data.tar.gz: 9249a41d1de2288654c8fce4e8973287023f221c218825015551b07d2dced778845e39a2827d7416d6a0d6a92a84f5d69e85e636e2cba508024668f011970924
|
data/chef-utils.gemspec
CHANGED
@@ -10,17 +10,17 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["oss@chef.io"]
|
11
11
|
|
12
12
|
spec.summary = %q{Basic utility functions for Core Chef Infra development}
|
13
|
-
spec.homepage = "https://github.com/chef/chef/tree/
|
13
|
+
spec.homepage = "https://github.com/chef/chef/tree/main/chef-utils"
|
14
14
|
spec.license = "Apache-2.0"
|
15
15
|
|
16
16
|
spec.required_ruby_version = ">= 2.6"
|
17
17
|
|
18
18
|
spec.metadata = {
|
19
19
|
"bug_tracker_uri" => "https://github.com/chef/chef/issues",
|
20
|
-
"changelog_uri" => "https://github.com/chef/chef/blob/
|
21
|
-
"documentation_uri" => "https://github.com/chef/chef/tree/
|
22
|
-
"homepage_uri" => "https://github.com/chef/chef/tree/
|
23
|
-
"source_code_uri" => "https://github.com/chef/chef/tree/
|
20
|
+
"changelog_uri" => "https://github.com/chef/chef/blob/main/CHANGELOG.md",
|
21
|
+
"documentation_uri" => "https://github.com/chef/chef/tree/main/chef-utils/README.md",
|
22
|
+
"homepage_uri" => "https://github.com/chef/chef/tree/main/chef-utils",
|
23
|
+
"source_code_uri" => "https://github.com/chef/chef/tree/main/chef-utils",
|
24
24
|
}
|
25
25
|
|
26
26
|
spec.require_paths = ["lib"]
|
data/lib/chef-utils/dist.rb
CHANGED
@@ -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
|
data/lib/chef-utils/version.rb
CHANGED
@@ -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 -
|
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 -
|
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
|
-
|
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
|
-
|
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.
|
4
|
+
version: 17.4.38
|
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-
|
11
|
+
date: 2021-08-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -70,15 +70,15 @@ files:
|
|
70
70
|
- spec/unit/dsl/windows_spec.rb
|
71
71
|
- spec/unit/mash_spec.rb
|
72
72
|
- spec/unit/parallel_map_spec.rb
|
73
|
-
homepage: https://github.com/chef/chef/tree/
|
73
|
+
homepage: https://github.com/chef/chef/tree/main/chef-utils
|
74
74
|
licenses:
|
75
75
|
- Apache-2.0
|
76
76
|
metadata:
|
77
77
|
bug_tracker_uri: https://github.com/chef/chef/issues
|
78
|
-
changelog_uri: https://github.com/chef/chef/blob/
|
79
|
-
documentation_uri: https://github.com/chef/chef/tree/
|
80
|
-
homepage_uri: https://github.com/chef/chef/tree/
|
81
|
-
source_code_uri: https://github.com/chef/chef/tree/
|
78
|
+
changelog_uri: https://github.com/chef/chef/blob/main/CHANGELOG.md
|
79
|
+
documentation_uri: https://github.com/chef/chef/tree/main/chef-utils/README.md
|
80
|
+
homepage_uri: https://github.com/chef/chef/tree/main/chef-utils
|
81
|
+
source_code_uri: https://github.com/chef/chef/tree/main/chef-utils
|
82
82
|
post_install_message:
|
83
83
|
rdoc_options: []
|
84
84
|
require_paths:
|
@@ -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.
|
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
|