chef-dk 3.3.23 → 3.4.38

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 (100) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +7 -7
  3. data/Gemfile.lock +91 -82
  4. data/lib/chef-dk/cli.rb +13 -13
  5. data/lib/chef-dk/command/base.rb +8 -8
  6. data/lib/chef-dk/command/clean_policy_cookbooks.rb +10 -10
  7. data/lib/chef-dk/command/clean_policy_revisions.rb +9 -9
  8. data/lib/chef-dk/command/delete_policy.rb +9 -9
  9. data/lib/chef-dk/command/delete_policy_group.rb +9 -9
  10. data/lib/chef-dk/command/diff.rb +35 -35
  11. data/lib/chef-dk/command/export.rb +11 -11
  12. data/lib/chef-dk/command/generate.rb +3 -3
  13. data/lib/chef-dk/command/generator_commands.rb +24 -24
  14. data/lib/chef-dk/command/generator_commands/build_cookbook.rb +3 -3
  15. data/lib/chef-dk/command/generator_commands/chef_exts/generator_desc_resource.rb +1 -1
  16. data/lib/chef-dk/command/generator_commands/cookbook.rb +3 -3
  17. data/lib/chef-dk/command/generator_commands/cookbook_file.rb +3 -3
  18. data/lib/chef-dk/command/generator_commands/generator_generator.rb +5 -5
  19. data/lib/chef-dk/command/generator_commands/template.rb +3 -3
  20. data/lib/chef-dk/command/install.rb +11 -11
  21. data/lib/chef-dk/command/provision.rb +32 -32
  22. data/lib/chef-dk/command/push.rb +9 -9
  23. data/lib/chef-dk/command/push_archive.rb +9 -9
  24. data/lib/chef-dk/command/shell_init.rb +21 -21
  25. data/lib/chef-dk/command/show_policy.rb +11 -11
  26. data/lib/chef-dk/command/undelete.rb +17 -17
  27. data/lib/chef-dk/command/update.rb +12 -12
  28. data/lib/chef-dk/command/verify.rb +63 -63
  29. data/lib/chef-dk/component_test.rb +3 -3
  30. data/lib/chef-dk/exceptions.rb +5 -5
  31. data/lib/chef-dk/generator.rb +61 -61
  32. data/lib/chef-dk/helpers.rb +1 -1
  33. data/lib/chef-dk/policyfile/cookbook_location_specification.rb +1 -1
  34. data/lib/chef-dk/policyfile/cookbook_locks.rb +1 -1
  35. data/lib/chef-dk/policyfile/git_lock_fetcher.rb +7 -7
  36. data/lib/chef-dk/policyfile/policyfile_location_specification.rb +1 -1
  37. data/lib/chef-dk/policyfile/uploader.rb +4 -4
  38. data/lib/chef-dk/policyfile_compiler.rb +1 -1
  39. data/lib/chef-dk/policyfile_services/export_repo.rb +49 -49
  40. data/lib/chef-dk/policyfile_services/install.rb +3 -3
  41. data/lib/chef-dk/policyfile_services/push_archive.rb +5 -5
  42. data/lib/chef-dk/policyfile_services/rm_policy_group.rb +1 -1
  43. data/lib/chef-dk/policyfile_services/update_attributes.rb +2 -2
  44. data/lib/chef-dk/service_exception_inspectors/http.rb +9 -9
  45. data/lib/chef-dk/skeletons/code_generator/recipes/recipe.rb +6 -6
  46. data/lib/chef-dk/version.rb +1 -1
  47. data/lib/kitchen/provisioner/policyfile_zero.rb +9 -9
  48. data/omnibus_overrides.rb +1 -1
  49. data/spec/spec_helper.rb +3 -3
  50. data/spec/unit/cli_spec.rb +9 -9
  51. data/spec/unit/command/base_spec.rb +25 -25
  52. data/spec/unit/command/clean_policy_cookbooks_spec.rb +6 -6
  53. data/spec/unit/command/clean_policy_revisions_spec.rb +6 -6
  54. data/spec/unit/command/delete_policy_group_spec.rb +6 -6
  55. data/spec/unit/command/delete_policy_spec.rb +6 -6
  56. data/spec/unit/command/export_spec.rb +10 -10
  57. data/spec/unit/command/generate_spec.rb +5 -5
  58. data/spec/unit/command/generator_commands/build_cookbook_spec.rb +15 -15
  59. data/spec/unit/command/generator_commands/cookbook_spec.rb +174 -174
  60. data/spec/unit/command/generator_commands/generator_generator_spec.rb +5 -5
  61. data/spec/unit/command/generator_commands/policyfile_spec.rb +15 -15
  62. data/spec/unit/command/generator_commands/repo_spec.rb +16 -16
  63. data/spec/unit/command/install_spec.rb +15 -15
  64. data/spec/unit/command/provision_spec.rb +25 -25
  65. data/spec/unit/command/push_spec.rb +12 -12
  66. data/spec/unit/command/shell_init_spec.rb +59 -59
  67. data/spec/unit/command/show_policy_spec.rb +6 -6
  68. data/spec/unit/command/undelete_spec.rb +6 -6
  69. data/spec/unit/command/update_spec.rb +30 -30
  70. data/spec/unit/fixtures/command/cli_test_command.rb +1 -1
  71. data/spec/unit/policyfile/chef_server_lock_fetcher_spec.rb +41 -41
  72. data/spec/unit/policyfile/comparison_base_spec.rb +38 -38
  73. data/spec/unit/policyfile/cookbook_locks_spec.rb +3 -3
  74. data/spec/unit/policyfile/differ_spec.rb +361 -361
  75. data/spec/unit/policyfile/git_lock_fetcher_spec.rb +34 -34
  76. data/spec/unit/policyfile/included_policies_cookbook_source_spec.rb +6 -6
  77. data/spec/unit/policyfile/local_lock_fetcher_spec.rb +35 -35
  78. data/spec/unit/policyfile/lock_applier_spec.rb +6 -6
  79. data/spec/unit/policyfile/reports/upload_spec.rb +5 -5
  80. data/spec/unit/policyfile/uploader_spec.rb +27 -27
  81. data/spec/unit/policyfile_demands_spec.rb +84 -84
  82. data/spec/unit/policyfile_evaluation_spec.rb +14 -14
  83. data/spec/unit/policyfile_includes_spec.rb +1 -1
  84. data/spec/unit/policyfile_install_with_includes_spec.rb +3 -3
  85. data/spec/unit/policyfile_lock_build_spec.rb +58 -58
  86. data/spec/unit/policyfile_lock_validation_spec.rb +108 -108
  87. data/spec/unit/policyfile_services/clean_policies_spec.rb +12 -12
  88. data/spec/unit/policyfile_services/clean_policy_cookbooks_spec.rb +9 -9
  89. data/spec/unit/policyfile_services/export_repo_spec.rb +64 -64
  90. data/spec/unit/policyfile_services/install_spec.rb +4 -4
  91. data/spec/unit/policyfile_services/push_archive_spec.rb +41 -41
  92. data/spec/unit/policyfile_services/push_spec.rb +38 -38
  93. data/spec/unit/policyfile_services/rm_policy_group_spec.rb +12 -12
  94. data/spec/unit/policyfile_services/rm_policy_spec.rb +6 -6
  95. data/spec/unit/policyfile_services/show_policy_spec.rb +161 -161
  96. data/spec/unit/policyfile_services/undelete_spec.rb +13 -13
  97. data/spec/unit/policyfile_services/update_attributes_spec.rb +6 -6
  98. data/spec/unit/policyfile_services/update_spec.rb +7 -7
  99. data/spec/unit/service_exception_inspectors/http_spec.rb +12 -12
  100. metadata +2 -2
@@ -176,13 +176,13 @@ module ChefDK
176
176
 
177
177
  def default_command_options
178
178
  {
179
- :cwd => component_path,
180
- :env => {
179
+ cwd: component_path,
180
+ env: {
181
181
  # Add the embedded/bin to the PATH so that bundle executable can
182
182
  # be found while running the tests.
183
183
  path_variable_key => omnibus_path,
184
184
  },
185
- :timeout => 3600,
185
+ timeout: 3600,
186
186
  }
187
187
  end
188
188
 
@@ -128,12 +128,12 @@ module ChefDK
128
128
  def resolution_message(overlapping_cookbooks)
129
129
  example_source = cookbook_sources.first
130
130
  source_key, location = example_source.default_source_args
131
- <<-EXAMPLE
132
- You can set a preferred source to resolve this issue with code like:
131
+ <<~EXAMPLE
132
+ You can set a preferred source to resolve this issue with code like:
133
133
 
134
- default_source :#{source_key}, "#{location}" do |s|
135
- s.preferred_for "#{overlapping_cookbooks.join('", "')}"
136
- end
134
+ default_source :#{source_key}, "#{location}" do |s|
135
+ s.preferred_for "#{overlapping_cookbooks.join('", "')}"
136
+ end
137
137
  EXAMPLE
138
138
  end
139
139
 
@@ -75,79 +75,79 @@ module ChefDK
75
75
  when "all_rights", "none"
76
76
  result = "Copyright:: #{year}, #{copyright_holder}, All Rights Reserved."
77
77
  when "apachev2"
78
- result = <<-EOH
79
- Copyright:: #{year}, #{copyright_holder}
78
+ result = <<~EOH
79
+ Copyright:: #{year}, #{copyright_holder}
80
80
 
81
- Licensed under the Apache License, Version 2.0 (the "License");
82
- you may not use this file except in compliance with the License.
83
- You may obtain a copy of the License at
81
+ Licensed under the Apache License, Version 2.0 (the "License");
82
+ you may not use this file except in compliance with the License.
83
+ You may obtain a copy of the License at
84
84
 
85
- http://www.apache.org/licenses/LICENSE-2.0
85
+ http://www.apache.org/licenses/LICENSE-2.0
86
86
 
87
- Unless required by applicable law or agreed to in writing, software
88
- distributed under the License is distributed on an "AS IS" BASIS,
89
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
90
- See the License for the specific language governing permissions and
91
- limitations under the License.
87
+ Unless required by applicable law or agreed to in writing, software
88
+ distributed under the License is distributed on an "AS IS" BASIS,
89
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
90
+ See the License for the specific language governing permissions and
91
+ limitations under the License.
92
92
  EOH
93
93
  when "mit"
94
- result = <<-EOH
95
- The MIT License (MIT)
96
-
97
- Copyright:: #{year}, #{copyright_holder}
98
-
99
- Permission is hereby granted, free of charge, to any person obtaining a copy
100
- of this software and associated documentation files (the "Software"), to deal
101
- in the Software without restriction, including without limitation the rights
102
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
103
- copies of the Software, and to permit persons to whom the Software is
104
- furnished to do so, subject to the following conditions:
105
-
106
- The above copyright notice and this permission notice shall be included in
107
- all copies or substantial portions of the Software.
108
-
109
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
110
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
111
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
112
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
113
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
114
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
115
- THE SOFTWARE.
94
+ result = <<~EOH
95
+ The MIT License (MIT)
96
+
97
+ Copyright:: #{year}, #{copyright_holder}
98
+
99
+ Permission is hereby granted, free of charge, to any person obtaining a copy
100
+ of this software and associated documentation files (the "Software"), to deal
101
+ in the Software without restriction, including without limitation the rights
102
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
103
+ copies of the Software, and to permit persons to whom the Software is
104
+ furnished to do so, subject to the following conditions:
105
+
106
+ The above copyright notice and this permission notice shall be included in
107
+ all copies or substantial portions of the Software.
108
+
109
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
110
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
111
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
112
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
113
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
114
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
115
+ THE SOFTWARE.
116
116
  EOH
117
117
  when "gplv2"
118
- result = <<-EOH
119
- Copyright:: #{year}, #{copyright_holder}
120
-
121
- This program is free software; you can redistribute it and/or modify
122
- it under the terms of the GNU General Public License as published by
123
- the Free Software Foundation; either version 2 of the License, or
124
- (at your option) any later version.
125
-
126
- This program is distributed in the hope that it will be useful,
127
- but WITHOUT ANY WARRANTY; without even the implied warranty of
128
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
129
- GNU General Public License for more details.
130
-
131
- You should have received a copy of the GNU General Public License along
132
- with this program; if not, write to the Free Software Foundation, Inc.,
133
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
118
+ result = <<~EOH
119
+ Copyright:: #{year}, #{copyright_holder}
120
+
121
+ This program is free software; you can redistribute it and/or modify
122
+ it under the terms of the GNU General Public License as published by
123
+ the Free Software Foundation; either version 2 of the License, or
124
+ (at your option) any later version.
125
+
126
+ This program is distributed in the hope that it will be useful,
127
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
128
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
129
+ GNU General Public License for more details.
130
+
131
+ You should have received a copy of the GNU General Public License along
132
+ with this program; if not, write to the Free Software Foundation, Inc.,
133
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
134
134
  EOH
135
135
  when "gplv3"
136
- result = <<-EOH
137
- Copyright:: #{year}, #{copyright_holder}
136
+ result = <<~EOH
137
+ Copyright:: #{year}, #{copyright_holder}
138
138
 
139
- This program is free software: you can redistribute it and/or modify
140
- it under the terms of the GNU General Public License as published by
141
- the Free Software Foundation, either version 3 of the License, or
142
- (at your option) any later version.
139
+ This program is free software: you can redistribute it and/or modify
140
+ it under the terms of the GNU General Public License as published by
141
+ the Free Software Foundation, either version 3 of the License, or
142
+ (at your option) any later version.
143
143
 
144
- This program is distributed in the hope that it will be useful,
145
- but WITHOUT ANY WARRANTY; without even the implied warranty of
146
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
147
- GNU General Public License for more details.
144
+ This program is distributed in the hope that it will be useful,
145
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
146
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
147
+ GNU General Public License for more details.
148
148
 
149
- You should have received a copy of the GNU General Public License
150
- along with this program. If not, see <http://www.gnu.org/licenses/>.
149
+ You should have received a copy of the GNU General Public License
150
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
151
151
  EOH
152
152
  else
153
153
  raise ArgumentError, "Invalid generator.license setting: #{license}. See available licenses at https://docs.chef.io/ctl_chef.html#chef-generate-cookbook"
@@ -159,7 +159,7 @@ module ChefDK
159
159
  File.open(path, mode, &block)
160
160
  end
161
161
 
162
- #@api private
162
+ # @api private
163
163
  # This method resets all the instance variables used. It
164
164
  # should only be used for testing
165
165
  def reset!
@@ -29,7 +29,7 @@ module ChefDK
29
29
  # API contract
30
30
  include StorageConfigDelegation
31
31
 
32
- SOURCE_TYPES = [:git, :github, :path, :artifactserver, :chef_server, :chef_server_artifact, :artifactory]
32
+ SOURCE_TYPES = [:git, :github, :path, :artifactserver, :chef_server, :chef_server_artifact, :artifactory].freeze
33
33
 
34
34
  #--
35
35
  # Required by CookbookOmnifetch API contract
@@ -34,7 +34,7 @@ module ChefDK
34
34
  # Base class for CookbookLock implementations
35
35
  class CookbookLock
36
36
 
37
- REQUIRED_LOCK_DATA_KEYS = %w{version identifier dotted_decimal_identifier cache_key source_options}
37
+ REQUIRED_LOCK_DATA_KEYS = %w{version identifier dotted_decimal_identifier cache_key source_options}.freeze
38
38
  REQUIRED_LOCK_DATA_KEYS.each(&:freeze)
39
39
  REQUIRED_LOCK_DATA_KEYS.freeze
40
40
 
@@ -105,15 +105,15 @@ module ChefDK
105
105
  def lock_data
106
106
  @lock_data ||= fetch_lock_data.tap do |data|
107
107
  data["cookbook_locks"].each do |cookbook_name, cookbook_lock|
108
- if cookbook_lock["source_options"].has_key?("path")
108
+ if cookbook_lock["source_options"].key?("path")
109
109
  cookbook_lock["source_options"].tap do |opt|
110
- opt["git"] = uri unless opt.has_key?("git")
111
- opt["revision"] = revision unless opt.has_key?("revision")
112
- opt["branch"] = branch unless opt.has_key?("branch") || branch.nil?
113
- opt["tag"] = tag unless opt.has_key?("tag") || branch.nil?
114
- opt["ref"] = ref unless opt.has_key?("ref") || ref.nil?
110
+ opt["git"] = uri unless opt.key?("git")
111
+ opt["revision"] = revision unless opt.key?("revision")
112
+ opt["branch"] = branch unless opt.key?("branch") || branch.nil?
113
+ opt["tag"] = tag unless opt.key?("tag") || branch.nil?
114
+ opt["ref"] = ref unless opt.key?("ref") || ref.nil?
115
115
 
116
- path_keys = %w{path rel}.map { |path_key| path_key if opt.has_key?(path_key) }.compact
116
+ path_keys = %w{path rel}.map { |path_key| path_key if opt.key?(path_key) }.compact
117
117
 
118
118
  path_keys.each do |name|
119
119
  # We can safely grab the entire cookbook when the Policyfile defines a cookbook path of itself (".")
@@ -37,7 +37,7 @@ module ChefDK
37
37
  attr_reader :chef_config
38
38
  attr_reader :ui
39
39
 
40
- LOCATION_TYPES = [:path, :server, :git]
40
+ LOCATION_TYPES = [:path, :server, :git].freeze
41
41
 
42
42
  # Initialize a location spec
43
43
  #
@@ -53,10 +53,10 @@ module ChefDK
53
53
  ui.msg("Uploading policy #{policy_name} (#{short_revision_id}) to policy group #{policy_group}")
54
54
 
55
55
  if !using_policy_document_native_api?
56
- ui.msg(<<-DRAGONS)
57
- WARN: Uploading policy to policy group #{policy_group} in compatibility mode.
58
- Cookbooks will be uploaded with very large version numbers, which may be picked
59
- up by existing nodes.
56
+ ui.msg(<<~DRAGONS)
57
+ WARN: Uploading policy to policy group #{policy_group} in compatibility mode.
58
+ Cookbooks will be uploaded with very large version numbers, which may be picked
59
+ up by existing nodes.
60
60
  DRAGONS
61
61
  end
62
62
 
@@ -390,7 +390,7 @@ module ChefDK
390
390
  preferred = default_source.find { |s| s.preferred_source_for?(cookbook_name) }
391
391
  if preferred.nil?
392
392
  default_source.find do |s|
393
- s.universe_graph.has_key?(cookbook_name)
393
+ s.universe_graph.key?(cookbook_name)
394
394
  end
395
395
  else
396
396
  preferred
@@ -228,32 +228,32 @@ module ChefDK
228
228
 
229
229
  def create_client_rb
230
230
  File.open(client_rb_staging_path, "wb+") do |f|
231
- f.print( <<-CONFIG )
232
- ### Chef Client Configuration ###
233
- # The settings in this file will configure chef to apply the exported policy in
234
- # this directory. To use it, run:
235
- #
236
- # chef-client -z
237
- #
238
-
239
- policy_name '#{policy_name}'
240
- policy_group 'local'
241
-
242
- use_policyfile true
243
- policy_document_native_api true
244
-
245
- # In order to use this repo, you need a version of Chef Client and Chef Zero
246
- # that supports policyfile "native mode" APIs:
247
- current_version = Gem::Version.new(Chef::VERSION)
248
- unless Gem::Requirement.new(">= 12.7").satisfied_by?(current_version)
249
- puts("!" * 80)
250
- puts(<<-MESSAGE)
251
- This Chef Repo requires features introduced in Chef 12.7, but you are using
252
- Chef \#{Chef::VERSION}. Please upgrade to Chef 12.7 or later.
253
- MESSAGE
254
- puts("!" * 80)
255
- exit!(1)
256
- end
231
+ f.print( <<~CONFIG )
232
+ ### Chef Client Configuration ###
233
+ # The settings in this file will configure chef to apply the exported policy in
234
+ # this directory. To use it, run:
235
+ #
236
+ # chef-client -z
237
+ #
238
+
239
+ policy_name '#{policy_name}'
240
+ policy_group 'local'
241
+
242
+ use_policyfile true
243
+ policy_document_native_api true
244
+
245
+ # In order to use this repo, you need a version of Chef Client and Chef Zero
246
+ # that supports policyfile "native mode" APIs:
247
+ current_version = Gem::Version.new(Chef::VERSION)
248
+ unless Gem::Requirement.new(">= 12.7").satisfied_by?(current_version)
249
+ puts("!" * 80)
250
+ puts(<<-MESSAGE)
251
+ This Chef Repo requires features introduced in Chef 12.7, but you are using
252
+ Chef \#{Chef::VERSION}. Please upgrade to Chef 12.7 or later.
253
+ MESSAGE
254
+ puts("!" * 80)
255
+ exit!(1)
256
+ end
257
257
 
258
258
  CONFIG
259
259
  end
@@ -261,42 +261,42 @@ CONFIG
261
261
 
262
262
  def create_readme_md
263
263
  File.open(readme_staging_path, "wb+") do |f|
264
- f.print( <<-README )
265
- # Exported Chef Repository for Policy '#{policy_name}'
264
+ f.print( <<~README )
265
+ # Exported Chef Repository for Policy '#{policy_name}'
266
266
 
267
- Policy revision: #{policyfile_lock.revision_id}
267
+ Policy revision: #{policyfile_lock.revision_id}
268
268
 
269
- This directory contains all the cookbooks and configuration necessary for Chef
270
- to converge a system using this exported policy. To converge a system with the
271
- exported policy, use a privileged account to run `chef-client -z` from the
272
- directory containing the exported policy.
269
+ This directory contains all the cookbooks and configuration necessary for Chef
270
+ to converge a system using this exported policy. To converge a system with the
271
+ exported policy, use a privileged account to run `chef-client -z` from the
272
+ directory containing the exported policy.
273
273
 
274
- ## Contents:
274
+ ## Contents:
275
275
 
276
- ### Policyfile.lock.json
276
+ ### Policyfile.lock.json
277
277
 
278
- A copy of the exported policy, used by the `chef push-archive` command.
278
+ A copy of the exported policy, used by the `chef push-archive` command.
279
279
 
280
- ### .chef/config.rb
280
+ ### .chef/config.rb
281
281
 
282
- A configuration file for Chef Client. This file configures Chef Client to use
283
- the correct `policy_name` and `policy_group` for this exported repository. Chef
284
- Client will use this configuration automatically if you've set your working
285
- directory properly.
282
+ A configuration file for Chef Client. This file configures Chef Client to use
283
+ the correct `policy_name` and `policy_group` for this exported repository. Chef
284
+ Client will use this configuration automatically if you've set your working
285
+ directory properly.
286
286
 
287
- ### cookbook_artifacts/
287
+ ### cookbook_artifacts/
288
288
 
289
- All of the cookbooks required by the policy will be stored in this directory.
289
+ All of the cookbooks required by the policy will be stored in this directory.
290
290
 
291
- ### policies/
291
+ ### policies/
292
292
 
293
- A different copy of the exported policy, used by the `chef-client` command.
293
+ A different copy of the exported policy, used by the `chef-client` command.
294
294
 
295
- ### policy_groups/
295
+ ### policy_groups/
296
296
 
297
- Policy groups are used by Chef Server to manage multiple revisions of the same
298
- policy. However, exported policies contain only a single policy revision, so
299
- this policy group name is hardcoded to "local" and should not be changed.
297
+ Policy groups are used by Chef Server to manage multiple revisions of the same
298
+ policy. However, exported policies contain only a single policy revision, so
299
+ this policy group name is hardcoded to "local" and should not be changed.
300
300
 
301
301
  README
302
302
  end
@@ -145,9 +145,9 @@ module ChefDK
145
145
  end
146
146
 
147
147
  def prepare_constraints_for_policies
148
- Policyfile::LockApplier.
149
- new(policyfile_lock, policyfile_compiler).
150
- apply!
148
+ Policyfile::LockApplier
149
+ .new(policyfile_lock, policyfile_compiler)
150
+ .apply!
151
151
  end
152
152
 
153
153
  def install_from_lock
@@ -86,12 +86,12 @@ module ChefDK
86
86
  policyfile_lock_path = File.join(staging_dir, "Policyfile.lock.json")
87
87
 
88
88
  if looks_like_old_format_archive?(staging_dir)
89
- raise InvalidPolicyArchive, <<-MESSAGE
90
- This archive is in an unsupported format.
89
+ raise InvalidPolicyArchive, <<~MESSAGE
90
+ This archive is in an unsupported format.
91
91
 
92
- This archive was created with an older version of ChefDK. This version of
93
- ChefDK does not support archives in the older format. Re-create the archive
94
- with a newer version of ChefDK or downgrade ChefDK.
92
+ This archive was created with an older version of ChefDK. This version of
93
+ ChefDK does not support archives in the older format. Re-create the archive
94
+ with a newer version of ChefDK or downgrade ChefDK.
95
95
  MESSAGE
96
96
  end
97
97
 
@@ -52,7 +52,7 @@ module ChefDK
52
52
  undo_record.description = "delete-policy-group #{policy_group}"
53
53
  policy_group_list = http_client.get("/policy_groups")
54
54
 
55
- unless policy_group_list.has_key?(policy_group)
55
+ unless policy_group_list.key?(policy_group)
56
56
  ui.err("Policy group '#{policy_group}' does not exist on the server")
57
57
  return false
58
58
  end
@@ -102,8 +102,8 @@ module ChefDK
102
102
  end
103
103
 
104
104
  def prepare_constraints
105
- Policyfile::LockApplier.new(policyfile_lock, policyfile_compiler).
106
- apply!
105
+ Policyfile::LockApplier.new(policyfile_lock, policyfile_compiler)
106
+ .apply!
107
107
  end
108
108
  end
109
109
  end
@@ -32,17 +32,17 @@ module ChefDK
32
32
  end
33
33
 
34
34
  def extended_error_info
35
- <<-END
36
- --- REQUEST DATA ----
37
- #{http_method} #{uri}
38
- #{request_headers}
39
- #{req_body}
35
+ <<~END
36
+ --- REQUEST DATA ----
37
+ #{http_method} #{uri}
38
+ #{request_headers}
39
+ #{req_body}
40
40
 
41
- --- RESPONSE DATA ---
42
- #{code} #{response_message}
43
- #{response_headers}
41
+ --- RESPONSE DATA ---
42
+ #{code} #{response_message}
43
+ #{response_headers}
44
44
 
45
- #{response_body}
45
+ #{response_body}
46
46
 
47
47
  END
48
48
  end