summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Filion <gabster@lelutin.ca>2017-02-24 16:46:27 -0500
committerGabriel Filion <gabster@lelutin.ca>2017-02-24 17:00:44 -0500
commit1893f692dc430929240e5ec53480444d98055462 (patch)
tree3bc85a1dcc9ef3be7fd2b8be3034b5acda7c3541
parent38a2b7900178fa00c8dfd16481c84818d2b9a47a (diff)
make use of preseed optional and disabled by default
We currently can't use apt::package without preseeding. Also by default the preseed content is grabbed from an implicit template, which makes puppet runs fail for a non-obvious reason. To keep previous functionality, force use of seed file when using the deprecated apt::preseeded_package type.
-rw-r--r--manifests/package.pp36
-rw-r--r--manifests/preseeded_package.pp7
2 files changed, 26 insertions, 17 deletions
diff --git a/manifests/package.pp b/manifests/package.pp
index 159d693..e83ac68 100644
--- a/manifests/package.pp
+++ b/manifests/package.pp
@@ -1,22 +1,33 @@
# Install a package with a preseed file to automatically answer some questions.
define apt::package (
$ensure = 'present',
+ $use_seed = false,
+ $seedfile_template = "site_apt/${::debian_codename}/${name}.seeds",
$seedfile_content = '',
$pin = '',
$pin_priority = 1000
) {
- $seedfile = "/var/cache/local/preseeding/${name}.seeds"
- $real_seedfile_content = $seedfile_content ? {
- '' => template ( "site_apt/${::debian_codename}/${name}.seeds" ),
- default => $seedfile_content,
+ package { $name:
+ ensure => $ensure,
+ responsefile => $seedfile,
}
- file { $seedfile:
- content => $real_seedfile_content,
- mode => '0600',
- owner => 'root',
- group => 0,
+ if $use_seed {
+ $seedfile = "/var/cache/local/preseeding/${name}.seeds"
+ $real_seedfile_content = $seedfile_content ? {
+ '' => template ( $seedfile_template ),
+ default => $seedfile_content,
+ }
+
+ file { $seedfile:
+ content => $real_seedfile_content,
+ mode => '0600',
+ owner => 'root',
+ group => 0,
+ }
+
+ File[$seedfile] -> Package[$name]
}
if $pin {
@@ -25,11 +36,8 @@ define apt::package (
priority => $pin_priority,
pin => $pin,
}
- }
- package { $name:
- ensure => $ensure,
- responsefile => $seedfile,
- require => [File[$seedfile], Apt::Preferences_snippet[$name]],
+ Apt::Preferences_snippet[$name] -> Package[$name]
}
+
}
diff --git a/manifests/preseeded_package.pp b/manifests/preseeded_package.pp
index e1d1dcc..7db740f 100644
--- a/manifests/preseeded_package.pp
+++ b/manifests/preseeded_package.pp
@@ -3,9 +3,10 @@ define apt::preseeded_package (
$ensure = 'present',
$content = '',
) {
- warning('apt::preseeded_package is deprecated! you should now use apt::package instead.')
+ warning('apt::preseeded_package is deprecated! you should now use apt::package with parameter use_seed set to true instead.')
apt::package { $name:
- ensure => $ensure,
- content => $content,
+ ensure => $ensure,
+ use_seed => true,
+ content => $content,
}
}