summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2013-01-26 11:18:10 -0200
committerSilvio Rhatto <rhatto@riseup.net>2013-01-26 11:18:10 -0200
commite0d01e3746ed8052ef6ebe060b3f1e8ec98e3b76 (patch)
treea0a3601fa0dfd1d3094cd5beeabbc341d8146cef
parent26967edfd336d61dc9d71de89b559ae60efcd798 (diff)
downloadpuppet-reprepro-e0d01e3746ed8052ef6ebe060b3f1e8ec98e3b76.tar.gz
puppet-reprepro-e0d01e3746ed8052ef6ebe060b3f1e8ec98e3b76.tar.bz2
Cleanup, variable scoping and styling
-rw-r--r--manifests/cron.pp4
-rw-r--r--manifests/disabled.pp4
-rw-r--r--manifests/init.pp69
-rw-r--r--manifests/lighty.pp6
-rw-r--r--templates/distributions.erb24
-rw-r--r--templates/index.html.erb8
-rw-r--r--templates/uploaders.erb2
7 files changed, 57 insertions, 60 deletions
diff --git a/manifests/cron.pp b/manifests/cron.pp
index 4cc7dd8..d07bb36 100644
--- a/manifests/cron.pp
+++ b/manifests/cron.pp
@@ -1,8 +1,8 @@
class reprepro::cron {
cron { reprepro:
command => "/usr/bin/reprepro --silent -b ${reprepro::basedir} processincoming incoming",
- user => reprepro,
- minute => '*/5',
+ user => reprepro,
+ minute => '*/5',
require => [ Package['reprepro'], File["${reprepro::basedir}/conf/distributions"] ]
}
}
diff --git a/manifests/disabled.pp b/manifests/disabled.pp
index 9c822fc..69e7725 100644
--- a/manifests/disabled.pp
+++ b/manifests/disabled.pp
@@ -1,8 +1,8 @@
class reprepro::disabled(
- $basedir = '/srv/reprepro'
+ $basedir = '/srv/reprepro'
) {
cron { reprepro:
- command => "/usr/bin/reprepro --silent -b ${reprepro::basedir} processincoming incoming",
+ command => "/usr/bin/reprepro --silent -b ${basedir} processincoming incoming",
user => reprepro,
ensure => absent,
}
diff --git a/manifests/init.pp b/manifests/init.pp
index 96ad467..ec53e86 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -4,14 +4,11 @@ class reprepro(
$basedir = '/srv/reprepro'
) {
- $reprepro_origin = $origin
- $reprepro_uploaders = $uploaders
-
- case $reprepro_uploaders {
+ case $uploaders {
'': { fail("You need the repository uploaders! Please pass \$uploaders parameter") }
}
- case $lsbdistcodename {
+ case $::lsbdistcodename {
etch: {
package {
"reprepro": ensure => '3.9.2-1~bpo40+1';
@@ -25,12 +22,12 @@ class reprepro(
}
user { "reprepro":
- ensure => "present",
- home => "$basedir",
- gid => "reprepro",
+ ensure => "present",
+ home => "${basedir}",
+ gid => "reprepro",
password => "*",
- comment => "reprepro sandbox",
- require => Group["reprepro"],
+ comment => "reprepro sandbox",
+ require => Group["reprepro"],
}
group { "reprepro":
@@ -38,59 +35,59 @@ class reprepro(
}
file {
- "$basedir":
+ "${basedir}":
ensure => directory,
mode => 0771, owner => reprepro, group => reprepro;
- "$basedir/conf":
+ "${basedir}/conf":
ensure => directory,
mode => 0770, owner => root, group => reprepro;
- "$basedir/db":
+ "${basedir}/db":
ensure => directory,
mode => 0770, owner => reprepro, group => reprepro;
- "$basedir/dists":
+ "${basedir}/dists":
ensure => directory,
mode => 0775, owner => reprepro, group => reprepro;
- "$basedir/pool":
+ "${basedir}/pool":
ensure => directory,
mode => 0775, owner => reprepro, group => reprepro;
- "$basedir/incoming":
+ "${basedir}/incoming":
ensure => directory,
mode => 1777, owner => reprepro, group => reprepro;
- "$basedir/logs":
+ "${basedir}/logs":
ensure => directory,
mode => 0775, owner => reprepro, group => reprepro;
- "$basedir/tmp":
+ "${basedir}/tmp":
ensure => directory,
mode => 0775, owner => reprepro, group => reprepro;
- "$basedir/conf/distributions":
+ "${basedir}/conf/distributions":
mode => 0664, owner => root, group => reprepro,
content => template("reprepro/distributions.erb");
- "$basedir/conf/uploaders":
+ "${basedir}/conf/uploaders":
mode => 0660, owner => root, group => reprepro,
content => template("reprepro/uploaders.erb");
- "$basedir/conf/incoming":
+ "${basedir}/conf/incoming":
mode => 0664, owner => root, group => reprepro,
source => "puppet://$server/modules/reprepro/incoming";
- "$basedir/index.html":
+ "${basedir}/index.html":
mode => 0664, owner => root, group => reprepro,
content => template("reprepro/index.html.erb");
- "$basedir/.gnupg":
+ "${basedir}/.gnupg":
mode => 700, owner => reprepro, group => reprepro,
ensure => directory;
- "$basedir/.gnupg/secring.gpg":
+ "${basedir}/.gnupg/secring.gpg":
mode => 600, owner => reprepro, group => reprepro,
ensure => present;
@@ -103,26 +100,26 @@ class reprepro(
}
exec {
- "reprepro -b $basedir createsymlinks":
- command => "/usr/bin/reprepro -b $basedir --delete createsymlinks",
+ "reprepro -b ${basedir} createsymlinks":
+ command => "/usr/bin/reprepro -b ${basedir} --delete createsymlinks",
refreshonly => true,
- subscribe => File["$basedir/conf/distributions"],
- user => reprepro,
- path => "/usr/bin:/bin";
- "reprepro -b $basedir export":
- command => "/usbr/bin/reprepro -b $basedir export",
+ subscribe => File["${basedir}/conf/distributions"],
+ user => reprepro,
+ path => "/usr/bin:/bin";
+ "reprepro -b ${basedir} export":
+ command => "/usbr/bin/reprepro -b ${basedir} export",
refreshonly => true,
- user => reprepro,
- subscribe => File["$basedir/conf/distributions"],
- path => "/usr/bin:/bin";
+ user => reprepro,
+ subscribe => File["${basedir}/conf/distributions"],
+ path => "/usr/bin:/bin";
"/usr/local/bin/reprepro-export-key":
- creates => "$basedir/key.asc",
+ creates => "${basedir}/key.asc",
user => reprepro,
require => File["/usr/local/bin/reprepro-export-key"];
"/usr/local/bin/reprepro-export-key-update":
command => "/usr/local/bin/reprepro-export-key",
user => reprepro,
- subscribe => File["$basedir/.gnupg/secring.gpg"],
+ subscribe => File["${basedir}/.gnupg/secring.gpg"],
require => File["/usr/local/bin/reprepro-export-key"],
refreshonly => true,
}
diff --git a/manifests/lighty.pp b/manifests/lighty.pp
index 24228cf..8b7f90f 100644
--- a/manifests/lighty.pp
+++ b/manifests/lighty.pp
@@ -1,10 +1,10 @@
class reprepro::lighty inherits lighttpd {
file { "/etc/lighttpd/conf-available/20-reprepro.conf":
- ensure => present,
+ ensure => present,
content => "alias.url += ( \"/debian/\" => \"$reprepro::basedir/\" )\n";
"/etc/lighttpd/conf-enabled/20-reprepro.conf":
- ensure => "/etc/lighttpd/conf-available/20-reprepro.conf",
+ ensure => "/etc/lighttpd/conf-available/20-reprepro.conf",
require => File['/etc/lighttpd/conf-available/20-reprepro.conf'],
- notify => Service['lighttpd'];
+ notify => Service['lighttpd'];
}
}
diff --git a/templates/distributions.erb b/templates/distributions.erb
index 62d6502..233e5b6 100644
--- a/templates/distributions.erb
+++ b/templates/distributions.erb
@@ -1,11 +1,11 @@
-Origin: <%= reprepro_origin %>
-Label: <%= reprepro_origin %>
+Origin: <%= @origin %>
+Label: <%= @origin %>
Suite: reallyoldstable
Codename: etch
Version: 3.0
Architectures: i386 amd64 source kfreebsd-amd64 kfreebsd-i386
Components: main non-free contrib
-Description: <%= reprepro_origin %> specific (or backported) packages
+Description: <%= @origin %> specific (or backported) packages
SignWith: yes
Uploaders: uploaders
DebIndices: Packages Release . .gz .bz2
@@ -13,15 +13,15 @@ UDebIndices: Packages . .gz .bz2
DscIndices: Sources Release .gz .bz2
Contents: . .gz .bz2
-Origin: <%= reprepro_origin %>
-Label: <%= reprepro_origin %>
+Origin: <%= @origin %>
+Label: <%= @origin %>
Suite: oldstable
Pull: stable
Codename: lenny
Version: 5.0
Architectures: i386 amd64 source kfreebsd-amd64 kfreebsd-i386
Components: main non-free contrib
-Description: <%= reprepro_origin %> specific (or backported) packages
+Description: <%= @origin %> specific (or backported) packages
SignWith: yes
Uploaders: uploaders
DebIndices: Packages Release . .gz .bz2
@@ -29,8 +29,8 @@ UDebIndices: Packages . .gz .bz2
DscIndices: Sources Release .gz .bz2
Contents: . .gz .bz2
-Origin: <%= reprepro_origin %>
-Label: <%= reprepro_origin %>
+Origin: <%= @origin %>
+Label: <%= @origin %>
Suite: stable
Pull: testing
Codename: squeeze
@@ -52,7 +52,7 @@ Pull: unstable
Codename: wheezy
Architectures: i386 amd64 source kfreebsd-amd64 kfreebsd-i386
Components: main non-free contrib
-Description: <%= reprepro_origin %> specific (or backported) packages
+Description: <%= @origin %> specific (or backported) packages
SignWith: yes
Uploaders: uploaders
DebIndices: Packages Release . .gz .bz2
@@ -60,13 +60,13 @@ UDebIndices: Packages . .gz .bz2
DscIndices: Sources Release .gz .bz2
Contents: . .gz .bz2
-Origin: <%= reprepro_origin %>
-Label: <%= reprepro_origin %>
+Origin: <%= @origin %>
+Label: <%= @origin %>
Suite: unstable
Codename: sid
Architectures: i386 amd64 source kfreebsd-amd64 kfreebsd-i386
Components: main non-free contrib
-Description: <%= reprepro_origin %> specific (or backported) packages
+Description: <%= @origin %> specific (or backported) packages
SignWith: yes
Uploaders: uploaders
DebIndices: Packages Release . .gz .bz2
diff --git a/templates/index.html.erb b/templates/index.html.erb
index ed077e9..ddc42bc 100644
--- a/templates/index.html.erb
+++ b/templates/index.html.erb
@@ -5,7 +5,7 @@
<body>
<h1>Introduction</h1>
-<p>This is the Debian package repository of <%= reprepro_origin %>. It is used for internal
+<p>This is the Debian package repository of <%= @origin %>. It is used for internal
distribution of locally built packages not yet part of Debian. Feel free to use
it for yourself, but it comes at no warranty.
@@ -14,8 +14,8 @@ it for yourself, but it comes at no warranty.
<p>In your /etc/apt/sources.list:
<pre>
-deb http://debian.<%= domain %>/debian squeeze main
-deb-src http://debian.<%= domain %>/debian squeeze main
+deb http://debian.<%= scope.lookupvar('::domain') %>/debian squeeze main
+deb-src http://debian.<%= scope.lookupvar('::domain') %>/debian squeeze main
</pre>
"squeeze", of course, can be replaced by your distribution.
@@ -30,7 +30,7 @@ more precise).</p>
<p>The key of the archive is in the <a href="/key.asc">key.asc file</a>. You should add the key using something like this:</p>
<pre>
-wget http://debian.<%= domain %>/debian/key.asc
+wget http://debian.<%= scope.lookupvar('::domain') %>/debian/key.asc
apt-key add key.asc
apt-get update
</pre>
diff --git a/templates/uploaders.erb b/templates/uploaders.erb
index ce5897d..1f5414f 100644
--- a/templates/uploaders.erb
+++ b/templates/uploaders.erb
@@ -1,4 +1,4 @@
# reprepro uploaders, file managed by puppet
-<% reprepro_uploaders.each do |uploader| -%>
+<% @uploaders.each do |uploader| -%>
allow * by key <%= uploader %>
<% end -%>