diff options
author | Pete Higgins <pete@peterhiggins.org> | 2020-06-23 11:30:20 -0700 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-06-23 23:02:29 -0700 |
commit | 9a898a22d91b9a83919c03d03331acd463328d4d (patch) | |
tree | 396ab93dbb4695e461149a8ab613cc26605be443 | |
parent | 83913b37494ba45224a1d9ab8b294358d0217a05 (diff) | |
download | chef-9a898a22d91b9a83919c03d03331acd463328d4d.tar.gz |
Inline some constants to prevent redefenition warnings in tests.
Prevents these warnings:
/Users/pete/work/chef/lib/chef/knife/cookbook_upload.rb:26: warning:
already initialized constant Chef::Knife::CookbookUpload::CHECKSUM
/Users/pete/work/chef/lib/chef/knife/cookbook_upload.rb:26: warning:
previous definition of CHECKSUM was here
/Users/pete/work/chef/lib/chef/knife/cookbook_upload.rb:27: warning:
already initialized constant Chef::Knife::CookbookUpload::MATCH_CHECKSUM
/Users/pete/work/chef/lib/chef/knife/cookbook_upload.rb:27: warning:
previous definition of MATCH_CHECKSUM was here
Signed-off-by: Pete Higgins <pete@peterhiggins.org>
-rw-r--r-- | lib/chef/knife/cookbook_upload.rb | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/chef/knife/cookbook_upload.rb b/lib/chef/knife/cookbook_upload.rb index 1e5965f885..14e8419bec 100644 --- a/lib/chef/knife/cookbook_upload.rb +++ b/lib/chef/knife/cookbook_upload.rb @@ -23,9 +23,6 @@ require_relative "../knife" class Chef class Knife class CookbookUpload < Knife - CHECKSUM = "checksum".freeze - MATCH_CHECKSUM = /[0-9a-f]{32,}/.freeze - deps do require_relative "../mixin/file_class" include Chef::Mixin::FileClass @@ -245,7 +242,7 @@ class Chef # manifest object, but the manifest becomes invalid when you # regenerate the metadata broken_files = cookbook.dup.manifest_records_by_path.select do |path, info| - info[CHECKSUM].nil? || info[CHECKSUM] !~ MATCH_CHECKSUM + !/[0-9a-f]{32,}/.match?(info["checksum"]) end unless broken_files.empty? broken_filenames = Array(broken_files).map { |path, info| path } |