summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-10-09 18:29:44 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-10-09 18:29:44 +0000
commit94484df1a8d00e0eae35cbe09c0e5d2ff4b16f49 (patch)
treeb6d0be5d0b9762274336665016d95f95935ea00e
parent4a8c5dcb03af548d48972057387fd6810bead49e (diff)
downloadpuppet-94484df1a8d00e0eae35cbe09c0e5d2ff4b16f49.tar.gz
puppet-94484df1a8d00e0eae35cbe09c0e5d2ff4b16f49.tar.xz
puppet-94484df1a8d00e0eae35cbe09c0e5d2ff4b16f49.zip
Applying patch from #234 from David Schmitt. This is also untested, and the patch is slightly modified.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1754 980ebf18-57e1-0310-9a29-db15c13687c0
-rwxr-xr-xlib/puppet/provider/package/apt.rb15
-rw-r--r--lib/puppet/type/package.rb29
2 files changed, 43 insertions, 1 deletions
diff --git a/lib/puppet/provider/package/apt.rb b/lib/puppet/provider/package/apt.rb
index 9c4478eba..5c6dc8916 100755
--- a/lib/puppet/provider/package/apt.rb
+++ b/lib/puppet/provider/package/apt.rb
@@ -41,6 +41,8 @@ Puppet::Type.type(:package).provide :apt, :parent => :dpkg do
end
end
+ attr_accessor :keepconfig
+
# Install a package using 'apt-get'. This function needs to support
# installing a specific version.
def install
@@ -59,7 +61,18 @@ Puppet::Type.type(:package).provide :apt, :parent => :dpkg do
# Add the package version
str += "=%s" % should
end
- aptcmd("-q -y install %s" % str)
+
+ keep = ""
+ if defined? @keepconfig
+ case @keepconfig
+ when true
+ keep = "-o 'DPkg::Options::=--force-confold'"
+ else
+ keep = "-o 'DPkg::Options::=--force-confnew'"
+ end
+ end
+
+ aptcmd("-q -y %s install %s" % [keep, str])
end
# What's the latest package version available?
diff --git a/lib/puppet/type/package.rb b/lib/puppet/type/package.rb
index 749c9e76a..47b6331ea 100644
--- a/lib/puppet/type/package.rb
+++ b/lib/puppet/type/package.rb
@@ -242,6 +242,35 @@ module Puppet
generally be a fully qualified path."
end
+ newparam(:configfiles) do
+ desc "Whether configfiles should be kept or replaced. Most packages
+ types do not support this parameter, but those that do will default
+ to keeping their configuration files."
+
+ unless provider.respond_to?(:keepconfig=)
+ self.fail(
+ "Package provider %s does not support keeping the configuration files" %
+ @parent[:provider]
+ )
+ end
+
+ # There is only a default for those that support this parameter.
+ defaultto do
+ if provider.respond_to?(:keepconfig)
+ :keep
+ else
+ nil
+ end
+ end
+
+ newvalue(:keep) do
+ provider.keepconfig = true
+ end
+ newvalue(:replace) do
+ provider.keepconfig = false
+ end
+ end
+
newparam(:category) do
desc "A read-only parameter set by the package."
end