chef-utils 16.4.41 → 16.5.64

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: 22e9368674749d297f6ddc69f87aad6871229b4e6cad5deb6bd54d8629d1afc3
4
- data.tar.gz: 7a79e8318c6a952cea65281de9bc89e0ab21464d60cf48c498e46cbb34f54b6b
3
+ metadata.gz: 90f8941963c2b6152837982c8c4d22476a811e2119e29d4cd45aaf3244482193
4
+ data.tar.gz: 0fcf1e4dd6e03ad19511b1309af38063c326f1aa0a86fd1fc4bfdb9ce6f283c7
5
5
  SHA512:
6
- metadata.gz: c9fb960d89c2b0457083ac9464e67d0562cb261a6d119332f9ea9fc2d5f5f7f636ea86834bf66f7082fb919bb58145887e311d07695be2fdf4cab38c2c787718
7
- data.tar.gz: 84958551d7464979a536f9b352b8849820212f1425cc599395d4acb3355b14fb01ff37a30ec146444888f70e09a2ae53b98aeb355144ed62d1922afab3f91bb5
6
+ metadata.gz: 1db020268426245dd2648d2651d0ad07405bb9b2c5f52aec6cd167df5e14daaf957fa9282f27ba89c6531eff319043449430fa9fbdd865eec0ad6ee1ae726f56
7
+ data.tar.gz: 7bef545a2a343ea2d5145a8f2cfff87b27546c6d4a99af19b5de5e2adf38dc3055cc21a9ba7947c195234ccf08f2de848f3aa70dca8bdf542ccb218eec2cfb68
@@ -0,0 +1,97 @@
1
+ module ChefUtils
2
+ # This class is not fully implemented, depending on it is not recommended!
3
+ module Dist
4
+ class Apply
5
+ # The chef-apply product name
6
+ PRODUCT = "Chef Infra Apply".freeze
7
+
8
+ # The chef-apply binary
9
+ EXEC = "chef-apply".freeze
10
+ end
11
+
12
+ class Automate
13
+ # name of the automate product
14
+ PRODUCT = "Chef Automate".freeze
15
+ end
16
+
17
+ class Infra
18
+ # When referencing a product directly, like Chef (Now Chef Infra)
19
+ PRODUCT = "Chef Infra Client".freeze
20
+
21
+ # A short designation for the product, used in Windows event logs
22
+ # and some nomenclature.
23
+ SHORT = "chef".freeze
24
+
25
+ # The client's alias (chef-client)
26
+ CLIENT = "chef-client".freeze
27
+
28
+ # The chef executable, as in `chef gem install` or `chef generate cookbook`
29
+ EXEC = "chef".freeze
30
+
31
+ # The chef-shell executable
32
+ SHELL = "chef-shell".freeze
33
+
34
+ # Configuration related constants
35
+ # The chef-shell configuration file
36
+ SHELL_CONF = "chef_shell.rb".freeze
37
+
38
+ # The user's configuration directory
39
+ USER_CONF_DIR = ".chef".freeze
40
+
41
+ # The suffix for Chef's /etc/chef, /var/chef and C:\\Chef directories
42
+ # "chef" => /etc/cinc, /var/cinc, C:\\cinc
43
+ DIR_SUFFIX = "chef".freeze
44
+ end
45
+
46
+ class Org
47
+ # product Website address
48
+ WEBSITE = "https://chef.io".freeze
49
+
50
+ # The downloads site
51
+ DOWNLOADS_URL = "downloads.chef.io".freeze
52
+
53
+ # The legacy conf folder: C:/opscode/chef. Specifically the "opscode" part
54
+ # DIR_SUFFIX is appended to it in code where relevant
55
+ LEGACY_CONF_DIR = "opscode".freeze
56
+
57
+ # Enable forcing Chef EULA
58
+ ENFORCE_LICENSE = true
59
+
60
+ # product patents page
61
+ PATENTS = "https://www.chef.io/patents".freeze
62
+
63
+ # knife documentation page
64
+ KNIFE_DOCS = "https://docs.chef.io/workstation/knife/".freeze
65
+ end
66
+
67
+ class Server
68
+ # The name of the server product
69
+ PRODUCT = "Chef Infra Server".freeze
70
+
71
+ # The server's configuration directory
72
+ CONF_DIR = "/etc/chef-server".freeze
73
+
74
+ # The servers's alias (chef-server)
75
+ SERVER = "chef-server".freeze
76
+
77
+ # The server's configuration utility
78
+ SERVER_CTL = "chef-server-ctl".freeze
79
+ end
80
+
81
+ class Solo
82
+ # Chef-Solo's product name
83
+ PRODUCT = "Chef Infra Solo".freeze
84
+
85
+ # The chef-solo executable (legacy local mode)
86
+ EXEC = "chef-solo".freeze
87
+ end
88
+
89
+ class Zero
90
+ # chef-zero executable
91
+ PRODUCT = "Chef Infra Zero".freeze
92
+
93
+ # The chef-zero executable (local mode)
94
+ EXEC = "chef-zero".freeze
95
+ end
96
+ end
97
+ end
@@ -25,8 +25,13 @@ module ChefUtils
25
25
  #
26
26
  # FIXME: generally these helpers all use the pattern of checking for target_mode?
27
27
  # 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 inspec in its local
29
- # mode.
28
+ # even when we're running without target mode we still use train in its local
29
+ # mode. A prerequisite for that will be better CI testing of train against
30
+ # chef-client though, and ensuring that the APIs are entirely compatible. This
31
+ # will be particularly problematic for shell_out APIs and eventual file-creating
32
+ # APIs which are unlikely to be as sophisticated as the exiting code in chef-client
33
+ # for locally shelling out and creating files, and just dropping inspec local mode
34
+ # into chef-client would break the world.
30
35
  #
31
36
 
32
37
  # Train wrapper around File.exist? to make it local mode aware.
@@ -57,6 +62,24 @@ module ChefUtils
57
62
  end
58
63
  end
59
64
 
65
+ # Alias to easily convert IO.read / File.read to file_read
66
+ def file_read(path)
67
+ file_open(path).read
68
+ end
69
+
70
+ def file_directory?(path)
71
+ if __transport_connection
72
+ __transport_connection.file(filename).directory?
73
+ else
74
+ File.directory?(path)
75
+ end
76
+ end
77
+
78
+ # Alias to easily convert Dir.exist to dir_exist
79
+ def dir_exist?(path)
80
+ file_directory?(path)
81
+ end
82
+
60
83
  extend self
61
84
  end
62
85
  end
@@ -79,11 +79,15 @@ module ChefUtils
79
79
  extra_path ||= __extra_path
80
80
  paths = __env_path.split(File::PATH_SEPARATOR) + Array(extra_path)
81
81
  paths.uniq!
82
+ exts = ENV["PATHEXT"] ? ENV["PATHEXT"].split(";") : []
83
+ exts.unshift("")
82
84
  cmds.map do |cmd|
83
85
  paths.map do |path|
84
- filename = File.join(path, cmd)
85
- filename if __valid_executable?(filename, &block)
86
- end.compact
86
+ exts.map do |ext|
87
+ filename = File.join(path, "#{cmd}#{ext}")
88
+ filename if __valid_executable?(filename, &block)
89
+ end.compact
90
+ end
87
91
  end.flatten
88
92
  end
89
93
 
@@ -15,5 +15,5 @@
15
15
 
16
16
  module ChefUtils
17
17
  CHEFUTILS_ROOT = File.expand_path("..", __dir__)
18
- VERSION = "16.4.41".freeze
18
+ VERSION = "16.5.64".freeze
19
19
  end
@@ -30,6 +30,7 @@ RSpec.describe ChefUtils::DSL::Which do
30
30
  it description do
31
31
  # stub the ENV['PATH']
32
32
  expect(ENV).to receive(:[]).with("PATH").and_return(path)
33
+ expect(ENV).to receive(:[]).with("PATHEXT").and_return(nil)
33
34
 
34
35
  # most files should not be found
35
36
  allow(File).to receive(:executable?).and_return(false)
@@ -109,6 +110,7 @@ RSpec.describe ChefUtils::DSL::Which do
109
110
  it description do
110
111
  # stub the ENV['PATH']
111
112
  expect(ENV).to receive(:[]).with("PATH").and_return(path)
113
+ expect(ENV).to receive(:[]).with("PATHEXT").and_return(nil)
112
114
 
113
115
  # most files should not be found
114
116
  allow(File).to receive(:executable?).and_return(false)
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.41
4
+ version: 16.5.64
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-08-19 00:00:00.000000000 Z
11
+ date: 2020-09-17 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