summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README20
-rw-r--r--manifests/cron.pp8
-rw-r--r--manifests/init.pp99
-rw-r--r--manifests/inotify.pp31
-rw-r--r--templates/distributions.erb30
-rw-r--r--templates/index.html.erb2
-rw-r--r--templates/uploaders.erb2
-rw-r--r--tests/init.pp5
8 files changed, 98 insertions, 99 deletions
diff --git a/README b/README
index 2114f2d..64f4a90 100644
--- a/README
+++ b/README
@@ -1,8 +1,8 @@
-Variables
-=========
+Parameters
+==========
-$reprepro_manage_distributions_conf, $reprepro_manage_incoming_conf
--------------------------------------------------------------------
+manage_distributions_conf, manage_incoming_conf
+-----------------------------------------------
If true, the content of -respectively- the conf/distributions and
conf/incoming files is managed by this module. Else, only the
@@ -10,18 +10,18 @@ existence, ownership and permissions are.
Default: true.
-$reprepro_basedir_mode
------------------------
+basedir_mode
+------------
This module manages the reprepro base directory and sets its
-permissions to $reprepro_basedir_mode.
+permissions to `basedir_mode`.
Default: 0771
-$reprepro_incoming_mode
------------------------
+incoming_mode
+-------------
This module manages the reprepro incoming directory and sets its
-permissions to $reprepro_incoming_mode.
+permissions to `incoming_mode`.
Default: 1777
diff --git a/manifests/cron.pp b/manifests/cron.pp
deleted file mode 100644
index 1fae59e..0000000
--- a/manifests/cron.pp
+++ /dev/null
@@ -1,8 +0,0 @@
-class reprepro::cron inherits reprepro {
- cron { reprepro:
- command => "/usr/bin/reprepro --silent -b $basedir processincoming incoming",
- user => reprepro,
- minute => '*/5',
- require => [ Package['reprepro'], File["$basedir/conf/distributions"] ]
- }
-}
diff --git a/manifests/init.pp b/manifests/init.pp
index 77a014d..ebf8a91 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -1,38 +1,20 @@
-class reprepro {
-
- case $reprepro_manage_distributions_conf {
- '': { $reprepro_manage_distributions_conf = true }
- }
-
- case $reprepro_manage_incoming_conf {
- '': { $reprepro_manage_incoming_conf = true }
- }
-
- case $reprepro_origin {
- '': { $reprepro_origin = $domain }
- }
-
- case $reprepro_uploaders {
- '': { fail("You need the repository uploaders! Please set \$reprepro_uploaders in your config") }
- }
-
- $basedir = $reprepro_basedir ? {
- '' => '/srv/reprepro',
- default => $reprepro_basedir,
- }
-
+class reprepro (
+ $uploaders = 'undefined',
+ $basedir = '/srv/reprepro',
+ $origin = $::domain,
+ $basedir_mode = '0771',
+ $incoming_mode = '1777',
+ $manage_distributions_conf = true,
+ $manage_incoming_conf = true,
+ $handle_incoming_with_cron = false,
+ $handle_incoming_with_inotify = false,
+){
package {
"reprepro": ensure => 'installed';
}
- $basedir_mode = $reprepro_basedir_mode ? {
- '' => 0771,
- default => $reprepro_basedir_mode,
- }
-
- $incoming_mode = $reprepro_incoming_mode ? {
- '' => 1777,
- default => $reprepro_incoming_mode,
+ if $uploaders == 'undefined' {
+ fail("The uploaders parameter is required by the reprepro class.")
}
user { "reprepro":
@@ -113,7 +95,7 @@ class reprepro {
mode => 755,
}
- if $reprepro_manage_distributions_conf {
+ if $manage_distributions_conf {
File["$basedir/conf/distributions"] {
owner => root,
group => reprepro,
@@ -135,7 +117,7 @@ class reprepro {
}
}
- if $reprepro_manage_incoming_conf {
+ if $manage_incoming_conf {
File["$basedir/conf/incoming"] {
mode => 0664,
owner => root,
@@ -144,6 +126,57 @@ class reprepro {
}
}
+ # Handling of incoming with cron
+
+ $cron_presence = $handle_incoming_with_cron ? {
+ true => present,
+ default => absent,
+ }
+
+ cron { 'reprepro':
+ ensure => $cron_presence,
+ command => "/usr/bin/reprepro --silent -b $basedir processincoming incoming",
+ user => reprepro,
+ minute => '*/5',
+ require => [ Package['reprepro'], File["$basedir/conf/distributions"] ],
+ }
+
+ # Handling of incoming with inoticoming
+
+ $inoticoming_presence = $handle_incoming_with_inotify ? {
+ true => present,
+ default => absent,
+ }
+ $inoticoming_enabled = $handle_incoming_with_inotify ? {
+ true => true,
+ default => false,
+ }
+
+ package { 'inoticoming':
+ ensure => $inoticoming_presence,
+ }
+ file { '/etc/init.d/reprepro':
+ ensure => $inoticoming_presence,
+ owner => root,
+ group => root,
+ mode => 0755,
+ source => "puppet://${server}/modules/reprepro/inoticoming.init",
+ }
+ file { '/etc/default/reprepro':
+ ensure => $inoticoming_presence,
+ owner => root, group => root, mode => 0755,
+ content => template('reprepro/inoticoming.default.erb'),
+ }
+
+ service { 'reprepro':
+ ensure => $inoticoming_enabled,
+ enable => $inoticoming_enabled,
+ pattern => 'inoticoming.*reprepro.*processincoming',
+ hasstatus => false,
+ require => [ Package['inoticoming'],
+ File['/etc/default/reprepro'],
+ File['/etc/init.d/reprepro'] ],
+ }
exec {
"/usr/local/bin/reprepro-export-key":
diff --git a/manifests/inotify.pp b/manifests/inotify.pp
deleted file mode 100644
index 45fcb7e..0000000
--- a/manifests/inotify.pp
+++ /dev/null
@@ -1,31 +0,0 @@
-class reprepro::inotify inherits reprepro {
- case $lsbdistcodename {
- etch: {
- package {
- "inoticoming": ensure => '0.2.0-1~bpo40+1';
- }
- }
- default: {
- package {
- "inoticoming": ensure => 'installed';
- }
- }
- }
- file { "/etc/init.d/reprepro":
- owner => root, group => root, mode => 0755,
- source => "puppet://$server/modules/reprepro/inoticoming.init";
- }
- file { "/etc/default/reprepro":
- ensure => present,
- owner => root, group => root, mode => 0755,
- content => template('reprepro/inoticoming.default.erb'),
- }
-
- service { "reprepro":
- ensure => "running",
- pattern => "inoticoming.*reprepro.*processincoming",
- hasstatus => false,
- require => [File["/etc/default/reprepro"],
- File["/etc/init.d/reprepro"] ],
- }
-}
diff --git a/templates/distributions.erb b/templates/distributions.erb
index 8ec9883..44ba277 100644
--- a/templates/distributions.erb
+++ b/templates/distributions.erb
@@ -1,55 +1,55 @@
-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
-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
-Origin: <%= @reprepro_origin %>
-Label: <%= @reprepro_origin %>
+Origin: <%= @origin %>
+Label: <%= @origin %>
Suite: stable
Pull: testing
Codename: squeeze
Version: 6.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
-Origin: <%= @reprepro_origin %>
-Label: <%= @reprepro_origin %>
+Origin: <%= @origin %>
+Label: <%= @origin %>
Suite: testing
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
-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-sid
diff --git a/templates/index.html.erb b/templates/index.html.erb
index 1173021..acbe2f7 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.
diff --git a/templates/uploaders.erb b/templates/uploaders.erb
index d962b55..ea64e1d 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 -%>
diff --git a/tests/init.pp b/tests/init.pp
new file mode 100644
index 0000000..d8d40ed
--- /dev/null
+++ b/tests/init.pp
@@ -0,0 +1,5 @@
+class { 'reprepro':
+ uploaders => ['DEADBEEF'],
+ handle_incoming_with_cron => true,
+ handle_incoming_with_inotify => true,
+}