Commit graph

275 commits

Author SHA1 Message Date
Micah Anderson
88bfe5fbab fix for the following: warning: Dynamic lookup of $custom_preferences at modules/apt/manifests/preferences_snippet.pp:16 is deprecated. For more information, see http://docs.puppetlabs.com/guides/scope_and_puppet.html. To see the change in behavior, use the --debug flag. 2013-06-20 15:32:51 -04:00
Micah Anderson
61a2f48948 Merge branch 'master' into leap 2013-05-26 17:04:05 -04:00
intrigeri
46c58b07bf Use the main Debian archive's URL as the default URL for backports on Wheezy.
The backports are now fully integrated with the main archive.

See:
https://labs.riseup.net/code/issues/4270
https://lists.debian.org/debian-devel-announce/2013/03/msg00007.html
2013-03-20 22:11:46 +01:00
intrigeri
5ec8ffb4ef Move apt class parameters to a ::params class.
This brings no behaviour change yet, but will allow to set class parameters'
default value depending on system facts.
2013-03-20 22:09:29 +01:00
varac
6bf7a6ab5d Revert "deploy /etc/apt/preferences before File['apt_config']"
This reverts commit 7e8113b3fc.

see https://leap.se/code/issues/1990 for the miserious details.
2013-03-15 20:46:29 +01:00
varac
7e8113b3fc deploy /etc/apt/preferences before File['apt_config'] 2013-03-14 22:19:33 +01:00
varac
c8a28eb80e apt keys: always deploy before Exec[refresh_apt], also with $custom_preferences 2013-03-14 20:01:35 +01:00
varac
f0a107ffee fix #4249: Ubuntu: wrong sources.list entries 2013-03-05 09:39:23 +01:00
intrigeri
d51e2af9d4 Don't check for a package priority to be set when removing an APT preferences snippet.
The problem I'm facing is that the sanity checks prevent one from
using a simple:

  apt::preferences_snippet { "bla": ensure => absent }

So, first set a default value for the `priority' parameter, so
that it's not required anymore. Second, add a sanity check to
error out when priority is not set, to get the safe old behaviour.

Then, wrap all sanity checks about arguments within
a "if $ensure == 'present'" block.
2013-02-16 14:58:43 -05:00
varac
f16a0727dc Install unattended-upgrades after Exec[refresh_apt]
Before, including apt::unattended_upgrades on a host without
the unattended-upgrades package would fail on the first run,
because the module tries to install the package before apt is
finally configured.
This commit does:

- introduce the option $refresh_apt for apt::apt_conf
  (Defaults to true). Can be used to not trigger Exec['refresh_apt']
- install the unattended-upgrades package after a final
  Exec['refresh_apt']. To not run into a loop, it calls
  Apt_conf['50unattended-upgrades'] with the option
  refresh_apt => false, which is also not needed for the configuration
2013-02-01 15:52:29 +01:00
intrigeri
14670466be Don't check for source / content to be set when removing an APT source.
Else, the sanity checks prevent one from using a simple
  apt::sources_list { "sid.list": ensure => absent }
2013-01-08 18:13:23 +01:00
intrigeri
354283d54e Merge remote-tracking branch 'leap/feature/unattended_upgrades' into review
Conflicts:
	files/lenny/50unattended-upgrades
2013-01-08 14:05:49 +01:00
Micah Anderson
2fe3df225c replace a missed Concat reference change with File['apt_config'] 2013-01-03 14:55:55 -05:00
intrigeri
1fe1fe66c3 Fix overzealous linting.
We do want to see \n expanded in this string.
2013-01-03 19:57:44 +01:00
Gabriel Filion
ded81d8edc Apply code style corrections from puppet-lint
Signed-off-by: Gabriel Filion <lelutin@gmail.com>

+ more linting by intrigeri.

Conflicts:
	manifests/apticron.pp
	manifests/cron/dist_upgrade.pp
	manifests/cron/download.pp
	manifests/dist_upgrade/initiator.pp
	manifests/init.pp
	manifests/listchanges.pp
	manifests/preferences.pp
	manifests/preseeded_package.pp
	manifests/proxy_client.pp
	manifests/unattended_upgrades.pp
	manifests/update.pp
2013-01-02 17:28:59 +01:00
intrigeri
17f67d9fac Simplify codename handling.
Have the codename class parameter default to $::lsbdistcodename, and derive
$release from it.
2013-01-02 16:54:03 +01:00
intrigeri
09710a29b1 Remove duplicated settings, resulting from wrong merge. 2013-01-02 16:40:26 +01:00
intrigeri
517040bb2e Merge remote-tracking branch 'riseup/immerda_27_readme' into shared
Conflicts:
	README
	manifests/cron/dist_upgrade.pp
	manifests/cron/download.pp
	manifests/init.pp
	manifests/preferences.pp
2013-01-02 16:14:06 +01:00
Gabriel Filion
cda713fcf6 Merge branch 'master' into issue_3953 2013-01-02 07:32:12 -05:00
intrigeri
37e5594770 Merge remote-tracking branch 'riseup/feature/http_debian_net' 2012-12-30 13:59:08 +01:00
intrigeri
8e5ce0b397 Merge remote-tracking branch 'riseup/feature/unknown_lsbdistcodename' 2012-12-30 13:58:59 +01:00
nadir
37e40416d2 exec{'apt_dist-upgrade'} just requires Exec['apt_updated'] if apt::disable_update if false 2012-12-19 18:30:29 +01:00
Micah Anderson
7de392c40e On a sid system, $lsbdistcodename is reports 'n/a', this doesn't work because the module
looks for a template based on the $lsbdistcodename, so you get this error:

      Could not find template 'apt/Debian/preferences_n/a.erb'

The slash in 'n/a' appears to be a path (confusing!)

So I've set an error message when 'n/a' is encountered, encouraging the user to set the $lsbdistcodename.

I was not confident in the idea of pointing any occurrence of 'n/a' to the sid
templates, as I could imagine a case where this might occur on a non-sid system
where the lsbdistcodename isn't properly detected
2012-12-18 16:45:38 -05:00
Micah Anderson
e66823269e switch default $debian_url to use http.debian.net which is more accurate and up-to-date than cdn.debian.net 2012-12-18 16:41:10 -05:00
nadir
3a473dafd5 comparing variabled should use double quotes (interestingly, it does work with only one too) 2012-12-18 22:31:00 +01:00
nadir
4204847fdd added $apt_disable_update to disable "apt-get update" during puppetruns 2012-12-18 22:26:45 +01:00
Micah Anderson
07a031f205 fix for $lsbdistcodename regression introduced by ac166366d7
What happened here was the $codename = $::lsbdistcodename was removed from
init.pp and replaced with just $::lsbdistcodename whereever $codename was
used. Then in the sources.list.erb and preferences files things were changed
like this:

<pre>+### Debian current: <%= codename = scope.lookupvar('::lsbdistcodename') %>
...
-deb <%= debian_url %> <%= codename %> <%= repos %>
...
+deb <%= debian_url=scope.lookupvar('apt::debian_url') %> <%= codename %> <%= repos=scope.lookupvar('apt::repos') %>
</pre>

This meant that the codename was always set to lsbdistcodename, and you because
in newer puppet versions you cannot assign a value to a top-level facter
variable, it is not possible to change this.

Because we cannot change $lsbdistcodename, we have to fix this by allowing the
user to pass a different, non-top-level scoped variable to the class as a
parameter, which defaults to $::lsbdistcodename, so that upgrades can be
triggered.

This is documented in the README in an upgrade notice
2012-12-05 13:46:23 -05:00
Gabriel Filion
9d7b48e37c Define an alias when enforcing absence of /etc/apt/preferences
This ensures that resources that set a dependecy on the
"File['apt_config']" file, as mentioned in the README, can always
resolve.

Signed-off-by: Gabriel Filion <lelutin@gmail.com>
2012-09-20 04:00:38 -04:00
Gabriel Filion
8229505ecb Make apt::preferences_snippet place files in /etc/apt/preferences.d
Since Debian Squeeze, apt supports a .d directory for preferences
(pinning). Simplify management by just placing files inside this .d
directory.

This removes the need for concat and concat::fragment resources, so
removes the dependency on the concat module. It also removes the need
for a moduledir that was needed for the concat module magic, so we also
get rid of the dependency on the common module.

Signed-off-by: Gabriel Filion <lelutin@gmail.com>
2012-09-20 03:55:58 -04:00
Gabriel Filion
978378623d Stop using config_file from the common module
This define doesn't add much of a shortcut and imposes a dependency on
the "common" module. We'll be better off with the small repetition but
less tightly coupled modules.

Sadly, the "common" module is still required, but that is going to be
the focus of the commit that follows this one.

Signed-off-by: Gabriel Filion <lelutin@gmail.com>
2012-09-20 02:54:26 -04:00
Micah Anderson
b528cd0005 parameterize the apt::proxy_client class 2012-08-22 10:55:25 -04:00
mh
0c2f31b5d5 Merge remote-tracking branch 'shared/master'
Conflicts:
	README
	manifests/dist_upgrade/initiator.pp
	manifests/init.pp
	manifests/preseeded_package.pp
	manifests/unattended_upgrades.pp
2012-08-16 09:35:21 +02:00
intrigeri
02bd326994 Make apt::preferences_snippet support Puppet < 2.7 again, when the 'package' parameter is not set.
Details:
  https://labs.riseup.net/code/issues/3467
  https://labs.riseup.net/code/issues/3468
2012-06-18 22:57:13 +02:00
mh
5d75c10a4d fix relations and finally get rid off config_file 2012-06-18 17:10:40 -03:00
mh
d47addd2ed get rid off config_file wrapper 2012-06-18 11:41:04 -03:00
mh
0e016e968d migrate away from hiera stuff 2012-06-14 10:07:29 -03:00
intrigeri
2e4d22ddd9 Allow passing arbitrary Pin value to apt::preferences_snippet.
Closes: Redmine#3467.
2012-06-08 18:30:23 +02:00
intrigeri
13a0b4484f Support multiple APT preferences snippets for the same package name pattern.
This is implemented by adding a "package" parameter to apt::preferences_snippet,
so that define names can be kept unique while the package names are
not necessarily.

Closes: Redmine#3468.
2012-06-08 18:18:50 +02:00
mh
ac166366d7 refactor things for >2.7 2012-06-08 12:16:46 -03:00
mh
0cb3cd816e Migrate - in class names to _
In newer puppet releases the old way to name class/modules with a -,
won't anymore be supported.

Conflicts:

	manifests/unattended_upgrades.pp
2012-06-08 15:07:48 +02:00
mh
39917fb4db new style for 2.7 2012-06-05 21:31:15 -03:00
mh
f1a0eca466 Migrate - in class names to _
In newer puppet releases the old way to name class/modules with a -,
won't anymore be supported.
2012-04-15 15:41:58 +02:00
mh
bdc2446671 Merge remote-tracking branch 'shared/master'
Conflicts:
	README
2012-04-15 13:19:45 +02:00
mh
56efade862 use correct references for new concat usage 2012-04-11 11:35:31 +02:00
mh
5173c71715 use the correct name 2012-04-11 11:35:31 +02:00
mh
8996d83489 migrate concatenated_file to the concat module 2012-04-11 11:35:31 +02:00
Gabriel Filion
a835369958 Force an apt-get update when changing an apt::sources_list
sources_list doesn't currently force puppet to run 'apt-get update'
after creating/modifying/removing files in sources.list.d.

Signed-off-by: Gabriel Filion <lelutin@gmail.com>
2012-04-09 01:39:29 -04:00
Gabriel Filion
4d0ddd0057 Refactor: manage .d directories when using sources_list and apt_conf
The .d directories are only managed by the main 'apt' class. However,
both 'sources_list' and 'apt_conf' defines depend on those directories.
So in practice, the defines have an implicit need for those directories
to be somehow managed.

Let's turn this into an explicit relation, and include the directories
in the defines.

This makes it possible to use both defines without having to include the
main 'apt' class. (maybe when using puppet apply?)

Signed-off-by: Gabriel Filion <lelutin@gmail.com>
2012-04-09 01:38:30 -04:00
mh
7727549c02 use correct references for new concat usage 2011-08-05 11:22:05 +02:00
mh
2b7cfe52f7 use the correct name 2011-08-05 11:12:29 +02:00
mh
e99f7c8672 migrate concatenated_file to the concat module 2011-08-05 10:57:13 +02:00
mh
54932c9c21 fix unattended upgrades
as we use $lsbdistcodename as source we cannot name the sources
which should be used to update "stable". -> Fix it by deploying
a per lsbdistcodename configfile. This can also be used as a pre-
work for the #2681 shared modules bug.
2011-06-05 14:58:22 +02:00
intrigeri
d0f7e98ec5 Revert "apt::custom_sources_template to deploy custom sources.list.d/xyz.list"
This reverts commit 3c0499b78d.
This was already provided by sources_list.pp.
2011-04-25 22:50:53 +02:00
root
5964e90e33 Possibility to delpoy release related config file 2011-04-02 11:16:43 +00:00
root
63c7b5a643 Merge branch 'master' of git://labs.riseup.net/shared-apt 2011-04-02 07:53:38 +00:00
intrigeri
14cd91de33 apt::cron::dist-upgrade: silently keep old version of conffiles.
This makes this class' behaviour consistent with the apt::dist_upgrade one
and prevents stalled upgrades due to dpkg asking questions to a dumb robot.
2011-02-18 22:41:36 +01:00
root
13033f7d81 Merge branch 'master' of git://labs.riseup.net/shared-apt 2011-02-16 13:23:54 +00:00
varac
75f988242a preferences.pp for ubuntu maverick 2011-01-23 23:33:06 +01:00
nadir
3c0499b78d apt::custom_sources_template to deploy custom sources.list.d/xyz.list 2011-01-09 22:57:18 +01:00
intrigeri
d76f922dfb Make sources snippets world-readable.
Not doing this breaks big parts of functionality, such as aptitude why.
2011-01-08 19:39:10 +01:00
Micah Anderson
c5dc8ff5fc add -q to the apt-get invocation in upgrade_package.pp, also switch to using -y instead of --force-yes. this way we are acting in the same way as the dist_upgrade class 2010-12-18 15:47:11 -05:00
Micah Anderson
5fdadb955d switch aptitude to apt-get, since aptitude will sometimes automatically do things that are unrelated to the task at hand, such as deinstalling automatically installed packages, which can be undesirable behavior 2010-12-18 14:01:11 -05:00
intrigeri
575e4ab9cc Fix apt::upgrade_package when used multiple times. 2010-12-16 18:14:23 +01:00
intrigeri
bbe2c8aee9 New class: apt::dist_upgrade::initiator.
This implements the "update initiator" pattern suggested by
http://projects.puppetlabs.com/projects/puppet/wiki/Debian_Patterns.

This feature is useful when one does not want to setup a fully automated upgrade
process but still needs a way to manually trigger full upgrades of any number of
systems at scheduled times.
2010-12-16 13:03:08 +01:00
intrigeri
4765a02564 New class: apt::dist_upgrade. 2010-12-16 13:02:28 +01:00
intrigeri
2d4f6d3522 Fix 5237f9da. 2010-12-15 22:11:34 +01:00
intrigeri
7ffedbad6b Merge remote branch 'riseup/master' 2010-12-15 22:01:34 +01:00
Micah Anderson
5237f9dab0 change $listchanges_* to $apt_listchanges, not nice to clutter up the namespace like that 2010-12-15 14:49:34 -05:00
intrigeri
75cf15b7c7 Fix packages dependency. 2010-12-15 15:18:16 +01:00
intrigeri
a084ac642c Use line define instead of append_if_no_such_line.
The latter is only a wrapper around the former and it seems we want to remove
the latter from our shared common module.
2010-12-15 10:44:14 +01:00
intrigeri
a06bf5f71b apt::upgrade_package: explicitly depend on needed packages.
This define was previously broken unless dctrl-tools and apt-show-versions were
installed.
2010-12-15 10:00:47 +01:00
intrigeri
af8ecf1e9f Repair Exec['update_apt'] to run apt-get update when needed.
Move this Exec to a dedicated class that is not included by default i.e. we
default not to "apt-get update" on every Puppet run.

We now make use of this class in the apt::upgrade_package define to make sure
APT indexes are up-to-date before attempting package upgrades.

One may now use the following to ensure current packages are installed by
Package resources:

  include apt::update
  Package { require => Exec[apt_updated] }
2010-12-15 09:47:57 +01:00
intrigeri
4979889584 (ugly workaround warning) Update packages lists before upgrading a package.
... because Exec[update_apt] is currently never run since we set it refreshonly.
Better solutions are being thought of, but in the meantime the least we can do
is somehow repair apt::upgrade_package.
2010-12-14 22:04:05 +01:00
intrigeri
1ae3fdfeb5 Make consistent the use of absolute path to apt-get. 2010-12-14 21:56:36 +01:00
intrigeri
5846da98ce Factorize. 2010-12-14 21:39:50 +01:00
intrigeri
4625afacae apt::reboot_required_notify: take into account the random sleep time. 2010-12-13 10:08:47 +01:00
intrigeri
4195a91773 Merge remote branch 'riseup/master' 2010-12-13 09:54:37 +01:00
Micah Anderson
f855a5a0ad switch default frontend to 'mail' instead of pager, as most things are done non-interactively 2010-12-12 21:41:21 -05:00
intrigeri
4103a27054 Additionally use version number in Lenny default pinning.
Lenny's APT does not support pinning like this:

  Pin: release o=Debian,n=<%= codename %>

We therefore switched (in commit ef2ebdffd) to:

  Pin: release o=Debian,a=<%= release %>

With such a pinning setup, when Squeeze is released, systems using this module
with $apt_use_next_release set to true would immediately switch to prefer
packages from Squeeze. If an automated upgrade process is setup, they would be
automatically upgraded to Squeeze.

This does not sound safe to me, so let's use the release version number as an
additional selection criterion to prevent upgrades to Squeeze to happen behind
our back:

  Pin: release o=Debian,a=<%= release %>,v=<%= release_version %>*

Note that the trailing '*' is intentional and necessary to match stable
point-releases.
2010-12-12 09:57:42 +01:00
intrigeri
fad111e036 Allow running cron-apt more than once a day. 2010-12-11 15:17:41 +01:00
intrigeri
874da52745 New class: apt::reboot_required_notify
This class installs a daily cronjob that checks if a package upgrade
requires the system to be rebooted; if so, cron sends a notification
email to root.
2010-12-11 14:50:16 +01:00
Micah Anderson
9223dfc186 Merge remote branch 'lelutin/master' 2010-12-09 09:44:00 -05:00
Micah Anderson
d61a64b394 fix syntax error 2010-12-08 22:32:00 -05:00
Micah Anderson
8944374bf2 fix confusion over lsbrelease / lsbdistcodename 2010-12-08 22:27:13 -05:00
Micah Anderson
13bf7d0623 add apt-listchanges support. this is a nice compliment to using the upgrade_package functionality, because you get an email when the package has been upgraded. 2010-12-08 22:25:09 -05:00
Micah Anderson
fbb291ed19 add apticron support.
Why apticron, when we have cron-apt already? Some people have different preferences, we use apticron along with the upgrade_package functionality in this module. I know someone who uses cron-apt to run the upgrades, but apticron for notifications, because apticron's notifications are much nicer (cron-apt just gives you the output of apt-get upgrade)
2010-12-08 22:24:24 -05:00
Micah Anderson
d9ccf2a99b provide an "03clean" alias for the 03clean_vserver to satisfy dependencies 2010-12-08 09:57:02 -05:00
Micah Anderson
72bb7b5ccb fix typo 2010-12-08 00:02:15 -05:00
Micah Anderson
36c4873f87 multiple sources for templates are not allowed (see #1818), so revert it to a single source referenced by the README, and clarify the README to indicate how you can pass the preseed contents directly 2010-12-07 23:57:25 -05:00
Micah Anderson
ee21742cf8 change the name of the custom_keys exec to be "custom_keys" instead of using the alias metaparameter.
the reason for this change was because the Exec override was not able to find the exec through its alias
2010-12-07 23:06:11 -05:00
Micah Anderson
dd0552dce1 update apt::preseeded_package template sources to use $lsbdistcodename instead of $debian_release, also expand it to allow for site-apt sources 2010-12-07 23:04:46 -05:00
Micah Anderson
e15283b781 format standardization 2010-12-07 13:18:41 -05:00
Micah Anderson
bb03c32b45 switch the default $debian_url to use the Debian CDN mirror address.
The CDN checks your IP and uses the Max-Mind geoIP DB to determine your location and then uses your local country Debian Mirror, or if your local country doesn't have a debian mirror, it uses the local continent. It automatically checks and prunes dead mirrors. the technology for the Debian CDN setup is still improving, I believe that ASN-number associations are the next step to attempt to make more informed, finer-grained choices.

This is more useful than using ftp.debian.org because that is just a round-robin DNS entry that could get you any mirror anywhere.
2010-12-07 12:46:37 -05:00
Micah Anderson
2ee70ab5e0 Set dselect DSelect::Clean to 'pre-auto' by default for hosts that are vservers.
Before you only had the choice of setting a 03clean apt configuration for either
all hosts, or every single host. Setting it to have the recommended settings for
vservers for all hosts meant that you were setting it for non-vservers as well
as vservers. The other option you had was to set it per host. This was a bit
annoying if you have any more than one vserver because you would need to create
a 03clean for every single vserver guest.

This change auto-detects if the node is a vserver, and if it is it automatically
installs the 03clean_vserver file, with the recommended DSelect::Clean settings,
and allows you to override this for all of your vservers, or for specific hosts.
2010-12-07 12:20:14 -05:00
Gabriel Filion
52ebb41690 apt_conf: change mode to 644
Current mode (600) makes it impossible to use apt-cache to search for
package names and info, since it tries to read all configuration files
in /etc/apt/apt.conf.d before executing.

Change configuration file mode to 644 so that search tasks can be made
without root priviledge.
2010-11-29 13:37:53 -05:00
intrigeri
2276147cc0 Bugfix 2010-11-21 21:54:17 +01:00
intrigeri
10c7939f65 Merge remote branch 'immerda/master'.
Conflicts:
	README
	files/preferences
	templates/Debian/sources.list.deb-src.erb
	templates/Debian/sources.list.volatile.erb
	templates/Ubuntu/sources.list.backports.erb
	templates/Ubuntu/sources.list.deb-src.erb
2010-11-21 17:03:57 +01:00
intrigeri
3de76e7b05 Merge commit '92aa5a51e95d74604a40318558aa98f70fcf7720'.
A bunch of painlessly merged commits.

Conflicts:
	manifests/init.pp
2010-11-21 16:50:43 +01:00
intrigeri
9ab979897f Merge commit '3c88b19dd33b4da1f37e2c08c981ccbcbe5a45a8'.
Conflicts:
	manifests/init.pp
2010-11-21 16:44:05 +01:00
intrigeri
f22861e820 Merge commit '27d5808299045ebd6f428e7d8131d11d9ab37712'.
One more painless merge commit.

Conflicts:
	manifests/init.pp
2010-11-21 16:41:56 +01:00