chef 16.1.0 → 16.1.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +15 -1
  3. data/lib/chef/chef_fs/file_system/chef_server/acls_dir.rb +1 -1
  4. data/lib/chef/chef_fs/file_system/chef_server/cookbook_file.rb +1 -1
  5. data/lib/chef/chef_fs/file_system/repository/directory.rb +1 -1
  6. data/lib/chef/chef_fs/parallelizer/parallel_enumerable.rb +1 -1
  7. data/lib/chef/chef_fs/path_utils.rb +3 -3
  8. data/lib/chef/cookbook/file_system_file_vendor.rb +1 -1
  9. data/lib/chef/cookbook/metadata.rb +1 -1
  10. data/lib/chef/cookbook_loader.rb +1 -1
  11. data/lib/chef/cookbook_manifest.rb +1 -1
  12. data/lib/chef/cookbook_site_streaming_uploader.rb +1 -1
  13. data/lib/chef/cookbook_version.rb +2 -2
  14. data/lib/chef/data_collector.rb +1 -1
  15. data/lib/chef/data_collector/error_handlers.rb +1 -1
  16. data/lib/chef/decorator/lazy_array.rb +2 -2
  17. data/lib/chef/digester.rb +4 -4
  18. data/lib/chef/dsl/declare_resource.rb +1 -1
  19. data/lib/chef/encrypted_data_bag_item/decryptor.rb +1 -1
  20. data/lib/chef/encrypted_data_bag_item/encryptor.rb +1 -1
  21. data/lib/chef/formatters/base.rb +1 -1
  22. data/lib/chef/http.rb +1 -1
  23. data/lib/chef/http/decompressor.rb +1 -1
  24. data/lib/chef/json_compat.rb +1 -1
  25. data/lib/chef/key.rb +1 -1
  26. data/lib/chef/knife.rb +1 -1
  27. data/lib/chef/knife/bootstrap.rb +5 -5
  28. data/lib/chef/knife/bootstrap/chef_vault_handler.rb +1 -1
  29. data/lib/chef/knife/bootstrap/client_builder.rb +1 -1
  30. data/lib/chef/knife/bootstrap/templates/windows-chef-client-msi.erb +3 -1
  31. data/lib/chef/knife/core/hashed_command_loader.rb +1 -1
  32. data/lib/chef/knife/core/node_presenter.rb +1 -1
  33. data/lib/chef/knife/core/status_presenter.rb +1 -1
  34. data/lib/chef/knife/core/subcommand_loader.rb +1 -1
  35. data/lib/chef/knife/core/windows_bootstrap_context.rb +18 -3
  36. data/lib/chef/knife/key_create_base.rb +1 -1
  37. data/lib/chef/knife/key_edit_base.rb +1 -1
  38. data/lib/chef/knife/ssh.rb +1 -1
  39. data/lib/chef/mixin/api_version_request_handling.rb +1 -1
  40. data/lib/chef/mixin/checksum.rb +0 -1
  41. data/lib/chef/mixin/openssl_helper.rb +4 -4
  42. data/lib/chef/mixin/properties.rb +2 -2
  43. data/lib/chef/mixin/shell_out.rb +1 -1
  44. data/lib/chef/node/attribute.rb +2 -2
  45. data/lib/chef/node/immutable_collections.rb +1 -1
  46. data/lib/chef/policy_builder/policyfile.rb +1 -1
  47. data/lib/chef/property.rb +2 -2
  48. data/lib/chef/provider.rb +3 -3
  49. data/lib/chef/provider/directory.rb +1 -1
  50. data/lib/chef/provider/file.rb +1 -1
  51. data/lib/chef/provider/package/chocolatey.rb +1 -1
  52. data/lib/chef/provider/package/dpkg.rb +1 -1
  53. data/lib/chef/provider/package/portage.rb +1 -0
  54. data/lib/chef/provider/package/rubygems.rb +1 -1
  55. data/lib/chef/provider/package/windows.rb +2 -2
  56. data/lib/chef/provider/package/yum.rb +1 -1
  57. data/lib/chef/provider/package/yum/yum_cache.rb +1 -1
  58. data/lib/chef/provider/remote_directory.rb +2 -2
  59. data/lib/chef/provider/service/arch.rb +1 -1
  60. data/lib/chef/provider/service/upstart.rb +1 -1
  61. data/lib/chef/provider/user/aix.rb +1 -1
  62. data/lib/chef/provider/user/dscl.rb +2 -2
  63. data/lib/chef/provider/user/mac.rb +10 -6
  64. data/lib/chef/provider/windows_task.rb +4 -2
  65. data/lib/chef/resource.rb +3 -3
  66. data/lib/chef/resource/chef_handler.rb +2 -2
  67. data/lib/chef/resource/chef_vault_secret.rb +1 -1
  68. data/lib/chef/resource/cron.rb +1 -1
  69. data/lib/chef/resource/cron_d.rb +1 -1
  70. data/lib/chef/resource/execute.rb +1 -1
  71. data/lib/chef/resource/file.rb +10 -8
  72. data/lib/chef/resource/hostname.rb +1 -1
  73. data/lib/chef/resource/locale.rb +3 -3
  74. data/lib/chef/resource/macos_userdefaults.rb +11 -6
  75. data/lib/chef/resource/scm/git.rb +1 -1
  76. data/lib/chef/resource/windows_certificate.rb +1 -1
  77. data/lib/chef/resource/windows_dfs_server.rb +1 -1
  78. data/lib/chef/resource/windows_pagefile.rb +1 -1
  79. data/lib/chef/resource/windows_task.rb +6 -6
  80. data/lib/chef/resource/windows_user_privilege.rb +3 -3
  81. data/lib/chef/resource_inspector.rb +4 -3
  82. data/lib/chef/run_context/cookbook_compiler.rb +1 -1
  83. data/lib/chef/shell/ext.rb +1 -1
  84. data/lib/chef/version.rb +1 -1
  85. data/lib/chef/win32/api.rb +2 -2
  86. data/lib/chef/win32/api/error.rb +3 -1
  87. data/lib/chef/win32/api/file.rb +1 -1
  88. data/lib/chef/win32/api/net.rb +1 -0
  89. data/lib/chef/win32/mutex.rb +1 -1
  90. data/lib/chef/win32/net.rb +1 -0
  91. data/lib/chef/win32/security/sid.rb +4 -4
  92. data/spec/functional/resource/dnf_package_spec.rb +2 -2
  93. data/spec/functional/resource/git_spec.rb +6 -6
  94. data/spec/functional/resource/windows_task_spec.rb +4 -4
  95. data/spec/support/chef_helpers.rb +1 -1
  96. data/spec/support/shared/functional/windows_script.rb +1 -1
  97. data/spec/support/shared/unit/provider/useradd_based_user_provider.rb +4 -4
  98. data/spec/unit/knife/core/windows_bootstrap_context_spec.rb +7 -1
  99. data/spec/unit/mixin/openssl_helper_spec.rb +4 -4
  100. data/spec/unit/node/attribute_spec.rb +1 -1
  101. data/spec/unit/provider/group/groupadd_spec.rb +1 -1
  102. data/spec/unit/provider/package/portage_spec.rb +2 -2
  103. data/spec/unit/provider/package/powershell_spec.rb +1 -1
  104. data/spec/unit/win32/registry_spec.rb +1 -1
  105. metadata +6 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b138b7c33a13cb8016b0883638027a663dfd9a69b581b762905186accbf26583
4
- data.tar.gz: 718b25c47f4adb5761c915a7445a3b450f062f5f79ee3eaa8d6c5f165bf077c0
3
+ metadata.gz: 954f3cdcc1620ea83e221b545df48e0ad9b5ed578aa367b6faecd828e573e3e6
4
+ data.tar.gz: d3cd87dbbe1be501e576b4697e3a7fd609fb5df6f68163e1843a65deeaec7485
5
5
  SHA512:
6
- metadata.gz: 12485669d051d24c96a784f753d6c85a9a7b7afed6cdcf218c8dda31dc99133c26ee4e315c51f47d5868688ec3c8955eafa7e1c7fa2e63cceac370d146a41002
7
- data.tar.gz: 85a441f6ae29db6e725621182fef6e9e4fd69f6393457bfaeb4a928212e2dcb09a8e6be54808c21282fdc8dd35bd0c6c50dbfa8e1562b73fbba70f1a551ab264
6
+ metadata.gz: 4c9bd8fff2699c41b1ffbfefeff88859d3f49f06d7d7d04f4e0e7c7bd9c1bb35240c48e30f0a8448e8238393ede67bf1a72ec3061106690e3661d8d359c62caf
7
+ data.tar.gz: 45fb0813908f4c7ce52198ad4c5c274545e1edc0493fe54b37a6a08595f625a2fe41e2f0b4ceedc578fab1c3acb04f8462a2ede20e3c6a229d2860878c222c57
data/Rakefile CHANGED
@@ -58,7 +58,7 @@ namespace :pre_install do
58
58
  task all: ["pre_install:install_gems_from_dirs", "pre_install:render_powershell_extension"]
59
59
  end
60
60
 
61
- # hack in all the preinstall tasks to occur before the tradtional install task
61
+ # hack in all the preinstall tasks to occur before the traditional install task
62
62
  task install: "pre_install:all"
63
63
 
64
64
  # make sure we build the correct gemspec on windows
@@ -108,3 +108,17 @@ begin
108
108
  rescue LoadError
109
109
  puts "yard is not available. bundle install first to make sure all dependencies are installed."
110
110
  end
111
+
112
+ namespace :spellcheck do
113
+ task :run do
114
+ sh 'cspell "**/*" "*.md"'
115
+ end
116
+
117
+ desc "List the unique unrecognized words in the project."
118
+ task :unknown_words do
119
+ sh 'cspell "**/*" "*.md" --wordsOnly --no-summary | sort | uniq'
120
+ end
121
+ end
122
+
123
+ desc "Run spellcheck on the project."
124
+ task spellcheck: "spellcheck:run"
@@ -60,7 +60,7 @@ class Chef
60
60
  AclDir.new(entity_type, self)
61
61
  end
62
62
  end
63
- @children << AclEntry.new("organization.json", self, true) # the org acl is retrieved as GET /organizations/ORGNAME/ANYTHINGATALL/_acl
63
+ @children << AclEntry.new("organization.json", self, true) # the org acl is retrieved as GET /organizations/ORGNAME/ANYTHING/_acl
64
64
  end
65
65
  @children
66
66
  end
@@ -69,7 +69,7 @@ class Chef
69
69
  private
70
70
 
71
71
  def calc_checksum(value)
72
- OpenSSL::Digest::MD5.hexdigest(value)
72
+ OpenSSL::Digest.hexdigest("MD5", value)
73
73
  end
74
74
  end
75
75
  end
@@ -104,7 +104,7 @@ class Chef
104
104
  children.empty?
105
105
  end
106
106
 
107
- # Public API callied by chef_fs/file_system
107
+ # Public API called by chef_fs/file_system
108
108
  def child(name)
109
109
  possible_child = make_child_entry(name)
110
110
  if possible_child.name_valid?
@@ -235,7 +235,7 @@ class Chef
235
235
  # The order of these checks is important, as well, to be thread safe.
236
236
  # 1. If @unconsumed_input.empty? is true, then we will never have any more
237
237
  # work legitimately picked up.
238
- # 2. If @in_process == 0, then there is no work in process, and because ofwhen unconsumed_input is empty, it will never go back up, because
238
+ # 2. If @in_process == 0, then there is no work in process, and because of when unconsumed_input is empty, it will never go back up, because
239
239
  # this is called after the input enumerator is finished. Note that switching #2 and #1
240
240
  # could cause a race, because in_process is incremented *before* consuming input.
241
241
  # 3. If @unconsumed_output.empty? is true, then we are done with outputs.
@@ -71,9 +71,9 @@ class Chef
71
71
  # part that actually exists. The paths operated on here are not Chef-FS paths.
72
72
  # These are OS paths that may contain symlinks but may not also fully exist.
73
73
  #
74
- # If /x is a symlink to /blarghle, and has no subdirectories, then:
75
- # PathUtils.realest_path('/x/y/z') == '/blarghle/y/z'
76
- # PathUtils.realest_path('/x/*/z') == '/blarghle/*/z'
74
+ # If /x is a symlink to /foo_bar, and has no subdirectories, then:
75
+ # PathUtils.realest_path('/x/y/z') == '/foo_bar/y/z'
76
+ # PathUtils.realest_path('/x/*/z') == '/foo_bar/*/z'
77
77
  # PathUtils.realest_path('/*/y/z') == '/*/y/z'
78
78
  #
79
79
  # TODO: Move this to wherever util/path_helper is these days.
@@ -27,7 +27,7 @@ class Chef
27
27
  # and throws the rest away then re-builds the list of files on the
28
28
  # disk. This is due to the manifest not having the on-disk file
29
29
  # locations, since in the chef-client case, that information is
30
- # non-sensical.
30
+ # nonsensical.
31
31
  class FileSystemFileVendor < FileVendor
32
32
 
33
33
  attr_reader :cookbook_name
@@ -357,7 +357,7 @@ class Chef
357
357
  # Array<String> - array of files or globs to eagerly load, otherwise it is treated like `false`
358
358
  #
359
359
  # @params arg [Array,String,TrueClass,FalseClass]
360
- # @params [Array,TrueClass,FalseCalss]
360
+ # @params [Array,TrueClass,FalseClass]
361
361
  def eager_load_libraries(arg = nil)
362
362
  set_or_return(
363
363
  :eager_load_libraries,
@@ -138,7 +138,7 @@ class Chef
138
138
  cookbooks_by_name.values
139
139
  end
140
140
 
141
- # This method creates tmp directory and copies all cookbooks into it and creates cookbook loder object which points to tmp directory
141
+ # This method creates tmp directory and copies all cookbooks into it and creates cookbook loader object which points to tmp directory
142
142
  def self.copy_to_tmp_dir_from_array(cookbooks)
143
143
  tmp_cookbook_file = Tempfile.new("tmp_working_dir_path")
144
144
  tmp_cookbook_file.close
@@ -44,7 +44,7 @@ class Chef
44
44
  # cookbook_version in the "manifest" format, or #to_json to get a JSON
45
45
  # representation of the cookbook_version.
46
46
  #
47
- # The inferface for this behavior is expected to change as we implement new
47
+ # The interface for this behavior is expected to change as we implement new
48
48
  # manifest formats. The entire class should be considered a private API for
49
49
  # now.
50
50
  #
@@ -147,7 +147,7 @@ class Chef
147
147
  class << res
148
148
  alias :to_s :body
149
149
 
150
- # BUGBUG this makes the response compatible with what respsonse_steps expects to test headers (response.headers[] -> response[])
150
+ # BUG this makes the response compatible with what response_steps expects to test headers (response.headers[] -> response[])
151
151
  def headers # rubocop:disable Lint/NestedMethodDefinition
152
152
  self
153
153
  end
@@ -358,7 +358,7 @@ class Chef
358
358
 
359
359
  # extract the preference part from the path.
360
360
  if manifest_record_path =~ %r{(#{Regexp.escape(segment.to_s)}/[^/]+/#{Regexp.escape(dirname)})/.+$}
361
- # Note the specificy_dirname includes the segment and
361
+ # Note the specificity_dirname includes the segment and
362
362
  # dirname argument as above, which is what
363
363
  # preferences_for_path returns. It could be
364
364
  # "files/ubuntu-9.10/dirname", for example.
@@ -566,7 +566,7 @@ class Chef
566
566
  def find_preferred_manifest_record(node, segment, filename)
567
567
  preferences = preferences_for_path(node, segment, filename)
568
568
 
569
- # in order of prefernce, look for the filename in the manifest
569
+ # in order of preference, look for the filename in the manifest
570
570
  preferences.find { |preferred_filename| manifest_records_by_path[preferred_filename] }
571
571
  end
572
572
 
@@ -184,7 +184,7 @@ class Chef
184
184
  begin
185
185
  code = e&.response&.code&.to_s
186
186
  rescue
187
- # i really dont care
187
+ # i really don't care
188
188
  end
189
189
 
190
190
  code ||= "No HTTP Code"
@@ -18,7 +18,7 @@
18
18
  class Chef
19
19
  class DataCollector
20
20
 
21
- # This module isolates the handling of collecting error descriptions to insert into the data_colletor
21
+ # This module isolates the handling of collecting error descriptions to insert into the data_collector
22
22
  # report output. For very early errors it is responsible for collecting the node_name for the report
23
23
  # to use. For all failure conditions that have an ErrorMapper it collects the output.
24
24
  #
@@ -21,8 +21,8 @@ class Chef
21
21
  class Decorator
22
22
  # Lazy Array around Lazy Objects
23
23
  #
24
- # This only lazys access through `#[]`. In order to implement #each we need to
25
- # know how many items we have and what their indexes are, so we'd have to evalute
24
+ # This makes access lazy through `#[]`. In order to implement #each we need to
25
+ # know how many items we have and what their indexes are, so we'd have to evaluate
26
26
  # the proc which makes that impossible. You can call methods like #each and the
27
27
  # decorator will forward the method, but item access will not be lazy.
28
28
  #
@@ -39,9 +39,9 @@ class Chef
39
39
 
40
40
  def generate_checksum(file)
41
41
  if file.is_a?(StringIO)
42
- checksum_io(file, OpenSSL::Digest::SHA256.new)
42
+ checksum_io(file, OpenSSL::Digest.new("SHA256"))
43
43
  else
44
- checksum_file(file, OpenSSL::Digest::SHA256.new)
44
+ checksum_file(file, OpenSSL::Digest.new("SHA256"))
45
45
  end
46
46
  end
47
47
 
@@ -50,11 +50,11 @@ class Chef
50
50
  end
51
51
 
52
52
  def generate_md5_checksum_for_file(file)
53
- checksum_file(file, OpenSSL::Digest::MD5.new)
53
+ checksum_file(file, OpenSSL::Digest.new("MD5"))
54
54
  end
55
55
 
56
56
  def generate_md5_checksum(io)
57
- checksum_io(io, OpenSSL::Digest::MD5.new)
57
+ checksum_io(io, OpenSSL::Digest.new("MD5"))
58
58
  end
59
59
 
60
60
  private
@@ -151,7 +151,7 @@ class Chef
151
151
  # source "y.txt.erb"
152
152
  # variables {}
153
153
  # end
154
- # resource.variables.merge!({ home: "/home/klowns" })
154
+ # resource.variables.merge!({ home: "/home/clowns" })
155
155
  #
156
156
  def edit_resource(type, name, created_at: nil, run_context: self.run_context, &resource_attrs_block)
157
157
  edit_resource!(type, name, created_at: created_at, run_context: run_context, &resource_attrs_block)
@@ -158,7 +158,7 @@ class Chef::EncryptedDataBagItem
158
158
  d = OpenSSL::Cipher.new(algorithm)
159
159
  d.decrypt
160
160
  # We must set key before iv: https://bugs.ruby-lang.org/issues/8221
161
- d.key = OpenSSL::Digest::SHA256.digest(key)
161
+ d.key = OpenSSL::Digest.digest("SHA256", key)
162
162
  d.iv = iv
163
163
  d
164
164
  end
@@ -102,7 +102,7 @@ class Chef::EncryptedDataBagItem
102
102
  encryptor = OpenSSL::Cipher.new(algorithm)
103
103
  encryptor.encrypt
104
104
  # We must set key before iv: https://bugs.ruby-lang.org/issues/8221
105
- encryptor.key = OpenSSL::Digest::SHA256.digest(key)
105
+ encryptor.key = OpenSSL::Digest.digest("SHA256", key)
106
106
  @iv ||= encryptor.random_iv
107
107
  encryptor.iv = @iv
108
108
  encryptor
@@ -142,7 +142,7 @@ class Chef
142
142
 
143
143
  # Generic callback for any attribute/library/lwrp/recipe file in a
144
144
  # cookbook getting loaded. The per-filetype callbacks for file load are
145
- # overriden so that they call this instead. This means that a subclass of
145
+ # overridden so that they call this instead. This means that a subclass of
146
146
  # Formatters::Base can implement #file_loaded to do the same thing for
147
147
  # every kind of file that Chef loads from a recipe instead of
148
148
  # implementing all the per-filetype callbacks.
@@ -269,7 +269,7 @@ class Chef
269
269
  if keepalives && !base_url.nil?
270
270
  # only reuse the http_client if we want keepalives and have a base_url
271
271
  @http_client ||= {}
272
- # the per-host per-port cache here gets peristent connections correct when
272
+ # the per-host per-port cache here gets persistent connections correct when
273
273
  # redirecting to different servers
274
274
  if base_url.is_a?(String) # sigh, this kind of abuse can't happen with strongly typed languages
275
275
  @http_client[base_url] ||= build_http_client(base_url)
@@ -22,7 +22,7 @@ require_relative "http_request"
22
22
  class Chef
23
23
  class HTTP
24
24
 
25
- # Middleware-esque class for handling compression in HTTP responses.
25
+ # Middleware-ish class for handling compression in HTTP responses.
26
26
  class Decompressor
27
27
  class NoopInflater
28
28
  def inflate(chunk)
@@ -28,7 +28,7 @@ class Chef
28
28
 
29
29
  class <<self
30
30
 
31
- # API to use to avoid create_addtions
31
+ # API to use to avoid create_additions
32
32
  def parse(source, opts = {})
33
33
  FFI_Yajl::Parser.parse(source, opts)
34
34
  rescue FFI_Yajl::ParseError => e
@@ -252,7 +252,7 @@ class Chef
252
252
  OpenSSL::ASN1::Integer.new(openssl_key_object.public_key.n),
253
253
  OpenSSL::ASN1::Integer.new(openssl_key_object.public_key.e),
254
254
  ])
255
- OpenSSL::Digest::SHA1.hexdigest(data_string.to_der).scan(/../).join(":")
255
+ OpenSSL::Digest.hexdigest("SHA1", data_string.to_der).scan(/../).join(":")
256
256
  end
257
257
 
258
258
  def list(keys, actor, load_method_symbol, inflate)
@@ -327,7 +327,7 @@ class Chef
327
327
  end
328
328
 
329
329
  # Grab a copy before config merge occurs, so that we can later identify
330
- # whare a given config value is sourced from.
330
+ # where a given config value is sourced from.
331
331
  @original_config = config.dup
332
332
 
333
333
  # copy Mixlib::CLI over so that it can be configured in config.rb/knife.rb
@@ -94,7 +94,7 @@ class Chef
94
94
  boolean: true
95
95
 
96
96
  # This option was provided in knife bootstrap windows winrm,
97
- # but it is ignored in knife-windows/WinrmSession, and so remains unimplemeneted here.
97
+ # but it is ignored in knife-windows/WinrmSession, and so remains unimplemented here.
98
98
  # option :kerberos_keytab_file,
99
99
  # :short => "-T KEYTAB_FILE",
100
100
  # :long => "--keytab-file KEYTAB_FILE",
@@ -275,7 +275,7 @@ class Chef
275
275
  accumulator
276
276
  }
277
277
 
278
- # bootstrap override: url of a an installer shell script touse in place of omnitruck
278
+ # bootstrap override: url of a an installer shell script to use in place of omnitruck
279
279
  # Note that the bootstrap template _only_ references this out of Chef::Config, and not from
280
280
  # the provided options to knife bootstrap, so we set the Chef::Config option here.
281
281
  option :bootstrap_url,
@@ -713,7 +713,7 @@ class Chef
713
713
  # Fail if using plaintext auth without ssl because
714
714
  # this can expose keys in plaintext on the wire.
715
715
  # TODO test for this method
716
- # TODO check that the protoocol is valid.
716
+ # TODO check that the protocol is valid.
717
717
  def validate_winrm_transport_opts!
718
718
  return true unless winrm?
719
719
 
@@ -967,7 +967,7 @@ class Chef
967
967
  gw_host = split[1]
968
968
  end
969
969
  gw_host, gw_port = gw_host.split(":", 2)
970
- # TODO - validate convertable port in config validation?
970
+ # TODO - validate convertible port in config validation?
971
971
  gw_port = Integer(gw_port) rescue nil
972
972
  opts[:bastion_host] = gw_host
973
973
  opts[:bastion_user] = gw_user
@@ -1073,7 +1073,7 @@ class Chef
1073
1073
  remote_path
1074
1074
  end
1075
1075
 
1076
- # build the command string for bootrapping
1076
+ # build the command string for bootstrapping
1077
1077
  # @return String
1078
1078
  def bootstrap_command(remote_path)
1079
1079
  if connection.windows?
@@ -102,7 +102,7 @@ class Chef
102
102
  config[:bootstrap_vault_item]
103
103
  end
104
104
 
105
- # Helper to return a ruby object represeting all the data bags and items
105
+ # Helper to return a ruby object representing all the data bags and items
106
106
  # to update via chef-vault.
107
107
  #
108
108
  # @return [Hash] deserialized ruby hash with all the vault items
@@ -86,7 +86,7 @@ class Chef
86
86
  config[:chef_node_name]
87
87
  end
88
88
 
89
- # @return [String] enviroment from the config
89
+ # @return [String] environment from the config
90
90
  def environment
91
91
  config[:environment]
92
92
  end
@@ -202,10 +202,12 @@ If !ERRORLEVEL!==0 (
202
202
  ) else (
203
203
  @echo Installation completed successfully
204
204
  del /f /q "%CHEF_CLIENT_MSI_LOG_PATH%"
205
- )
205
+ )
206
206
 
207
207
  <% end %>
208
208
 
209
+ @rem This line is required to separate the key_create label from the "block boundary"
210
+ @rem Removing these lines will cause the error "The system cannot find the batch label specified - key_create"
209
211
  :key_create
210
212
  @endlocal
211
213
 
@@ -44,7 +44,7 @@ class Chef
44
44
  else
45
45
  commands = manifest[KEY]["plugins_by_category"]
46
46
  end
47
- # If any of the specified plugins in the manifest dont have a valid path we will
47
+ # If any of the specified plugins in the manifest don't have a valid path we will
48
48
  # eventually get an error and the user will need to rehash - instead, lets just
49
49
  # print out 1 error here telling them to rehash
50
50
  errors = {}
@@ -94,7 +94,7 @@ class Chef
94
94
  def summarize(data)
95
95
  if data.is_a?(Chef::Node)
96
96
  node = data
97
- # special case clouds with their split horizon whatsis.
97
+ # special case clouds with their split horizon thing.
98
98
  ip = (node[:cloud] && node[:cloud][:public_ipv4_addrs] && node[:cloud][:public_ipv4_addrs].first) || node[:ipaddress]
99
99
 
100
100
  summarized = <<~SUMMARY
@@ -95,7 +95,7 @@ class Chef
95
95
  summarized = ""
96
96
  list.each do |data|
97
97
  node = data
98
- # special case clouds with their split horizon whatsis.
98
+ # special case clouds with their split horizon thing.
99
99
  ip = (node[:cloud] && node[:cloud][:public_ipv4_addrs] && node[:cloud][:public_ipv4_addrs].first) || node[:ipaddress]
100
100
  fqdn = (node[:cloud] && node[:cloud][:public_hostname]) || node[:fqdn]
101
101
  name = node["name"] || node.name
@@ -32,7 +32,7 @@ class Chef
32
32
  # optionally filtering by category
33
33
  # subcommand_files - returns an array of all subcommand files
34
34
  # that could be loaded
35
- # commnad_class_from(args) - returns the subcommand class for the
35
+ # command_class_from(args) - returns the subcommand class for the
36
36
  # user-requested command
37
37
  #
38
38
  class SubcommandLoader
@@ -24,7 +24,7 @@ class Chef
24
24
  class Knife
25
25
  module Core
26
26
  # Instances of BootstrapContext are the context objects (i.e., +self+) for
27
- # bootstrap templates. For backwards compatability, they +must+ set the
27
+ # bootstrap templates. For backwards compatibility, they +must+ set the
28
28
  # following instance variables:
29
29
  # * @config - a hash of knife's config values
30
30
  # * @run_list - the run list for the node to boostrap
@@ -41,6 +41,21 @@ class Chef
41
41
  super(config, run_list, chef_config, secret)
42
42
  end
43
43
 
44
+ # This is a duplicate of ChefConfig::PathHelper.cleanpath, however
45
+ # this presumes Windows so we can avoid changing the method definitions
46
+ # across Chef, ChefConfig, and ChefUtils for the circumstance where
47
+ # the methods are being run for a system other than the one Ruby is
48
+ # executing on.
49
+ #
50
+ # We only need to cleanpath the paths that we are passing to cmd.exe,
51
+ # anything written to a configuration file or passed as an argument
52
+ # will be interpreted by ruby later and do the right thing.
53
+ def cleanpath(path)
54
+ path = Pathname.new(path).cleanpath.to_s
55
+ path = path.gsub(File::SEPARATOR, '\\')
56
+ path
57
+ end
58
+
44
59
  def validation_key
45
60
  if File.exist?(File.expand_path(chef_config[:validation_key]))
46
61
  IO.read(File.expand_path(chef_config[:validation_key]))
@@ -160,7 +175,7 @@ class Chef
160
175
 
161
176
  def start_chef
162
177
  bootstrap_environment_option = bootstrap_environment.nil? ? "" : " -E #{bootstrap_environment}"
163
- start_chef = "SET \"PATH=%SystemRoot%\\system32;%SystemRoot%;%SystemRoot%\\System32\\Wbem;%SYSTEMROOT%\\System32\\WindowsPowerShell\\v1.0\\;C:\\ruby\\bin;#{ChefConfig::Config.c_opscode_dir}\\#{ChefConfig::Dist::DIR_SUFFIX}\\bin;#{ChefConfig::Config.c_opscode_dir}\\#{ChefConfig::Dist::DIR_SUFFIX}\\embedded\\bin\;%PATH%\"\n"
178
+ start_chef = "SET \"PATH=%SystemRoot%\\system32;%SystemRoot%;%SystemRoot%\\System32\\Wbem;%SYSTEMROOT%\\System32\\WindowsPowerShell\\v1.0\\;C:\\ruby\\bin;#{ChefConfig::Config.c_opscode_dir}\\bin;#{ChefConfig::Config.c_opscode_dir}\\embedded\\bin\;%PATH%\"\n"
164
179
  start_chef << "#{Chef::Dist::CLIENT} -c #{ChefConfig::Config.etc_chef_dir(true)}/client.rb -j #{ChefConfig::Config.etc_chef_dir(true)}/first-boot.json#{bootstrap_environment_option}\n"
165
180
  end
166
181
 
@@ -262,7 +277,7 @@ class Chef
262
277
  end
263
278
 
264
279
  def bootstrap_directory
265
- ChefConfig::Config.etc_chef_dir(true)
280
+ cleanpath(ChefConfig::Config.etc_chef_dir(true))
266
281
  end
267
282
 
268
283
  def local_download_path