Split reprepro config to allow for debian and ubuntu

We can't colocation debian and ubuntu - so allow for each having their
own pool independent pool structure.

Change-Id: I9fe0fa9769a5c0f6a852844b2db0dfb620e91375
This commit is contained in:
Monty Taylor 2016-02-08 11:58:53 -06:00
parent 857b22519a
commit 7ec1b3d7e3
7 changed files with 111 additions and 98 deletions

View File

@ -16,8 +16,11 @@
set -e set -e
UNREF_FILE=/var/run/reprepro/unreferenced-files REPREPRO_CONFIG=$1
REPREPRO='k5start -t -f /etc/reprepro.keytab service/reprepro -- timeout -k 2m 30m reprepro --confdir /etc/reprepro' MIRROR_VOLUME=$2
UNREF_FILE=/var/run/reprepro/${MIRROR_VOLUME}.unreferenced-files
REPREPRO="k5start -t -f /etc/reprepro.keytab service/reprepro -- timeout -k 2m 30m reprepro --confdir $REPREPRO_CONFIG"
echo "Obtaining reprepro tokens and running reprepro update" echo "Obtaining reprepro tokens and running reprepro update"
$REPREPRO update $REPREPRO update
@ -35,6 +38,6 @@ $REPREPRO checkpool fast
$REPREPRO check $REPREPRO check
echo "reprepro completed successfully, running reprepro export." echo "reprepro completed successfully, running reprepro export."
k5start -t -f /etc/afsadmin.keytab service/afsadmin -- vos release -v mirror.apt k5start -t -f /etc/afsadmin.keytab service/afsadmin -- vos release -v $MIRROR_VOLUME
echo "Done." echo "Done."

View File

@ -51,9 +51,9 @@ class openstack_project::mirror (
} }
# Create the symlink to apt. # Create the symlink to apt.
file { "${www_root}/apt": file { "${www_root}/ubuntu":
ensure => link, ensure => link,
target => "${mirror_root}/apt", target => "${mirror_root}/ubuntu",
owner => root, owner => root,
group => root, group => root,
require => [ require => [

View File

@ -59,7 +59,10 @@ class openstack_project::mirror_update (
} }
class { '::openstack_project::reprepro': class { '::openstack_project::reprepro':
ubuntu_releases => ['trusty'], confdir => '/etc/reprepro/ubuntu',
basedir => '/afs/.openstack.org/mirror/ubuntu',
distributions => 'openstack_project/reprepro/distributions.ubuntu.erb',
releases => ['trusty'],
} }
file { '/etc/reprepro.keytab': file { '/etc/reprepro.keytab':
@ -78,9 +81,13 @@ class openstack_project::mirror_update (
} }
cron { 'reprepro': cron { 'reprepro':
ensure => absent,
}
cron { 'reprepro ubuntu':
user => $user, user => $user,
hour => '*/2', hour => '*/2',
command => 'flock -n /var/run/reprepro/mirror.lock reprepro-mirror-update >>/var/log/reprepro/mirror.log 2>&1', command => 'flock -n /var/run/reprepro/ubuntu.lock reprepro-mirror-update /etc/reprepro/ubuntu mirror.ubuntu >>/var/log/reprepro/mirror.log 2>&1',
environment => 'PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin', environment => 'PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin',
require => [ require => [
File['/usr/local/bin/reprepro-mirror-update'], File['/usr/local/bin/reprepro-mirror-update'],

View File

@ -1,13 +1,13 @@
# == Class: openstack_project::mirror_update # == Class: openstack_project::mirror_update
# #
class openstack_project::reprepro ( class openstack_project::reprepro (
$basedir = '/afs/.openstack.org/mirror/apt', $confdir,
$basedir,
$distributions,
$logdir = '/var/log/reprepro', $logdir = '/var/log/reprepro',
$updates_file = 'puppet:///modules/openstack_project/reprepro/updates', $updates_file = 'puppet:///modules/openstack_project/reprepro/updates',
$options_template = 'openstack_project/reprepro/options.erb', $options_template = 'openstack_project/reprepro/options.erb',
$distributions_template = 'openstack_project/reprepro/distributions.erb', $releases = [],
$ubuntu_releases = [],
$debian_releases = [],
) { ) {
package { 'reprepro': package { 'reprepro':
@ -22,11 +22,15 @@ class openstack_project::reprepro (
ensure => directory, ensure => directory,
} }
file { "$confdir":
ensure => directory,
}
file { '/var/run/reprepro': file { '/var/run/reprepro':
ensure => directory, ensure => directory,
} }
file { '/etc/reprepro/updates': file { "${confdir}/updates":
ensure => present, ensure => present,
owner => 'root', owner => 'root',
group => 'root', group => 'root',
@ -34,7 +38,7 @@ class openstack_project::reprepro (
source => $updates_file, source => $updates_file,
} }
file { '/etc/reprepro/options': file { "${confdir}/options":
ensure => present, ensure => present,
owner => 'root', owner => 'root',
group => 'root', group => 'root',
@ -42,11 +46,11 @@ class openstack_project::reprepro (
content => template($options_template), content => template($options_template),
} }
file { '/etc/reprepro/distributions': file { "${confdir}/distributions":
ensure => present, ensure => present,
owner => 'root', owner => 'root',
group => 'root', group => 'root',
mode => '0755', mode => '0755',
content => template($distributions_template), content => template($distributions),
} }
} }

View File

@ -0,0 +1,41 @@
<% @releases.each do |release| -%>
Origin: Debian
Codename: <%= release %>
Description: OpenStack Debian <%= release.capitalize %> mirror
Architectures: amd64
Components: main
UDebComponents: main
Contents: .gz
Update: debian
Log: <%= @logdir %>/debian-<%= release %>.log
Origin: Debian
Codename: <%= release %>-updates
Description: OpenStack Debian <%= release.capitalize %> Updates mirror
Architectures: amd64
Components: main
UDebComponents: main
Contents: .gz
Update: debian
Log: <%= @logdir %>/debian-<%= release %>-updates.log
Origin: Debian
Codename: <%= release %>-backports
Description: OpenStack Debian <%= release.capitalize %> Backports mirror
Architectures: amd64
Components: main
UDebComponents: main
Contents: .gz
Update: debian
Log: <%= @logdir %>/debian-<%= release %>-backports.log
Origin: Debian
Codename: <%= release %>/updates
Description: OpenStack Debian <%= release.capitalize %> Security mirror
Architectures: amd64
Components: main
UDebComponents: main
Contents: .gz
Update: debian-security
Log: <%= @logdir %>/debian-<%= release %>-security.log
<% end -%>

View File

@ -1,83 +0,0 @@
<% @ubuntu_releases.each do |release| -%>
Origin: Ubuntu
Codename: <%= release %>
Description: OpenStack Ubuntu <%= release.capitalize %> mirror
Architectures: amd64
Components: main universe
UDebComponents: main
Contents: .gz
Update: ubuntu
Log: <%= @logdir %>/ubuntu-<%= release %>.log
Origin: Ubuntu
Codename: <%= release %>-updates
Description: OpenStack Ubuntu <%= release.capitalize %> Updates mirror
Architectures: amd64
Components: main universe
UDebComponents: main
Contents: .gz
Update: ubuntu
Log: <%= @logdir %>/ubuntu-<%= release %>-updates.log
Origin: Ubuntu
Codename: <%= release %>-backports
Description: OpenStack Ubuntu <%= release.capitalize %> Backports mirror
Architectures: amd64
Components: main universe
UDebComponents: main
Contents: .gz
Update: ubuntu
Log: <%= @logdir %>/ubuntu-<%= release %>-backports.log
Origin: Ubuntu
Codename: <%= release %>-security
Description: OpenStack Ubuntu <%= release.capitalize %> Security mirror
Architectures: amd64
Components: main universe
UDebComponents: main
Contents: .gz
Update: ubuntu-security
Log: <%= @logdir %>/ubuntu-<%= release %>-security.log
<% end -%>
<% @debian_releases.each do |release| -%>
Origin: Debian
Codename: <%= release %>
Description: OpenStack Debian <%= release.capitalize %> mirror
Architectures: amd64
Components: main
UDebComponents: main
Contents: .gz
Update: debian
Log: <%= @logdir %>/debian-<%= release %>.log
Origin: Debian
Codename: <%= release %>-updates
Description: OpenStack Debian <%= release.capitalize %> Updates mirror
Architectures: amd64
Components: main
UDebComponents: main
Contents: .gz
Update: debian
Log: <%= @logdir %>/debian-<%= release %>-updates.log
Origin: Debian
Codename: <%= release %>-backports
Description: OpenStack Debian <%= release.capitalize %> Backports mirror
Architectures: amd64
Components: main non-free contrib
UDebComponents: main
Contents: .gz
Update: debian
Log: <%= @logdir %>/debian-<%= release %>-backports.log
Origin: Debian
Codename: <%= release %>/updates
Description: OpenStack Debian <%= release.capitalize %> Security mirror
Architectures: amd64
Components: main non-free contrib
UDebComponents: main
Contents: .gz
Update: debian-security
Log: <%= @logdir %>/debian-<%= release %>-security.log
<% end -%>

View File

@ -0,0 +1,41 @@
<% @releases.each do |release| -%>
Origin: Ubuntu
Codename: <%= release %>
Description: OpenStack Ubuntu <%= release.capitalize %> mirror
Architectures: amd64
Components: main universe
UDebComponents: main
Contents: .gz
Update: ubuntu
Log: <%= @logdir %>/ubuntu-<%= release %>.log
Origin: Ubuntu
Codename: <%= release %>-updates
Description: OpenStack Ubuntu <%= release.capitalize %> Updates mirror
Architectures: amd64
Components: main universe
UDebComponents: main
Contents: .gz
Update: ubuntu
Log: <%= @logdir %>/ubuntu-<%= release %>-updates.log
Origin: Ubuntu
Codename: <%= release %>-backports
Description: OpenStack Ubuntu <%= release.capitalize %> Backports mirror
Architectures: amd64
Components: main universe
UDebComponents: main
Contents: .gz
Update: ubuntu
Log: <%= @logdir %>/ubuntu-<%= release %>-backports.log
Origin: Ubuntu
Codename: <%= release %>-security
Description: OpenStack Ubuntu <%= release.capitalize %> Security mirror
Architectures: amd64
Components: main universe
UDebComponents: main
Contents: .gz
Update: ubuntu-security
Log: <%= @logdir %>/ubuntu-<%= release %>-security.log
<% end -%>