chef-apply 0.5.3 → 0.5.16

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: 3249228c66633761ae1d2718070c68d1c85042f07dfc08da7ae098ca262eddc7
4
- data.tar.gz: 80488b02ac0b76192debcec1e97416e96d746db66a6f65d531f224abe1cde4d8
3
+ metadata.gz: 40e1ef3f302762a273ab6fcdf15f0102bf0de5199d20cd22df2125a237551ab5
4
+ data.tar.gz: f65616505eed1c2afd0393b45709ad683c8372903790408a6c1020003122487a
5
5
  SHA512:
6
- metadata.gz: e9fa8938dc3276b6204c21ca28073eb3f36b58735d750b0ad67bbe0c36401dbfde64a70f7110c29127d2c376ce075ff8a3c97150381e7390ef898fa5ffbb53a1
7
- data.tar.gz: 04f2afd5b1a3210c86fb7aebf8bca351528458595fa277d72ca56c61e2bb80252029c5daa377cf8f5f083f4b2e5542a6ccf7125d9b2ea30131ef288e81c02381
6
+ metadata.gz: 72f59e61c72e8f8f470b392344e382193a2e51d977d9f9a8687ff9fa86563e2fdfe512bbd2d12d8fb418f5734b229a92b6947fc9a587e10df7630456d0229a47
7
+ data.tar.gz: ed03fd5cb7b9cbf2af42cf987a55e2821d8098989ee067f105a6af28413ab50d782c1824e8a5f2e79f43f54063b46a80b20a8b9597a081acded5a13044010317
data/Gemfile CHANGED
@@ -19,7 +19,7 @@ source "https://rubygems.org"
19
19
  gemspec
20
20
 
21
21
  group :development do
22
- gem "chefstyle", "1.3.2"
22
+ gem "chefstyle", "1.7.2"
23
23
  gem "rake", ">= 10.1.0"
24
24
  gem "rspec", "~> 3.0"
25
25
  gem "simplecov"
data/bin/chef-run CHANGED
@@ -20,4 +20,4 @@ require "chef_apply/startup"
20
20
 
21
21
  # Perform initialization tasks then hand off control to
22
22
  # CLI to run the command.
23
- ChefApply::Startup.new(ARGV).run
23
+ ChefApply::Startup.new(ARGV).run(enforce_license: true)
data/chef-apply.gemspec CHANGED
@@ -15,7 +15,7 @@
15
15
  # limitations under the License.
16
16
  #
17
17
 
18
- lib = File.expand_path("../lib", __FILE__)
18
+ lib = File.expand_path("lib", __dir__)
19
19
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
20
20
  require "chef_apply/version"
21
21
 
@@ -54,5 +54,5 @@ Gem::Specification.new do |spec|
54
54
  spec.add_dependency "chef-telemetry", ">= 1.0.2"
55
55
  spec.add_dependency "license-acceptance", ">= 1.0.11", "< 3"
56
56
 
57
- spec.post_install_message = File.read(File.expand_path("../warning.txt", __FILE__))
57
+ spec.post_install_message = File.read(File.expand_path("warning.txt", __dir__))
58
58
  end
data/i18n/en.yml CHANGED
@@ -28,7 +28,7 @@ cli:
28
28
  enabled=false
29
29
 
30
30
  For more information about what we data gather and additional opt-out
31
- options, visit https://chef.sh/docs/chef-workstation/privacy/
31
+ options, visit https://docs.chef.io/workstation/privacy/
32
32
 
33
33
  description: |
34
34
  Chef Run is a tool to execute ad-hoc tasks using Chef.
@@ -113,6 +113,7 @@ cli:
113
113
  cookbook is found we run the default recipe.
114
114
  3. This behaves similarly to 'cookbook name' above, but it also allows
115
115
  you to specify which recipe to use from the cookbook.
116
+ Usage: cookbookname::recipename
116
117
  error:
117
118
  bad_config_file: |
118
119
 
data/i18n/errors/en.yml CHANGED
@@ -146,7 +146,7 @@ errors:
146
146
  For more information, please consult the documentation
147
147
  for this resource:
148
148
 
149
- https://docs.chef.io/resource_reference.html
149
+ https://docs.chef.io/resources/
150
150
 
151
151
  CHEFCCR004:
152
152
  text: |
@@ -157,7 +157,7 @@ errors:
157
157
  Please consult the documentation for properties
158
158
  supported by your resource and their valid values:
159
159
 
160
- https://docs.chef.io/resource_reference.html
160
+ https://docs.chef.io/resources/
161
161
 
162
162
  CHEFCCR005:
163
163
  text: |
@@ -165,7 +165,7 @@ errors:
165
165
 
166
166
  Please consult the documentation for a list of valid resources:
167
167
 
168
- https://docs.chef.io/resource_reference.html
168
+ https://docs.chef.io/resources/
169
169
 
170
170
  CHEFCCR006:
171
171
  text: |
@@ -174,7 +174,7 @@ errors:
174
174
  Please consult the documentation for %2 for a list of
175
175
  valid properties:
176
176
 
177
- https://docs.chef.io/resource_reference.html
177
+ https://docs.chef.io/resources/
178
178
 
179
179
  CHEFCCR099:
180
180
  text: |
@@ -246,7 +246,7 @@ errors:
246
246
 
247
247
  Additional instructions can be found in the troubleshooting documentation:
248
248
 
249
- https://www.chef.sh/docs/chef-workstation/troubleshooting/#error-code-cheftrn007
249
+ https://docs.chef.io/workstation/troubleshooting/#cheftrn007
250
250
 
251
251
  CHEFTRN999:
252
252
  text: |
@@ -53,6 +53,7 @@ module ChefApply::Action
53
53
  end
54
54
 
55
55
  end
56
+
56
57
  class PolicyfileInstallError < ChefApply::Error
57
58
  def initialize(cause_err); super("CHEFPOLICY001", cause_err.message); end
58
59
  end
@@ -63,14 +63,14 @@ module ChefApply
63
63
  super()
64
64
  end
65
65
 
66
- def run
66
+ def run(enforce_license: false)
67
67
  # Perform a timing and capture of the run. Individual methods and actions may perform
68
68
  # nested Chef::Telemeter.timed_*_capture or Chef::Telemeter.capture calls in their operation, and
69
69
  # they will be captured in the same telemetry session.
70
70
 
71
71
  Chef::Telemeter.timed_run_capture([:redacted]) do
72
72
  begin
73
- perform_run
73
+ perform_run(enforce_license: enforce_license)
74
74
  rescue Exception => e
75
75
  @rc = handle_run_error(e)
76
76
  end
@@ -100,14 +100,14 @@ module ChefApply
100
100
  end
101
101
  end
102
102
 
103
- def perform_run
103
+ def perform_run(enforce_license: false)
104
104
  parse_options(@argv)
105
105
  if @argv.empty? || parsed_options[:help]
106
106
  show_help
107
107
  elsif parsed_options[:version]
108
108
  show_version
109
109
  else
110
- check_license_acceptance
110
+ check_license_acceptance if enforce_license
111
111
  validate_params(cli_arguments)
112
112
  target_hosts = resolve_targets(cli_arguments.shift, parsed_options)
113
113
  render_cookbook_setup(cli_arguments)
@@ -76,6 +76,8 @@ module ChefApply
76
76
  value.to_i
77
77
  when /^\d+\.\d*$/, /^\d*\.\d+$/
78
78
  value.to_f
79
+ when /^[:].+$/
80
+ value.split(":").last.to_sym
79
81
  when /true/i
80
82
  true
81
83
  when /false/i
@@ -33,7 +33,7 @@ module ChefApply
33
33
  init_terminal
34
34
  end
35
35
 
36
- def run
36
+ def run(enforce_license: false)
37
37
  # This component is not supported in ChefDK; an exception will be raised
38
38
  # if running in that context.
39
39
  verify_not_in_chefdk
@@ -62,7 +62,7 @@ module ChefApply
62
62
  start_telemeter_upload
63
63
 
64
64
  # Launch the actual Chef Apply behavior
65
- start_chef_apply
65
+ start_chef_apply(enforce_license: enforce_license)
66
66
 
67
67
  # NOTE: Because these exceptions occur outside of the
68
68
  # CLI handling, they won't be tracked in telemtry.
@@ -194,24 +194,26 @@ module ChefApply
194
194
  Chef::Log.level = ChefApply::Log.level
195
195
  end
196
196
 
197
- def start_chef_apply
197
+ def start_chef_apply(enforce_license: false)
198
198
  require_relative "cli"
199
- ChefApply::CLI.new(@argv).run
199
+ ChefApply::CLI.new(@argv).run(enforce_license: enforce_license)
200
200
  end
201
201
 
202
202
  private
203
203
 
204
204
  def script_path
205
- File.expand_path File.dirname(__FILE__)
205
+ __dir__
206
206
  end
207
207
 
208
208
  class ConfigPathNotProvided < StandardError; end
209
+
209
210
  class ConfigPathInvalid < StandardError
210
211
  attr_reader :path
211
212
  def initialize(path)
212
213
  @path = path
213
214
  end
214
215
  end
216
+
215
217
  class UnsupportedInstallation < StandardError; end
216
218
  end
217
219
  end
@@ -323,7 +323,9 @@ module ChefApply
323
323
  super(*(Array(init_params).flatten))
324
324
  end
325
325
  end
326
+
326
327
  class ChefNotInstalled < StandardError; end
328
+
327
329
  class UnsupportedTargetOS < ChefApply::ErrorNoLogs
328
330
  def initialize(os_name); super("CHEFTARG001", os_name); end
329
331
  end
@@ -16,7 +16,7 @@
16
16
  #
17
17
 
18
18
  require "train/errors"
19
- require "pastel"
19
+ require "pastel" unless defined?(Pastel)
20
20
  require_relative "../error"
21
21
  require_relative "../config"
22
22
  require_relative "../text"
@@ -14,7 +14,6 @@
14
14
  # See the License for the specific language governing permissions and
15
15
  # limitations under the License.
16
16
  #
17
- require "thread"
18
17
  require_relative "plain_text_element"
19
18
 
20
19
  module ChefApply
@@ -16,5 +16,5 @@
16
16
  #
17
17
 
18
18
  module ChefApply
19
- VERSION = "0.5.3".freeze
19
+ VERSION = "0.5.16".freeze
20
20
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-apply
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.5.16
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-09-02 00:00:00.000000000 Z
11
+ date: 2021-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-cli
@@ -287,7 +287,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
287
287
  - !ruby/object:Gem::Version
288
288
  version: '0'
289
289
  requirements: []
290
- rubygems_version: 3.0.3
290
+ rubygems_version: 3.1.4
291
291
  signing_key:
292
292
  specification_version: 4
293
293
  summary: The ad-hoc execution tool for the Chef ecosystem.