From 96279c91c29f895039dd1909f195f9f146b4d031 Mon Sep 17 00:00:00 2001 From: Mark Keisler Date: Tue, 25 Oct 2016 09:10:28 -0500 Subject: [PATCH] avoid CHEF-3694 in apt_preferences resaource Signed-off-by: Mark Keisler --- metadata.rb | 2 +- providers/preference.rb | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/metadata.rb b/metadata.rb index 3c57bd2c..47980baa 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Configures apt and apt services. Ships resources for managing apt repositories' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '5.0.0' +version '5.0.1' recipe 'apt::default', 'Runs apt-get update during compile phase and sets up preseed directories' recipe 'apt::cacher-ng', 'Set up an apt-cacher-ng caching proxy' diff --git a/providers/preference.rb b/providers/preference.rb index 0cef52f4..587e5bae 100644 --- a/providers/preference.rb +++ b/providers/preference.rb @@ -49,7 +49,8 @@ def safe_name(name) name = safe_name(new_resource.name) - file "/etc/apt/preferences.d/#{new_resource.name}.pref" do + file "cleanup_#{new_resource.name}.pref" do + path "/etc/apt/preferences.d/#{new_resource.name}.pref" action :delete if ::File.exist?("/etc/apt/preferences.d/#{new_resource.name}.pref") Chef::Log.warn "Replacing #{new_resource.name}.pref with #{name}.pref in /etc/apt/preferences.d/" @@ -57,7 +58,8 @@ def safe_name(name) only_if { name != new_resource.name } end - file "/etc/apt/preferences.d/#{new_resource.name}" do + file "cleanup_#{new_resource.name}" do + path "/etc/apt/preferences.d/#{new_resource.name}" action :delete if ::File.exist?("/etc/apt/preferences.d/#{new_resource.name}") Chef::Log.warn "Replacing #{new_resource.name} with #{new_resource.name}.pref in /etc/apt/preferences.d/" @@ -77,7 +79,8 @@ def safe_name(name) name = safe_name(new_resource.name) if ::File.exist?("/etc/apt/preferences.d/#{name}.pref") Chef::Log.info "Un-pinning #{name} from /etc/apt/preferences.d/" - file "/etc/apt/preferences.d/#{name}.pref" do + file "remove_#{name}.pref" do + path "/etc/apt/preferences.d/#{name}.pref" action :delete end end