chef-utils 16.4.35 → 16.6.14

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: aaacc4bea17c095d76f0dbd99ec09b047165f3d539983d24c42c543521c8a429
4
- data.tar.gz: ccca36f7bbac0c4a2e00fba9bef1748e54b986833ec211bccf4e6431728005e8
3
+ metadata.gz: a587eedbc11c7d6303849337232b54ff403db11fd67cc9a3580f6e98ee7f22ff
4
+ data.tar.gz: e7b4d963d6aac00d674442f572518403c596348baa07213d513ee2cdda790e41
5
5
  SHA512:
6
- metadata.gz: 6cd7bf0b94558dd330247e7fcb6b1fc10d88fdb3343764173a5402b49fd0d634ea24becd9ba85b55b7cf77c6da4515ebe43505f38c83b8b86e71676bae85633a
7
- data.tar.gz: a88ef927cf9b7e426e270577e507d0b9167c23d63edd9b729ce6868e80590aebc96583a99bfb87976763cce87ac417859f2b1b1df4dbdab88b1ade7c4d468646
6
+ metadata.gz: 72f228dedb23688756e3ec17c601ef7607fc1824108f2dfa629072d8128d62811f4de4ae40ff3ff2a855a65f9db20f50d2358e0f3135486d4dc18692e22b3294
7
+ data.tar.gz: a1cc265b90539062c8c758dc47ddbe7600df874613261fec735008c442b4ec2ea4cb4a8d1609b357581b65317eab371fcb7db6bb2f6728dcfedbb278770016c3
@@ -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.35".freeze
18
+ VERSION = "16.6.14".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.35
4
+ version: 16.6.14
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-18 00:00:00.000000000 Z
11
+ date: 2020-10-14 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
@@ -77,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
78
  - !ruby/object:Gem::Version
78
79
  version: '0'
79
80
  requirements: []
80
- rubygems_version: 3.1.2
81
+ rubygems_version: 3.1.4
81
82
  signing_key:
82
83
  specification_version: 4
83
84
  summary: Basic utility functions for Core Chef development