summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChulki Lee <chulki@asperasoft.com>2014-03-11 13:22:14 -0700
committerBryan McLellan <btm@getchef.com>2014-06-05 13:08:21 -0700
commit4ec86064ac88c1357e65dabc18a6860c6f499d13 (patch)
treef15a03f2d50f575d55c4518d63b447ba1e6bdaa3
parentac668fa85a3825489a41bad18f1908d0ff1e3662 (diff)
downloadchef-4ec86064ac88c1357e65dabc18a6860c6f499d13.tar.gz
Raise exception when using apt package with source
-rw-r--r--lib/chef/provider/package/apt.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/chef/provider/package/apt.rb b/lib/chef/provider/package/apt.rb
index dc7b3f2086..98534a4d01 100644
--- a/lib/chef/provider/package/apt.rb
+++ b/lib/chef/provider/package/apt.rb
@@ -37,6 +37,15 @@ class Chef
@current_resource
end
+ def define_resource_requirements
+ super
+
+ requirements.assert(:all_actions) do |a|
+ a.assertion { !@new_resource.source }
+ a.failure_message(Chef::Exceptions::Package, 'apt package provider cannot handle source attribute. Use dpkg provider instead')
+ end
+ end
+
def default_release_options
# Use apt::Default-Release option only if provider was explicitly defined
"-o APT::Default-Release=#{@new_resource.default_release}" if @new_resource.provider && @new_resource.default_release