From dfbfc7a05f7ac6713b4ac1379cfb6e2cefa85093 Mon Sep 17 00:00:00 2001 From: Gabriel Filion Date: Fri, 24 Feb 2017 13:03:59 -0500 Subject: rename preseeded_package into package keep a wrapper in place with a deprecation notice for the old name so that ppl can know about the change and migrate to the new name --- README.md | 11 +++++++---- manifests/package.pp | 25 +++++++++++++++++++++++++ manifests/preseeded_package.pp | 25 +++++-------------------- 3 files changed, 37 insertions(+), 24 deletions(-) create mode 100644 manifests/package.pp diff --git a/README.md b/README.md index 9405bd8..49110ba 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ * [Defines](#defines) * [apt::apt_conf](#apt-apt_conf) * [apt::preferences_snippet](#apt-preferences_snippet) - * [apt::preseeded_package](#apt-preseeded_package) + * [apt::package](#apt-package) * [apt::sources_list](#apt-sources_list) * [apt::key](#apt-key) * [`apt::key::plain`](#apt-key-plain) @@ -155,6 +155,9 @@ Ubuntu support is lagging behind but not absent either. port => '666'; } + * the `apt::preseeded_package` defined type was renamed `apt::package` the + previous name is now deprecated and will be removed in the future. + # Requirements @@ -505,7 +508,7 @@ From apt_preferences(5): characters - otherwise they will be silently ignored. -## apt::preseeded_package +## apt::package This simplifies installation of packages for which you wish to preseed the answers to debconf. For example, if you wish to provide a preseed file for the @@ -513,12 +516,12 @@ locales package, you would place the `locales.seed` file in `site_apt/templates/${::lsbdistcodename}/locales.seeds` and then include the following in your manifest: - apt::preseeded_package { locales: } + apt::package { locales: } You can also specify the content of the seed via the content parameter, for example: - apt::preseeded_package { 'apticron': + apt::package { 'apticron': content => 'apticron apticron/notification string root@example.com', } diff --git a/manifests/package.pp b/manifests/package.pp new file mode 100644 index 0000000..b2ae79d --- /dev/null +++ b/manifests/package.pp @@ -0,0 +1,25 @@ +# Install a package with a preseed file to automatically answer some questions. +define apt::package ( + $ensure = 'present', + $seedfile_content = '', +) { + + $seedfile = "/var/cache/local/preseeding/${name}.seeds" + $real_seedfile_content = $seedfile_content ? { + '' => template ( "site_apt/${::debian_codename}/${name}.seeds" ), + default => $seedfile_content, + } + + file { $seedfile: + content => $real_seedfile_content, + mode => '0600', + owner => 'root', + group => 0, + } + + package { $name: + ensure => $ensure, + responsefile => $seedfile, + require => File[$seedfile], + } +} diff --git a/manifests/preseeded_package.pp b/manifests/preseeded_package.pp index 29a981e..e1d1dcc 100644 --- a/manifests/preseeded_package.pp +++ b/manifests/preseeded_package.pp @@ -1,26 +1,11 @@ -# Install a package with a preseed file to automatically answer some questions. - +# This is a wrapper that will be removed after a while define apt::preseeded_package ( $ensure = 'present', $content = '', ) { - - $seedfile = "/var/cache/local/preseeding/${name}.seeds" - $real_content = $content ? { - '' => template ( "site_apt/${::debian_codename}/${name}.seeds" ), - default => $content, - } - - file { $seedfile: - content => $real_content, - mode => '0600', - owner => 'root', - group => 0, - } - - package { $name: - ensure => $ensure, - responsefile => $seedfile, - require => File[$seedfile], + warning('apt::preseeded_package is deprecated! you should now use apt::package instead.') + apt::package { $name: + ensure => $ensure, + content => $content, } } -- cgit v1.2.3