From 7ec1b3d7e36bb57cb09678634a9c8d1696434fee Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Mon, 8 Feb 2016 11:58:53 -0600 Subject: [PATCH] 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 --- .../files/reprepro/reprepro-mirror-update.sh | 9 +- modules/openstack_project/manifests/mirror.pp | 4 +- .../manifests/mirror_update.pp | 11 ++- .../openstack_project/manifests/reprepro.pp | 20 +++-- .../reprepro/distributions.debian.erb | 41 +++++++++ .../templates/reprepro/distributions.erb | 83 ------------------- .../reprepro/distributions.ubuntu.erb | 41 +++++++++ 7 files changed, 111 insertions(+), 98 deletions(-) create mode 100644 modules/openstack_project/templates/reprepro/distributions.debian.erb delete mode 100644 modules/openstack_project/templates/reprepro/distributions.erb create mode 100644 modules/openstack_project/templates/reprepro/distributions.ubuntu.erb diff --git a/modules/openstack_project/files/reprepro/reprepro-mirror-update.sh b/modules/openstack_project/files/reprepro/reprepro-mirror-update.sh index 8478967e32..4f86f583a4 100644 --- a/modules/openstack_project/files/reprepro/reprepro-mirror-update.sh +++ b/modules/openstack_project/files/reprepro/reprepro-mirror-update.sh @@ -16,8 +16,11 @@ set -e -UNREF_FILE=/var/run/reprepro/unreferenced-files -REPREPRO='k5start -t -f /etc/reprepro.keytab service/reprepro -- timeout -k 2m 30m reprepro --confdir /etc/reprepro' +REPREPRO_CONFIG=$1 +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" $REPREPRO update @@ -35,6 +38,6 @@ $REPREPRO checkpool fast $REPREPRO check 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." diff --git a/modules/openstack_project/manifests/mirror.pp b/modules/openstack_project/manifests/mirror.pp index 40225c058e..054ce098ac 100644 --- a/modules/openstack_project/manifests/mirror.pp +++ b/modules/openstack_project/manifests/mirror.pp @@ -51,9 +51,9 @@ class openstack_project::mirror ( } # Create the symlink to apt. - file { "${www_root}/apt": + file { "${www_root}/ubuntu": ensure => link, - target => "${mirror_root}/apt", + target => "${mirror_root}/ubuntu", owner => root, group => root, require => [ diff --git a/modules/openstack_project/manifests/mirror_update.pp b/modules/openstack_project/manifests/mirror_update.pp index 08d3df1eaa..c7af1161d4 100644 --- a/modules/openstack_project/manifests/mirror_update.pp +++ b/modules/openstack_project/manifests/mirror_update.pp @@ -59,7 +59,10 @@ class openstack_project::mirror_update ( } 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': @@ -78,9 +81,13 @@ class openstack_project::mirror_update ( } cron { 'reprepro': + ensure => absent, + } + + cron { 'reprepro ubuntu': user => $user, 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', require => [ File['/usr/local/bin/reprepro-mirror-update'], diff --git a/modules/openstack_project/manifests/reprepro.pp b/modules/openstack_project/manifests/reprepro.pp index 32f1534269..0c653abe96 100644 --- a/modules/openstack_project/manifests/reprepro.pp +++ b/modules/openstack_project/manifests/reprepro.pp @@ -1,13 +1,13 @@ # == Class: openstack_project::mirror_update # class openstack_project::reprepro ( - $basedir = '/afs/.openstack.org/mirror/apt', + $confdir, + $basedir, + $distributions, $logdir = '/var/log/reprepro', $updates_file = 'puppet:///modules/openstack_project/reprepro/updates', $options_template = 'openstack_project/reprepro/options.erb', - $distributions_template = 'openstack_project/reprepro/distributions.erb', - $ubuntu_releases = [], - $debian_releases = [], + $releases = [], ) { package { 'reprepro': @@ -22,11 +22,15 @@ class openstack_project::reprepro ( ensure => directory, } + file { "$confdir": + ensure => directory, + } + file { '/var/run/reprepro': ensure => directory, } - file { '/etc/reprepro/updates': + file { "${confdir}/updates": ensure => present, owner => 'root', group => 'root', @@ -34,7 +38,7 @@ class openstack_project::reprepro ( source => $updates_file, } - file { '/etc/reprepro/options': + file { "${confdir}/options": ensure => present, owner => 'root', group => 'root', @@ -42,11 +46,11 @@ class openstack_project::reprepro ( content => template($options_template), } - file { '/etc/reprepro/distributions': + file { "${confdir}/distributions": ensure => present, owner => 'root', group => 'root', mode => '0755', - content => template($distributions_template), + content => template($distributions), } } diff --git a/modules/openstack_project/templates/reprepro/distributions.debian.erb b/modules/openstack_project/templates/reprepro/distributions.debian.erb new file mode 100644 index 0000000000..921cf47705 --- /dev/null +++ b/modules/openstack_project/templates/reprepro/distributions.debian.erb @@ -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 -%> diff --git a/modules/openstack_project/templates/reprepro/distributions.erb b/modules/openstack_project/templates/reprepro/distributions.erb deleted file mode 100644 index aca3cf1b53..0000000000 --- a/modules/openstack_project/templates/reprepro/distributions.erb +++ /dev/null @@ -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 -%> diff --git a/modules/openstack_project/templates/reprepro/distributions.ubuntu.erb b/modules/openstack_project/templates/reprepro/distributions.ubuntu.erb new file mode 100644 index 0000000000..50ec1bb176 --- /dev/null +++ b/modules/openstack_project/templates/reprepro/distributions.ubuntu.erb @@ -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 -%>