summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2020-01-27 12:09:02 -0800
committerGitHub <noreply@github.com>2020-01-27 12:09:02 -0800
commitdcca8e79144a18689e93a303508f8a301e9d71c9 (patch)
tree8026daa9144c8385247fa30a26a3435d989a7d87
parent07a2e4973c947c83e61f942039e062e1b763a94a (diff)
parent53323547cbde709da0c1fe7e58bd431ff48370de (diff)
downloadchef-dcca8e79144a18689e93a303508f8a301e9d71c9.tar.gz
Merge pull request #9283 from chef/lcg/backport-15
Chef 15 backport of #9281 and #9274
-rw-r--r--lib/chef/cookbook/cookbook_version_loader.rb4
-rw-r--r--lib/chef/cookbook_uploader.rb2
-rw-r--r--spec/unit/cookbook/cookbook_version_loader_spec.rb9
3 files changed, 9 insertions, 6 deletions
diff --git a/lib/chef/cookbook/cookbook_version_loader.rb b/lib/chef/cookbook/cookbook_version_loader.rb
index cf7bff1ff8..2c4fe6db41 100644
--- a/lib/chef/cookbook/cookbook_version_loader.rb
+++ b/lib/chef/cookbook/cookbook_version_loader.rb
@@ -82,7 +82,7 @@ class Chef
end
def load
- Chef::Log.warn "Chef::Cookbook::CookbookVersionLoader's load method is deprecated. Please use load! instead."
+ Chef.deprecated(:internal_api, "Chef::Cookbook::CookbookVersionLoader's load method is deprecated. Please use load! instead.")
metadata # force lazy evaluation to occur
# re-raise any exception that occurred when reading the metadata
@@ -93,7 +93,7 @@ class Chef
remove_ignored_files
if empty?
- raise Exceptions::CookbookNotFoundInRepo, "The directory #{cookbook_path} does not contain a cookbook"
+ Chef::Log.warn "Found a directory #{cookbook_name} in the cookbook path, but it contains no cookbook files. skipping."
end
cookbook_settings
diff --git a/lib/chef/cookbook_uploader.rb b/lib/chef/cookbook_uploader.rb
index b9d4bfe5d1..816cbf95fe 100644
--- a/lib/chef/cookbook_uploader.rb
+++ b/lib/chef/cookbook_uploader.rb
@@ -47,7 +47,7 @@ class Chef
def upload_cookbooks
# Syntax Check
- validate_cookbooks
+ validate_cookbooks unless opts[:skip_syntax_check]
# generate checksums of cookbook files and create a sandbox
checksum_files = {}
cookbooks.each do |cb|
diff --git a/spec/unit/cookbook/cookbook_version_loader_spec.rb b/spec/unit/cookbook/cookbook_version_loader_spec.rb
index 518ffa7d2d..b1c2a46827 100644
--- a/spec/unit/cookbook/cookbook_version_loader_spec.rb
+++ b/spec/unit/cookbook/cookbook_version_loader_spec.rb
@@ -1,6 +1,6 @@
#
# Author:: Daniel DeLeo (<dan@chef.io>)
-# Copyright:: Copyright 2014-2018, Chef Software Inc.
+# Copyright:: Copyright 2014-2020, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -124,8 +124,9 @@ describe Chef::Cookbook::CookbookVersionLoader do
expect { cookbook_loader.load! }.to raise_error(Chef::Exceptions::CookbookNotFoundInRepo)
end
- it "gives deprecation warning called with #load and raise error for Cookbook not found" do
- expect { cookbook_loader.load }.to raise_error(Chef::Exceptions::CookbookNotFoundInRepo)
+ it "gives deprecation warning called with #load" do
+ Chef::Config[:treat_deprecation_warnings_as_errors] = false
+ cookbook_loader.load
end
end
@@ -149,6 +150,7 @@ describe Chef::Cookbook::CookbookVersionLoader do
end
it "gives deprecation warning to us load! when called with #load and raises error" do
+ Chef::Config[:treat_deprecation_warnings_as_errors] = false
expect { cookbook_loader.load }.to raise_error("THIS METADATA HAS A BUG")
end
@@ -181,6 +183,7 @@ describe Chef::Cookbook::CookbookVersionLoader do
end
it "gives deprecation warning to use load! method when called with #load and raises error for invalid metadata" do
+ Chef::Config[:treat_deprecation_warnings_as_errors] = false
expect { cookbook_loader.load }.to raise_error(Chef::Exceptions::MetadataNotValid, error_message)
end