chef-apply 0.3.3 → 0.4.6

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.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +1 -1
  3. data/chef-apply.gemspec +2 -1
  4. data/lib/chef_apply/action/base.rb +1 -0
  5. data/lib/chef_apply/action/converge_target.rb +11 -11
  6. data/lib/chef_apply/action/converge_target/ccr_failure_mapper.rb +100 -0
  7. data/lib/chef_apply/action/generate_local_policy.rb +1 -1
  8. data/lib/chef_apply/action/generate_temp_cookbook.rb +53 -53
  9. data/lib/chef_apply/action/generate_temp_cookbook/recipe_lookup.rb +124 -0
  10. data/lib/chef_apply/action/generate_temp_cookbook/temp_cookbook.rb +175 -0
  11. data/lib/chef_apply/action/install_chef.rb +8 -8
  12. data/lib/chef_apply/action/install_chef/minimum_chef_version.rb +85 -0
  13. data/lib/chef_apply/cli.rb +10 -9
  14. data/lib/chef_apply/cli/options.rb +2 -2
  15. data/lib/chef_apply/cli/validation.rb +2 -1
  16. data/lib/chef_apply/file_fetcher.rb +1 -1
  17. data/lib/chef_apply/log.rb +4 -6
  18. data/lib/chef_apply/startup.rb +7 -4
  19. data/lib/chef_apply/target_host.rb +10 -5
  20. data/lib/chef_apply/target_host/linux.rb +1 -1
  21. data/lib/chef_apply/target_resolver.rb +3 -1
  22. data/lib/chef_apply/telemeter.rb +1 -1
  23. data/lib/chef_apply/text/error_translation.rb +1 -1
  24. data/lib/chef_apply/text/text_wrapper.rb +2 -1
  25. data/lib/chef_apply/ui/error_printer.rb +15 -13
  26. data/lib/chef_apply/ui/plain_text_element.rb +1 -2
  27. data/lib/chef_apply/ui/plain_text_header.rb +1 -1
  28. data/lib/chef_apply/ui/terminal.rb +4 -4
  29. data/lib/chef_apply/version.rb +1 -1
  30. data/spec/spec_helper.rb +43 -3
  31. data/spec/unit/action/base_spec.rb +2 -1
  32. data/spec/unit/{errors → action/converge_target}/ccr_failure_mapper_spec.rb +12 -9
  33. data/spec/unit/action/converge_target_spec.rb +21 -22
  34. data/spec/unit/action/generate_local_policy_spec.rb +5 -5
  35. data/spec/unit/{recipe_lookup_spec.rb → action/generate_temp_cookbook/recipe_lookup_spec.rb} +10 -10
  36. data/spec/unit/{temp_cookbook_spec.rb → action/generate_temp_cookbook/temp_cookbook_spec.rb} +23 -24
  37. data/spec/unit/action/generate_temp_cookbook_spec.rb +4 -6
  38. data/spec/unit/{minimum_chef_version_spec.rb → action/install_chef/minimum_chef_version_spec.rb} +13 -13
  39. data/spec/unit/action/install_chef_spec.rb +4 -4
  40. data/spec/unit/cli/options_spec.rb +17 -17
  41. data/spec/unit/cli/validation_spec.rb +6 -3
  42. data/spec/unit/cli_spec.rb +12 -9
  43. data/spec/unit/log_spec.rb +1 -1
  44. data/spec/unit/startup_spec.rb +11 -12
  45. data/spec/unit/target_host/windows_spec.rb +1 -1
  46. data/spec/unit/target_host_spec.rb +3 -2
  47. data/spec/unit/telemeter_spec.rb +5 -5
  48. data/spec/unit/text/error_translation_spec.rb +11 -7
  49. data/spec/unit/ui/error_printer_spec.rb +6 -7
  50. metadata +24 -11
  51. data/Gemfile.lock +0 -400
  52. data/lib/chef_apply/errors/ccr_failure_mapper.rb +0 -93
  53. data/lib/chef_apply/minimum_chef_version.rb +0 -79
  54. data/lib/chef_apply/recipe_lookup.rb +0 -117
  55. data/lib/chef_apply/temp_cookbook.rb +0 -170
data/Gemfile.lock DELETED
@@ -1,400 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- chef-apply (0.3.3)
5
- chef (>= 15.0)
6
- chef-cli (>= 1.0.3)
7
- chef-telemetry
8
- license-acceptance (~> 1.0, >= 1.0.11)
9
- mixlib-cli
10
- mixlib-config
11
- mixlib-install
12
- mixlib-log
13
- pastel
14
- r18n-desktop
15
- toml-rb
16
- train
17
- tty-spinner
18
-
19
- GEM
20
- remote: https://rubygems.org/
21
- specs:
22
- addressable (2.5.2)
23
- public_suffix (>= 2.0.2, < 4.0)
24
- ast (2.4.0)
25
- azure_graph_rbac (0.17.1)
26
- ms_rest_azure (~> 0.11.0)
27
- azure_mgmt_key_vault (0.17.4)
28
- ms_rest_azure (~> 0.11.0)
29
- azure_mgmt_resources (0.17.5)
30
- ms_rest_azure (~> 0.11.1)
31
- bcrypt_pbkdf (1.0.1)
32
- binding_of_caller (0.8.0)
33
- debug_inspector (>= 0.0.1)
34
- builder (3.2.3)
35
- byebug (11.0.1)
36
- chef (15.1.36)
37
- addressable
38
- bcrypt_pbkdf (~> 1.0)
39
- bundler (>= 1.10)
40
- chef-config (= 15.1.36)
41
- chef-zero (>= 14.0.11)
42
- diff-lcs (~> 1.2, >= 1.2.4)
43
- ed25519 (~> 1.2)
44
- erubis (~> 2.7)
45
- ffi (~> 1.9, >= 1.9.25)
46
- ffi-libarchive
47
- ffi-yajl (~> 2.2)
48
- highline (>= 1.6.9, < 2)
49
- iniparse (~> 1.4)
50
- license-acceptance (~> 1.0, >= 1.0.5)
51
- mixlib-archive (>= 0.4, < 2.0)
52
- mixlib-authentication (~> 2.1)
53
- mixlib-cli (>= 2.1.1, < 3.0)
54
- mixlib-log (>= 2.0.3, < 4.0)
55
- mixlib-shellout (>= 2.4, < 4.0)
56
- net-sftp (~> 2.1, >= 2.1.2)
57
- net-ssh (>= 4.2, < 6)
58
- net-ssh-multi (~> 1.2, >= 1.2.1)
59
- ohai (~> 15.0)
60
- plist (~> 3.2)
61
- proxifier (~> 1.0)
62
- syslog-logger (~> 1.6)
63
- train-core (~> 2.0, >= 2.0.12)
64
- tty-screen (~> 0.6)
65
- uuidtools (~> 2.1.5)
66
- chef-cli (1.0.3)
67
- addressable (>= 2.3.5, < 2.6)
68
- chef (~> 15.0)
69
- cookbook-omnifetch (~> 0.5)
70
- diff-lcs (~> 1.0)
71
- ffi-yajl (>= 1.0, < 3.0)
72
- license-acceptance (~> 1.0, >= 1.0.11)
73
- minitar (~> 0.6)
74
- mixlib-cli (>= 1.7, < 3.0)
75
- mixlib-shellout (>= 2.0, < 4.0)
76
- paint (~> 1.0)
77
- solve (> 2.0, < 5.0)
78
- chef-config (15.1.36)
79
- addressable
80
- fuzzyurl
81
- mixlib-config (>= 2.2.12, < 4.0)
82
- mixlib-shellout (>= 2.0, < 4.0)
83
- tomlrb (~> 1.2)
84
- chef-telemetry (0.1.8)
85
- chef-config
86
- concurrent-ruby (~> 1.0)
87
- ffi-yajl (~> 2.2)
88
- http (~> 2.2)
89
- chef-zero (14.0.12)
90
- ffi-yajl (~> 2.2)
91
- hashie (>= 2.0, < 4.0)
92
- mixlib-log (>= 2.0, < 4.0)
93
- rack (~> 2.0, >= 2.0.6)
94
- uuidtools (~> 2.1)
95
- chefstyle (0.12.0)
96
- rubocop (= 0.62.0)
97
- citrus (3.0.2)
98
- coderay (1.1.2)
99
- concurrent-ruby (1.1.5)
100
- cookbook-omnifetch (0.9.0)
101
- mixlib-archive (>= 0.4, < 2.0)
102
- debug_inspector (0.0.3)
103
- declarative (0.0.10)
104
- declarative-option (0.1.0)
105
- diff-lcs (1.3)
106
- docile (1.3.2)
107
- docker-api (1.34.2)
108
- excon (>= 0.47.0)
109
- multi_json
110
- domain_name (0.5.20190701)
111
- unf (>= 0.0.5, < 1.0.0)
112
- ed25519 (1.2.4)
113
- equatable (0.6.1)
114
- erubis (2.7.0)
115
- excon (0.64.0)
116
- faraday (0.15.4)
117
- multipart-post (>= 1.2, < 3)
118
- faraday-cookie_jar (0.0.6)
119
- faraday (>= 0.7.4)
120
- http-cookie (~> 1.0.0)
121
- ffi (1.11.1)
122
- ffi-libarchive (0.4.10)
123
- ffi (~> 1.0)
124
- ffi-yajl (2.3.1)
125
- libyajl2 (~> 1.2)
126
- fuzzyurl (0.9.0)
127
- github-markup (3.0.4)
128
- google-api-client (0.23.9)
129
- addressable (~> 2.5, >= 2.5.1)
130
- googleauth (>= 0.5, < 0.7.0)
131
- httpclient (>= 2.8.1, < 3.0)
132
- mime-types (~> 3.0)
133
- representable (~> 3.0)
134
- retriable (>= 2.0, < 4.0)
135
- signet (~> 0.9)
136
- googleauth (0.6.7)
137
- faraday (~> 0.12)
138
- jwt (>= 1.4, < 3.0)
139
- memoist (~> 0.16)
140
- multi_json (~> 1.11)
141
- os (>= 0.9, < 2.0)
142
- signet (~> 0.7)
143
- gssapi (1.3.0)
144
- ffi (>= 1.0.1)
145
- gyoku (1.3.1)
146
- builder (>= 2.1.2)
147
- hashie (3.6.0)
148
- highline (1.7.10)
149
- http (2.2.2)
150
- addressable (~> 2.3)
151
- http-cookie (~> 1.0)
152
- http-form_data (~> 1.0.1)
153
- http_parser.rb (~> 0.6.0)
154
- http-cookie (1.0.3)
155
- domain_name (~> 0.5)
156
- http-form_data (1.0.3)
157
- http_parser.rb (0.6.0)
158
- httpclient (2.8.3)
159
- inifile (3.0.0)
160
- iniparse (1.4.4)
161
- ipaddress (0.8.3)
162
- jaro_winkler (1.5.3)
163
- json (2.2.0)
164
- jwt (2.2.1)
165
- libyajl2 (1.2.0)
166
- license-acceptance (1.0.13)
167
- pastel (~> 0.7)
168
- tomlrb (~> 1.2)
169
- tty-box (~> 0.3)
170
- tty-prompt (~> 0.18)
171
- little-plugger (1.1.4)
172
- logging (2.2.2)
173
- little-plugger (~> 1.1)
174
- multi_json (~> 1.10)
175
- memoist (0.16.0)
176
- method_source (0.9.2)
177
- mime-types (3.2.2)
178
- mime-types-data (~> 3.2015)
179
- mime-types-data (3.2019.0331)
180
- minitar (0.8)
181
- mixlib-archive (1.0.1)
182
- mixlib-log
183
- mixlib-authentication (2.1.1)
184
- mixlib-cli (2.1.1)
185
- mixlib-config (3.0.1)
186
- tomlrb
187
- mixlib-install (3.11.18)
188
- mixlib-shellout
189
- mixlib-versioning
190
- thor
191
- mixlib-log (3.0.1)
192
- mixlib-shellout (3.0.4)
193
- mixlib-versioning (1.2.7)
194
- molinillo (0.6.6)
195
- ms_rest (0.7.4)
196
- concurrent-ruby (~> 1.0)
197
- faraday (~> 0.9)
198
- timeliness (~> 0.3.10)
199
- ms_rest_azure (0.11.1)
200
- concurrent-ruby (~> 1.0)
201
- faraday (~> 0.9)
202
- faraday-cookie_jar (~> 0.0.6)
203
- ms_rest (~> 0.7.4)
204
- unf_ext (= 0.0.7.2)
205
- multi_json (1.13.1)
206
- multipart-post (2.1.1)
207
- necromancer (0.4.0)
208
- net-scp (2.0.0)
209
- net-ssh (>= 2.6.5, < 6.0.0)
210
- net-sftp (2.1.2)
211
- net-ssh (>= 2.6.5)
212
- net-ssh (5.2.0)
213
- net-ssh-gateway (2.0.0)
214
- net-ssh (>= 4.0.0)
215
- net-ssh-multi (1.2.1)
216
- net-ssh (>= 2.6.5)
217
- net-ssh-gateway (>= 1.2.0)
218
- nori (2.6.0)
219
- ohai (15.1.5)
220
- chef-config (>= 12.8, < 16)
221
- ffi (~> 1.9)
222
- ffi-yajl (~> 2.2)
223
- ipaddress
224
- mixlib-cli (>= 1.7.0)
225
- mixlib-config (>= 2.0, < 4.0)
226
- mixlib-log (>= 2.0.1, < 4.0)
227
- mixlib-shellout (>= 2.0, < 4.0)
228
- plist (~> 3.1)
229
- systemu (~> 2.6.4)
230
- wmi-lite (~> 1.0)
231
- os (1.0.1)
232
- paint (1.0.1)
233
- parallel (1.17.0)
234
- parser (2.6.3.0)
235
- ast (~> 2.4.0)
236
- pastel (0.7.3)
237
- equatable (~> 0.6)
238
- tty-color (~> 0.5)
239
- plist (3.5.0)
240
- powerpack (0.1.2)
241
- proxifier (1.0.3)
242
- pry (0.12.2)
243
- coderay (~> 1.1.0)
244
- method_source (~> 0.9.0)
245
- pry-byebug (3.7.0)
246
- byebug (~> 11.0)
247
- pry (~> 0.10)
248
- pry-stack_explorer (0.4.9.3)
249
- binding_of_caller (>= 0.7)
250
- pry (>= 0.9.11)
251
- public_suffix (3.1.1)
252
- r18n-core (3.2.0)
253
- r18n-desktop (3.2.0)
254
- r18n-core (= 3.2.0)
255
- rack (2.0.7)
256
- rainbow (3.0.0)
257
- rake (12.3.2)
258
- rb-readline (0.5.5)
259
- redcarpet (3.4.0)
260
- representable (3.0.4)
261
- declarative (< 0.1.0)
262
- declarative-option (< 0.2.0)
263
- uber (< 0.2.0)
264
- retriable (3.1.2)
265
- rspec (3.8.0)
266
- rspec-core (~> 3.8.0)
267
- rspec-expectations (~> 3.8.0)
268
- rspec-mocks (~> 3.8.0)
269
- rspec-core (3.8.2)
270
- rspec-support (~> 3.8.0)
271
- rspec-expectations (3.8.4)
272
- diff-lcs (>= 1.2.0, < 2.0)
273
- rspec-support (~> 3.8.0)
274
- rspec-mocks (3.8.1)
275
- diff-lcs (>= 1.2.0, < 2.0)
276
- rspec-support (~> 3.8.0)
277
- rspec-support (3.8.2)
278
- rubocop (0.62.0)
279
- jaro_winkler (~> 1.5.1)
280
- parallel (~> 1.10)
281
- parser (>= 2.5, != 2.5.1.1)
282
- powerpack (~> 0.1)
283
- rainbow (>= 2.2.2, < 4.0)
284
- ruby-progressbar (~> 1.7)
285
- unicode-display_width (~> 1.4.0)
286
- ruby-progressbar (1.10.1)
287
- rubyntlm (0.6.2)
288
- rubyzip (1.2.3)
289
- semverse (3.0.0)
290
- signet (0.11.0)
291
- addressable (~> 2.3)
292
- faraday (~> 0.9)
293
- jwt (>= 1.5, < 3.0)
294
- multi_json (~> 1.10)
295
- simplecov (0.16.1)
296
- docile (~> 1.1)
297
- json (>= 1.8, < 3)
298
- simplecov-html (~> 0.10.0)
299
- simplecov-html (0.10.2)
300
- solve (4.0.2)
301
- molinillo (~> 0.6)
302
- semverse (>= 1.1, < 4.0)
303
- strings (0.1.4)
304
- strings-ansi (~> 0.1.0)
305
- unicode-display_width (~> 1.4.0)
306
- unicode_utils (~> 1.4.0)
307
- strings-ansi (0.1.0)
308
- syslog-logger (1.6.8)
309
- systemu (2.6.5)
310
- thor (0.20.3)
311
- timeliness (0.3.10)
312
- timers (4.3.0)
313
- toml-rb (1.1.2)
314
- citrus (~> 3.0, > 3.0)
315
- tomlrb (1.2.8)
316
- train (2.1.13)
317
- azure_graph_rbac (~> 0.16)
318
- azure_mgmt_key_vault (~> 0.17)
319
- azure_mgmt_resources (~> 0.15)
320
- docker-api (~> 1.26)
321
- google-api-client (~> 0.23.9)
322
- googleauth (~> 0.6.6)
323
- inifile
324
- json (>= 1.8, < 3.0)
325
- mixlib-shellout (>= 2.0, < 4.0)
326
- net-scp (>= 1.2, < 3.0)
327
- net-ssh (>= 2.9, < 6.0)
328
- winrm (~> 2.0)
329
- winrm-fs (~> 1.0)
330
- train-core (2.1.13)
331
- json (>= 1.8, < 3.0)
332
- mixlib-shellout (>= 2.0, < 4.0)
333
- net-scp (>= 1.2, < 3.0)
334
- net-ssh (>= 2.9, < 6.0)
335
- winrm (~> 2.0)
336
- winrm-fs (~> 1.0)
337
- tty-box (0.3.0)
338
- pastel (~> 0.7.2)
339
- strings (~> 0.1.4)
340
- tty-cursor (~> 0.6.0)
341
- tty-color (0.5.0)
342
- tty-cursor (0.6.1)
343
- tty-prompt (0.18.1)
344
- necromancer (~> 0.4.0)
345
- pastel (~> 0.7.0)
346
- timers (~> 4.0)
347
- tty-cursor (~> 0.6.0)
348
- tty-reader (~> 0.5.0)
349
- tty-reader (0.5.0)
350
- tty-cursor (~> 0.6.0)
351
- tty-screen (~> 0.6.4)
352
- wisper (~> 2.0.0)
353
- tty-screen (0.6.5)
354
- tty-spinner (0.9.0)
355
- tty-cursor (~> 0.6.0)
356
- uber (0.1.0)
357
- unf (0.1.4)
358
- unf_ext
359
- unf_ext (0.0.7.2)
360
- unicode-display_width (1.4.1)
361
- unicode_utils (1.4.0)
362
- uuidtools (2.1.5)
363
- winrm (2.3.2)
364
- builder (>= 2.1.2)
365
- erubis (~> 2.7)
366
- gssapi (~> 1.2)
367
- gyoku (~> 1.0)
368
- httpclient (~> 2.2, >= 2.2.0.2)
369
- logging (>= 1.6.1, < 3.0)
370
- nori (~> 2.0)
371
- rubyntlm (~> 0.6.0, >= 0.6.1)
372
- winrm-fs (1.3.2)
373
- erubis (~> 2.7)
374
- logging (>= 1.6.1, < 3.0)
375
- rubyzip (~> 1.1)
376
- winrm (~> 2.0)
377
- wisper (2.0.0)
378
- wmi-lite (1.0.2)
379
- yard (0.9.20)
380
-
381
- PLATFORMS
382
- ruby
383
-
384
- DEPENDENCIES
385
- bundler
386
- chef-apply!
387
- chefstyle
388
- github-markup
389
- pry
390
- pry-byebug
391
- pry-stack_explorer
392
- rake (>= 10.1.0)
393
- rb-readline
394
- redcarpet
395
- rspec (~> 3.0)
396
- simplecov
397
- yard
398
-
399
- BUNDLED WITH
400
- 1.17.3
@@ -1,93 +0,0 @@
1
- #
2
- # Copyright:: Copyright (c) 2017 Chef Software Inc.
3
- # License:: Apache License, Version 2.0
4
- #
5
- # Licensed under the Apache License, Version 2.0 (the "License");
6
- # you may not use this file except in compliance with the License.
7
- # You may obtain a copy of the License at
8
- #
9
- # http://www.apache.org/licenses/LICENSE-2.0
10
- #
11
- # Unless required by applicable law or agreed to in writing, software
12
- # distributed under the License is distributed on an "AS IS" BASIS,
13
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- # See the License for the specific language governing permissions and
15
- # limitations under the License.
16
- #
17
-
18
- require "chef_apply/error"
19
-
20
- module ChefApply::Errors
21
- class CCRFailureMapper
22
- attr_reader :params
23
-
24
- def initialize(exception, params)
25
- @params = params
26
- @cause_line = exception
27
- end
28
-
29
- def raise_mapped_exception!
30
- if @cause_line.nil?
31
- raise RemoteChefRunFailedToResolveError.new(params[:failed_report_path])
32
- else
33
- errid, *args = exception_args_from_cause()
34
- if errid.nil?
35
- raise RemoteChefClientRunFailedUnknownReason.new()
36
- else
37
- raise RemoteChefClientRunFailed.new(errid, *args)
38
- end
39
-
40
- end
41
- end
42
-
43
- # Ideally we will write a custom handler to package up data we care
44
- # about and present it more directly https://docs.chef.io/handlers.html
45
- # For now, we'll just match the most common failures based on their
46
- # messages.
47
- def exception_args_from_cause
48
- # Ordering is important below. Some earlier tests are more detailed
49
- # cases of things that will match more general tests further down.
50
- case @cause_line
51
- when /.*had an error:(.*:)\s+(.*$)/
52
- # Some invalid property value cases, among others.
53
- ["CHEFCCR002", $2]
54
- when /.*Chef::Exceptions::ValidationFailed:\s+Option action must be equal to one of:\s+(.*)!\s+You passed :(.*)\./
55
- # Invalid action - specialization of invalid property value, below
56
- ["CHEFCCR003", $2, $1]
57
- when /.*Chef::Exceptions::ValidationFailed:\s+(.*)/
58
- # Invalid resource property value
59
- ["CHEFCCR004", $1]
60
- when /.*NameError: undefined local variable or method `(.+)' for cookbook.+/
61
- # Invalid resource type in most cases
62
- ["CHEFCCR005", $1]
63
- when /.*NoMethodError: undefined method `(.+)' for cookbook.+/
64
- # Invalid resource type in most cases
65
- ["CHEFCCR005", $1]
66
- when /.*undefined method `(.*)' for (.+)/
67
- # Unknown resource property
68
- ["CHEFCCR006", $1, $2]
69
-
70
- # Below would catch the general form of most errors, but the
71
- # message itself in those lines is not generally aligned
72
- # with the UX we want to provide.
73
- # when /.*Exception|Error.*:\s+(.*)/
74
- else
75
- nil
76
- end
77
- end
78
-
79
- class RemoteChefClientRunFailed < ChefApply::ErrorNoLogs
80
- def initialize(id, *args); super(id, *args); end
81
- end
82
-
83
- class RemoteChefClientRunFailedUnknownReason < ChefApply::ErrorNoStack
84
- def initialize(); super("CHEFCCR099"); end
85
- end
86
-
87
- class RemoteChefRunFailedToResolveError < ChefApply::ErrorNoStack
88
- def initialize(path); super("CHEFCCR001", path); end
89
- end
90
-
91
- end
92
-
93
- end