summaryrefslogtreecommitdiff
path: root/lib/chef/deprecation
diff options
context:
space:
mode:
authorsersut <serdar@opscode.com>2013-05-15 22:53:30 -0700
committersersut <serdar@opscode.com>2013-05-15 22:53:30 -0700
commit0bbecf0d06a7f0354b00d5bb71e0e7a9ed72de59 (patch)
tree5503d1498a0eaf0bd09e752a453ec5ed0a3bb43f /lib/chef/deprecation
parent684ecb0b689e52aa80931b3378b63c3bfd9ca90a (diff)
downloadchef-0bbecf0d06a7f0354b00d5bb71e0e7a9ed72de59.tar.gz
Deprecated methods for cookbook_file provider.
Diffstat (limited to 'lib/chef/deprecation')
-rw-r--r--lib/chef/deprecation/provider/cookbook_file.rb54
1 files changed, 54 insertions, 0 deletions
diff --git a/lib/chef/deprecation/provider/cookbook_file.rb b/lib/chef/deprecation/provider/cookbook_file.rb
new file mode 100644
index 0000000000..60fe200b89
--- /dev/null
+++ b/lib/chef/deprecation/provider/cookbook_file.rb
@@ -0,0 +1,54 @@
+#
+# Author:: Serdar Sutay (<serdar@opscode.com>)
+# Copyright:: Copyright (c) 2013 Opscode, Inc.
+# License:: Apache License, Version 2.0
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# This module contains the deprecated functions of
+# Chef::Provider::CookbookFile. These functions are refactored to different
+# components. They are frozen and will be removed in Chef 12.
+#
+
+class Chef
+ module Deprecation
+ module Provider
+ module CookbookFile
+
+ def file_cache_location
+ @file_cache_location ||= begin
+ cookbook = run_context.cookbook_collection[resource_cookbook]
+ cookbook.preferred_filename_on_disk_location(node, :files, @new_resource.source, @new_resource.path)
+ end
+ end
+
+ def resource_cookbook
+ @new_resource.cookbook || @new_resource.cookbook_name
+ end
+
+ def content_stale?
+ ( ! ::File.exist?(@new_resource.path)) || ( ! compare_content)
+ end
+
+ def backup_new_resource
+ if ::File.exists?(@new_resource.path)
+ backup @new_resource.path
+ end
+ end
+
+ end
+ end
+ end
+end