chef-utils 16.3.45 → 16.5.77

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: 292bdf544bdd2ae4ec2e2b9a25e1da90b59d634fab25761b89f17d5832400e75
4
- data.tar.gz: 3eb9e4e75d3f4005a90e661775dca3ab66da2ac97529d5cbdfbd486355b449ed
3
+ metadata.gz: b36c1b127391dc061b6f20eb2e2065cb1d361ac227dbea18a64f32303f80afe1
4
+ data.tar.gz: 7803f413f0bcd33e08bcf2e5c7adf40e585e167e6489acca2df9b8619dc33b59
5
5
  SHA512:
6
- metadata.gz: d607c234395356533c516b6d2924fdcfdd9ad6a6ba74318c156f0461d4842b5da14a3bf438edfbdcabbac990356e085a04ceedf46bb4fd7ba2ae93fb8c7965a5
7
- data.tar.gz: 8efc34def4d9b5da854f47ea12131dc9b9ab187577e2ea1f5522796653e0b2a2d8cb28e1f6d71612f00d2f6df451d85cd87166c122b393c6dcfe644d0813ed7f
6
+ metadata.gz: d22f4baf85d95dcfa0a798019b1250f75c08c4e6ac9a29b14e434f992be4180f49d7838a9ea747609263416191f935946ae17d24651f258e01cbc674b6f2ae4d
7
+ data.tar.gz: a1f70ee7ab9a687dc9f8d28218c07ba5fa55bcbf3826c7f79d1e7de8c7c2a22599fa5359908836b202f35368454e3918eb96009f19c613fbed3af05751ef3d61
@@ -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.3.45".freeze
18
+ VERSION = "16.5.77".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.3.45
4
+ version: 16.5.77
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-07-29 00:00:00.000000000 Z
11
+ date: 2020-09-28 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