Tim Landscheidt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/195081

Change subject: Ensure that apt preferences are named *.pref
......................................................................

Ensure that apt preferences are named *.pref

Currently, apt::pin does not append an extension to the given name
parameter when creating the file resource in /etc/apt/preferences.d
(apt accepts any file with no extension or the extension ".pref").  In
this aspect, apt::pin behaves differently than apt::repository that
appends ".list" to the files it creates, and is also used
inconsistently as some callers use an (explicit) ".pref" extension
while others do not.

In addition, on Labs instances both the file
/etc/apt/preferences.d/wikimedia and the file
/etc/apt/preferences.d/wikimedia.pref are created with equal content,
but only the former is managed by Puppet.

This change ensures that files created by apt::pin or the install
scripts have ".pref" appended to their names and that all callers are
amended accordingly.

Bug: T60681
Change-Id: I1ebf184ccd7d4bf8575ca12d9fa51064147479c9
---
M manifests/role/swift.pp
M modules/apt/manifests/init.pp
M modules/apt/manifests/pin.pp
M modules/install-server/files/autoinstall/scripts/early_command
M modules/openstack/manifests/openstack-manager.pp
5 files changed, 15 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/81/195081/1

diff --git a/manifests/role/swift.pp b/manifests/role/swift.pp
index b0716c0..b5e686f 100644
--- a/manifests/role/swift.pp
+++ b/manifests/role/swift.pp
@@ -379,7 +379,7 @@
         keyfile    => 'puppet:///files/misc/ubuntu-cloud.key',
     }
 
-    apt::pin { 'swift-icehouse.pref':
+    apt::pin { 'swift-icehouse':
         package  => '*',
         pin      => 'release n=precise-updates/icehouse',
         priority => 1005,
diff --git a/modules/apt/manifests/init.pp b/modules/apt/manifests/init.pp
index 3ea9206..4bc4aef 100644
--- a/modules/apt/manifests/init.pp
+++ b/modules/apt/manifests/init.pp
@@ -52,6 +52,12 @@
         pin      => 'release o=Wikimedia',
         priority => 1001,
     }
+    # TODO: Remove after applied everywhere.
+    file { '/etc/apt/preferences.d/wikimedia':
+        ensure  => absent,
+        require => Apt::Pin['wikimedia'],
+        notify  => Exec['apt-get update'],
+    }
 
     $http_proxy = "http://webproxy.${::site}.wmnet:8080";
 
diff --git a/modules/apt/manifests/pin.pp b/modules/apt/manifests/pin.pp
index 5f9c173..fd17aa6 100644
--- a/modules/apt/manifests/pin.pp
+++ b/modules/apt/manifests/pin.pp
@@ -4,7 +4,7 @@
     $package=$name,
     $ensure=present,
 ) {
-    file { "/etc/apt/preferences.d/${name}":
+    file { "/etc/apt/preferences.d/${name}.pref":
         ensure  => $ensure,
         owner   => 'root',
         group   => 'root',
diff --git a/modules/install-server/files/autoinstall/scripts/early_command 
b/modules/install-server/files/autoinstall/scripts/early_command
index 33280d5..24dee97 100644
--- a/modules/install-server/files/autoinstall/scripts/early_command
+++ b/modules/install-server/files/autoinstall/scripts/early_command
@@ -50,7 +50,7 @@
 APT_PREFDIR=/target/etc/apt/preferences.d
 [ ! -d "\$APT_PREFDIR" ] && mkdir -p "\$APT_PREFDIR"
 
-cat >\$APT_PREFDIR/wikimedia <<EOT
+cat >\$APT_PREFDIR/wikimedia.pref <<EOT
 Package: *
 Pin: release o=Wikimedia
 Pin-Priority: 1001
diff --git a/modules/openstack/manifests/openstack-manager.pp 
b/modules/openstack/manifests/openstack-manager.pp
index d1ca7f3..259c1ed 100644
--- a/modules/openstack/manifests/openstack-manager.pp
+++ b/modules/openstack/manifests/openstack-manager.pp
@@ -16,6 +16,12 @@
             priority => '1001',
             before   => Package['memcached'],
         }
+        # TODO: Remove after applied everywhere.
+        file { '/etc/apt/preferences.d/memcached':
+            ensure  => absent,
+            require => Apt::Pin['memcached'],
+            notify  => Exec['apt-get update'],
+        }
 
         class { 'memcached':
             ip  => '127.0.0.1',

-- 
To view, visit https://gerrit.wikimedia.org/r/195081
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1ebf184ccd7d4bf8575ca12d9fa51064147479c9
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Tim Landscheidt <t...@tim-landscheidt.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to