summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-10-09 18:20:01 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-10-09 18:20:01 +0000
commit4a8c5dcb03af548d48972057387fd6810bead49e (patch)
treeae7d28bc880084c759c22ab1a59a366234f5137c /lib/puppet
parenta7c88e8bc42a686f0e1b88b4473caa8a18cffea6 (diff)
downloadpuppet-4a8c5dcb03af548d48972057387fd6810bead49e.tar.gz
puppet-4a8c5dcb03af548d48972057387fd6810bead49e.tar.xz
puppet-4a8c5dcb03af548d48972057387fd6810bead49e.zip
Adding modified patch from #256 -- apt now uses "responsefile" for the preseed file. This is untested, though, since I do not know how to test it.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1753 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/parser/functions.rb2
-rwxr-xr-xlib/puppet/provider/package/apt.rb17
2 files changed, 18 insertions, 1 deletions
diff --git a/lib/puppet/parser/functions.rb b/lib/puppet/parser/functions.rb
index 96fccd7cd..75d1c9a31 100644
--- a/lib/puppet/parser/functions.rb
+++ b/lib/puppet/parser/functions.rb
@@ -12,7 +12,7 @@ module Functions
end
# Create a new function type.
- def self.newfunction(name, ftype = :statement, &block)
+ def self.newfunction(name, ftype = :statement, doc = nil, &block)
@functions ||= {}
name = symbolize(name)
diff --git a/lib/puppet/provider/package/apt.rb b/lib/puppet/provider/package/apt.rb
index b4f94fb0c..9c4478eba 100755
--- a/lib/puppet/provider/package/apt.rb
+++ b/lib/puppet/provider/package/apt.rb
@@ -6,6 +6,7 @@ Puppet::Type.type(:package).provide :apt, :parent => :dpkg do
commands :aptget => "/usr/bin/apt-get"
commands :aptcache => "/usr/bin/apt-cache"
+ commands :preseed => "/usr/bin/debconf-set-selections"
defaultfor :operatingsystem => :debian
@@ -43,6 +44,9 @@ Puppet::Type.type(:package).provide :apt, :parent => :dpkg do
# Install a package using 'apt-get'. This function needs to support
# installing a specific version.
def install
+ if @model[:responsefile]
+ self.preseed
+ end
should = @model.should(:ensure)
checkforcdrom()
@@ -88,6 +92,19 @@ Puppet::Type.type(:package).provide :apt, :parent => :dpkg do
end
end
+ #
+ # preseeds answers to dpkg-set-selection from the "responsefile"
+ #
+ def preseed
+ if response = @model[:responsefile] && FileTest.exists?(response)
+ self.info("Preseeding %s to debconf-set-selections" % response)
+
+ preseed response
+ else
+ self.info "No responsefile specified or non existant, not preseeding anything"
+ end
+ end
+
def update
self.install
end