chef-utils 16.4.41 → 16.8.9
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/Rakefile +1 -0
- data/chef-utils.gemspec +5 -5
- data/lib/chef-utils.rb +1 -0
- data/lib/chef-utils/dist.rb +98 -0
- data/lib/chef-utils/dsl/architecture.rb +1 -0
- data/lib/chef-utils/dsl/cloud.rb +1 -0
- data/lib/chef-utils/dsl/default_paths.rb +1 -0
- data/lib/chef-utils/dsl/introspection.rb +1 -0
- data/lib/chef-utils/dsl/os.rb +1 -0
- data/lib/chef-utils/dsl/path_sanity.rb +1 -0
- data/lib/chef-utils/dsl/platform.rb +1 -13
- data/lib/chef-utils/dsl/platform_family.rb +2 -1
- data/lib/chef-utils/dsl/platform_version.rb +1 -0
- data/lib/chef-utils/dsl/service.rb +1 -0
- data/lib/chef-utils/dsl/train_helpers.rb +26 -2
- data/lib/chef-utils/dsl/virtualization.rb +1 -0
- data/lib/chef-utils/dsl/which.rb +8 -3
- data/lib/chef-utils/dsl/windows.rb +1 -0
- data/lib/chef-utils/internal.rb +1 -0
- data/lib/chef-utils/mash.rb +1 -0
- data/lib/chef-utils/version.rb +2 -1
- data/lib/chef-utils/version_string.rb +2 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/unit/dsl/architecture_spec.rb +1 -0
- data/spec/unit/dsl/cloud_spec.rb +1 -0
- data/spec/unit/dsl/dsl_spec.rb +1 -0
- data/spec/unit/dsl/introspection_spec.rb +1 -0
- data/spec/unit/dsl/os_spec.rb +1 -0
- data/spec/unit/dsl/path_sanity_spec.rb +1 -0
- data/spec/unit/dsl/platform_family_spec.rb +1 -0
- data/spec/unit/dsl/platform_spec.rb +1 -0
- data/spec/unit/dsl/service_spec.rb +1 -0
- data/spec/unit/dsl/virtualization_spec.rb +1 -0
- data/spec/unit/dsl/which_spec.rb +4 -1
- data/spec/unit/dsl/windows_spec.rb +1 -0
- data/spec/unit/mash_spec.rb +1 -0
- metadata +7 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 03f8f0fc1ebf2fc1eff0929b7c2661b9317d86ac2c9ea040cda4529324975020
|
|
4
|
+
data.tar.gz: 00a2c20fbaee0e10c1b39d7de50ac172034453a6b08894c8e8049a75f05e68df
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5aac3637b017c7238a8b1ba1441ee689c8eda83a645334cd044413fc6706d0a1b6ba301f6aa4239e456b820a9d9ac02a1dccde1479f8fa7607cb337ea3988d84
|
|
7
|
+
data.tar.gz: 8ce954861b4e9fa28f5882900ce665344730ffc398a8abe3a332fe7ef3c63af012fd00802049159fca09e1371729ea4ed1a720a70a5bb0f2ce84db342b5e8e3a
|
data/Rakefile
CHANGED
data/chef-utils.gemspec
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
lib = File.expand_path("lib", __dir__)
|
|
2
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
4
|
require "chef-utils/version"
|
|
@@ -8,13 +9,15 @@ Gem::Specification.new do |spec|
|
|
|
8
9
|
spec.authors = ["Chef Software, Inc"]
|
|
9
10
|
spec.email = ["oss@chef.io"]
|
|
10
11
|
|
|
11
|
-
spec.summary = %q{Basic utility functions for Core Chef development}
|
|
12
|
+
spec.summary = %q{Basic utility functions for Core Chef Infra development}
|
|
12
13
|
spec.homepage = "https://github.com/chef/chef/tree/master/chef-utils"
|
|
13
14
|
spec.license = "Apache-2.0"
|
|
14
15
|
|
|
16
|
+
spec.required_ruby_version = ">= 2.6.0"
|
|
17
|
+
|
|
15
18
|
spec.metadata = {
|
|
16
19
|
"bug_tracker_uri" => "https://github.com/chef/chef/issues",
|
|
17
|
-
"changelog_uri" => "https://github.com/chef/chef/CHANGELOG.md",
|
|
20
|
+
"changelog_uri" => "https://github.com/chef/chef/blob/master/CHANGELOG.md",
|
|
18
21
|
"documentation_uri" => "https://github.com/chef/chef/tree/master/chef-utils/README.md",
|
|
19
22
|
"homepage_uri" => "https://github.com/chef/chef/tree/master/chef-utils",
|
|
20
23
|
"source_code_uri" => "https://github.com/chef/chef/tree/master/chef-utils",
|
|
@@ -40,7 +43,4 @@ Gem::Specification.new do |spec|
|
|
|
40
43
|
|
|
41
44
|
spec.files = %w{Rakefile LICENSE} + Dir.glob("*.gemspec") +
|
|
42
45
|
Dir.glob("{lib,spec}/**/*", File::FNM_DOTMATCH).reject { |f| File.directory?(f) }
|
|
43
|
-
|
|
44
|
-
spec.bindir = "bin"
|
|
45
|
-
spec.executables = []
|
|
46
46
|
end
|
data/lib/chef-utils.rb
CHANGED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
module ChefUtils
|
|
3
|
+
# This class is not fully implemented, depending on it is not recommended!
|
|
4
|
+
module Dist
|
|
5
|
+
class Apply
|
|
6
|
+
# The chef-apply product name
|
|
7
|
+
PRODUCT = "Chef Infra Apply"
|
|
8
|
+
|
|
9
|
+
# The chef-apply binary
|
|
10
|
+
EXEC = "chef-apply"
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
class Automate
|
|
14
|
+
# name of the automate product
|
|
15
|
+
PRODUCT = "Chef Automate"
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
class Infra
|
|
19
|
+
# When referencing a product directly, like Chef (Now Chef Infra)
|
|
20
|
+
PRODUCT = "Chef Infra Client"
|
|
21
|
+
|
|
22
|
+
# A short designation for the product, used in Windows event logs
|
|
23
|
+
# and some nomenclature.
|
|
24
|
+
SHORT = "chef"
|
|
25
|
+
|
|
26
|
+
# The client's alias (chef-client)
|
|
27
|
+
CLIENT = "chef-client"
|
|
28
|
+
|
|
29
|
+
# The chef executable, as in `chef gem install` or `chef generate cookbook`
|
|
30
|
+
EXEC = "chef"
|
|
31
|
+
|
|
32
|
+
# The chef-shell executable
|
|
33
|
+
SHELL = "chef-shell"
|
|
34
|
+
|
|
35
|
+
# Configuration related constants
|
|
36
|
+
# The chef-shell configuration file
|
|
37
|
+
SHELL_CONF = "chef_shell.rb"
|
|
38
|
+
|
|
39
|
+
# The user's configuration directory
|
|
40
|
+
USER_CONF_DIR = ".chef"
|
|
41
|
+
|
|
42
|
+
# The suffix for Chef's /etc/chef, /var/chef and C:\\Chef directories
|
|
43
|
+
# "chef" => /etc/cinc, /var/cinc, C:\\cinc
|
|
44
|
+
DIR_SUFFIX = "chef"
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
class Org
|
|
48
|
+
# product Website address
|
|
49
|
+
WEBSITE = "https://chef.io"
|
|
50
|
+
|
|
51
|
+
# The downloads site
|
|
52
|
+
DOWNLOADS_URL = "downloads.chef.io"
|
|
53
|
+
|
|
54
|
+
# The legacy conf folder: C:/opscode/chef. Specifically the "opscode" part
|
|
55
|
+
# DIR_SUFFIX is appended to it in code where relevant
|
|
56
|
+
LEGACY_CONF_DIR = "opscode"
|
|
57
|
+
|
|
58
|
+
# Enable forcing Chef EULA
|
|
59
|
+
ENFORCE_LICENSE = true
|
|
60
|
+
|
|
61
|
+
# product patents page
|
|
62
|
+
PATENTS = "https://www.chef.io/patents"
|
|
63
|
+
|
|
64
|
+
# knife documentation page
|
|
65
|
+
KNIFE_DOCS = "https://docs.chef.io/workstation/knife/"
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
class Server
|
|
69
|
+
# The name of the server product
|
|
70
|
+
PRODUCT = "Chef Infra Server"
|
|
71
|
+
|
|
72
|
+
# The server's configuration directory
|
|
73
|
+
CONF_DIR = "/etc/chef-server"
|
|
74
|
+
|
|
75
|
+
# The servers's alias (chef-server)
|
|
76
|
+
SERVER = "chef-server"
|
|
77
|
+
|
|
78
|
+
# The server's configuration utility
|
|
79
|
+
SERVER_CTL = "chef-server-ctl"
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
class Solo
|
|
83
|
+
# Chef-Solo's product name
|
|
84
|
+
PRODUCT = "Chef Infra Solo"
|
|
85
|
+
|
|
86
|
+
# The chef-solo executable (legacy local mode)
|
|
87
|
+
EXEC = "chef-solo"
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
class Zero
|
|
91
|
+
# chef-zero executable
|
|
92
|
+
PRODUCT = "Chef Infra Zero"
|
|
93
|
+
|
|
94
|
+
# The chef-zero executable (local mode)
|
|
95
|
+
EXEC = "chef-zero"
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
end
|
data/lib/chef-utils/dsl/cloud.rb
CHANGED
data/lib/chef-utils/dsl/os.rb
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
#
|
|
2
3
|
# Copyright:: Copyright (c) Chef Software Inc.
|
|
3
4
|
# License:: Apache License, Version 2.0
|
|
@@ -235,19 +236,6 @@ module ChefUtils
|
|
|
235
236
|
# chef-sugar backcompat method
|
|
236
237
|
alias_method :openindiana?, :openindiana_platform?
|
|
237
238
|
|
|
238
|
-
# Determine if the current node is Nexenta Core Platform aka Nexenta OS.
|
|
239
|
-
#
|
|
240
|
-
# @param [Chef::Node] node the node to check
|
|
241
|
-
# @since 15.5
|
|
242
|
-
#
|
|
243
|
-
# @return [Boolean]
|
|
244
|
-
#
|
|
245
|
-
def nexentacore_platform?(node = __getnode)
|
|
246
|
-
node["platform"] == "nexentacore"
|
|
247
|
-
end
|
|
248
|
-
# chef-sugar backcompat method
|
|
249
|
-
alias_method :nexentacore?, :nexentacore_platform?
|
|
250
|
-
|
|
251
239
|
# Determine if the current node is AIX.
|
|
252
240
|
#
|
|
253
241
|
# @param [Chef::Node] node the node to check
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
#
|
|
2
3
|
# Copyright:: Copyright (c) Chef Software Inc.
|
|
3
4
|
# License:: Apache License, Version 2.0
|
|
@@ -320,7 +321,7 @@ module ChefUtils
|
|
|
320
321
|
# @return [Boolean]
|
|
321
322
|
#
|
|
322
323
|
def solaris_based?(node = __getnode)
|
|
323
|
-
%w{solaris2 smartos omnios openindiana
|
|
324
|
+
%w{solaris2 smartos omnios openindiana}.include?(node["platform"])
|
|
324
325
|
end
|
|
325
326
|
|
|
326
327
|
# All of the BSD-lineage.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
#
|
|
2
3
|
# Copyright:: Copyright (c) Chef Software Inc.
|
|
3
4
|
# License:: Apache License, Version 2.0
|
|
@@ -25,8 +26,13 @@ module ChefUtils
|
|
|
25
26
|
#
|
|
26
27
|
# FIXME: generally these helpers all use the pattern of checking for target_mode?
|
|
27
28
|
# and then if it is we use train. That approach should likely be flipped so that
|
|
28
|
-
# even when we're running without target mode we still use
|
|
29
|
-
# mode.
|
|
29
|
+
# even when we're running without target mode we still use train in its local
|
|
30
|
+
# mode. A prerequisite for that will be better CI testing of train against
|
|
31
|
+
# chef-client though, and ensuring that the APIs are entirely compatible. This
|
|
32
|
+
# will be particularly problematic for shell_out APIs and eventual file-creating
|
|
33
|
+
# APIs which are unlikely to be as sophisticated as the exiting code in chef-client
|
|
34
|
+
# for locally shelling out and creating files, and just dropping inspec local mode
|
|
35
|
+
# into chef-client would break the world.
|
|
30
36
|
#
|
|
31
37
|
|
|
32
38
|
# Train wrapper around File.exist? to make it local mode aware.
|
|
@@ -57,6 +63,24 @@ module ChefUtils
|
|
|
57
63
|
end
|
|
58
64
|
end
|
|
59
65
|
|
|
66
|
+
# Alias to easily convert IO.read / File.read to file_read
|
|
67
|
+
def file_read(path)
|
|
68
|
+
file_open(path).read
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def file_directory?(path)
|
|
72
|
+
if __transport_connection
|
|
73
|
+
__transport_connection.file(filename).directory?
|
|
74
|
+
else
|
|
75
|
+
File.directory?(path)
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Alias to easily convert Dir.exist to dir_exist
|
|
80
|
+
def dir_exist?(path)
|
|
81
|
+
file_directory?(path)
|
|
82
|
+
end
|
|
83
|
+
|
|
60
84
|
extend self
|
|
61
85
|
end
|
|
62
86
|
end
|
data/lib/chef-utils/dsl/which.rb
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
#
|
|
2
3
|
# Copyright:: Copyright (c) Chef Software Inc.
|
|
3
4
|
# License:: Apache License, Version 2.0
|
|
@@ -79,11 +80,15 @@ module ChefUtils
|
|
|
79
80
|
extra_path ||= __extra_path
|
|
80
81
|
paths = __env_path.split(File::PATH_SEPARATOR) + Array(extra_path)
|
|
81
82
|
paths.uniq!
|
|
83
|
+
exts = ENV["PATHEXT"] ? ENV["PATHEXT"].split(";") : []
|
|
84
|
+
exts.unshift("")
|
|
82
85
|
cmds.map do |cmd|
|
|
83
86
|
paths.map do |path|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
+
exts.map do |ext|
|
|
88
|
+
filename = File.join(path, "#{cmd}#{ext}")
|
|
89
|
+
filename if __valid_executable?(filename, &block)
|
|
90
|
+
end.compact
|
|
91
|
+
end
|
|
87
92
|
end.flatten
|
|
88
93
|
end
|
|
89
94
|
|
data/lib/chef-utils/internal.rb
CHANGED
data/lib/chef-utils/mash.rb
CHANGED
data/lib/chef-utils/version.rb
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
# Copyright:: Copyright (c) Chef Software Inc.
|
|
2
3
|
# License:: Apache License, Version 2.0
|
|
3
4
|
#
|
|
@@ -15,5 +16,5 @@
|
|
|
15
16
|
|
|
16
17
|
module ChefUtils
|
|
17
18
|
CHEFUTILS_ROOT = File.expand_path("..", __dir__)
|
|
18
|
-
VERSION = "16.
|
|
19
|
+
VERSION = "16.8.9"
|
|
19
20
|
end
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
# Copyright:: Copyright 2017, Noah Kantrowitz
|
|
2
3
|
# License:: Apache License, Version 2.0
|
|
3
4
|
#
|
|
@@ -27,7 +28,7 @@ module ChefUtils
|
|
|
27
28
|
#
|
|
28
29
|
# @param val [String] Version string to parse.
|
|
29
30
|
def initialize(val)
|
|
30
|
-
val
|
|
31
|
+
val ||= ""
|
|
31
32
|
super(val)
|
|
32
33
|
begin
|
|
33
34
|
@parsed_version = ::Gem::Version.create(self)
|
data/spec/spec_helper.rb
CHANGED
data/spec/unit/dsl/cloud_spec.rb
CHANGED
data/spec/unit/dsl/dsl_spec.rb
CHANGED
data/spec/unit/dsl/os_spec.rb
CHANGED
data/spec/unit/dsl/which_spec.rb
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
#
|
|
2
3
|
# Copyright:: Copyright (c) Chef Software Inc.
|
|
3
4
|
# License:: Apache License, Version 2.0
|
|
@@ -30,6 +31,7 @@ RSpec.describe ChefUtils::DSL::Which do
|
|
|
30
31
|
it description do
|
|
31
32
|
# stub the ENV['PATH']
|
|
32
33
|
expect(ENV).to receive(:[]).with("PATH").and_return(path)
|
|
34
|
+
expect(ENV).to receive(:[]).with("PATHEXT").and_return(nil)
|
|
33
35
|
|
|
34
36
|
# most files should not be found
|
|
35
37
|
allow(File).to receive(:executable?).and_return(false)
|
|
@@ -93,7 +95,7 @@ RSpec.describe ChefUtils::DSL::Which do
|
|
|
93
95
|
end
|
|
94
96
|
|
|
95
97
|
test_which("arrays with blocks", "foo1", "foo2", finds: "/dir2/foo1", others: [ "/dir1/foo2" ]) do |f|
|
|
96
|
-
raise "bad arg to block" unless
|
|
98
|
+
raise "bad arg to block" unless ["/dir2/foo1", "/dir1/foo2"].include?(f)
|
|
97
99
|
|
|
98
100
|
true
|
|
99
101
|
end
|
|
@@ -109,6 +111,7 @@ RSpec.describe ChefUtils::DSL::Which do
|
|
|
109
111
|
it description do
|
|
110
112
|
# stub the ENV['PATH']
|
|
111
113
|
expect(ENV).to receive(:[]).with("PATH").and_return(path)
|
|
114
|
+
expect(ENV).to receive(:[]).with("PATHEXT").and_return(nil)
|
|
112
115
|
|
|
113
116
|
# most files should not be found
|
|
114
117
|
allow(File).to receive(:executable?).and_return(false)
|
data/spec/unit/mash_spec.rb
CHANGED
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: 16.
|
|
4
|
+
version: 16.8.9
|
|
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: 2020-
|
|
11
|
+
date: 2020-12-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description:
|
|
14
14
|
email:
|
|
@@ -21,6 +21,7 @@ files:
|
|
|
21
21
|
- Rakefile
|
|
22
22
|
- chef-utils.gemspec
|
|
23
23
|
- lib/chef-utils.rb
|
|
24
|
+
- lib/chef-utils/dist.rb
|
|
24
25
|
- lib/chef-utils/dsl/architecture.rb
|
|
25
26
|
- lib/chef-utils/dsl/cloud.rb
|
|
26
27
|
- lib/chef-utils/dsl/default_paths.rb
|
|
@@ -58,7 +59,7 @@ licenses:
|
|
|
58
59
|
- Apache-2.0
|
|
59
60
|
metadata:
|
|
60
61
|
bug_tracker_uri: https://github.com/chef/chef/issues
|
|
61
|
-
changelog_uri: https://github.com/chef/chef/CHANGELOG.md
|
|
62
|
+
changelog_uri: https://github.com/chef/chef/blob/master/CHANGELOG.md
|
|
62
63
|
documentation_uri: https://github.com/chef/chef/tree/master/chef-utils/README.md
|
|
63
64
|
homepage_uri: https://github.com/chef/chef/tree/master/chef-utils
|
|
64
65
|
source_code_uri: https://github.com/chef/chef/tree/master/chef-utils
|
|
@@ -70,15 +71,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
70
71
|
requirements:
|
|
71
72
|
- - ">="
|
|
72
73
|
- !ruby/object:Gem::Version
|
|
73
|
-
version:
|
|
74
|
+
version: 2.6.0
|
|
74
75
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
76
|
requirements:
|
|
76
77
|
- - ">="
|
|
77
78
|
- !ruby/object:Gem::Version
|
|
78
79
|
version: '0'
|
|
79
80
|
requirements: []
|
|
80
|
-
rubygems_version: 3.1.
|
|
81
|
+
rubygems_version: 3.1.4
|
|
81
82
|
signing_key:
|
|
82
83
|
specification_version: 4
|
|
83
|
-
summary: Basic utility functions for Core Chef development
|
|
84
|
+
summary: Basic utility functions for Core Chef Infra development
|
|
84
85
|
test_files: []
|