]> gitweb.fluxo.info Git - puppet-reprepro.git/commitdiff
Cleanup, variable scoping and styling
authorSilvio Rhatto <rhatto@riseup.net>
Sat, 26 Jan 2013 13:18:10 +0000 (11:18 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Sat, 26 Jan 2013 13:18:10 +0000 (11:18 -0200)
manifests/cron.pp
manifests/disabled.pp
manifests/init.pp
manifests/lighty.pp
templates/distributions.erb
templates/index.html.erb
templates/uploaders.erb

index 4cc7dd8e321e88d3552e2257b337426dd29c23c7..d07bb36a3df19b1d3be0aaaa2f14272b700bdf51 100644 (file)
@@ -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"] ]
   }
 }
index 9c822fcc3294b8324d23fc2f9f708b1894b2827d..69e7725599f3de49bb47af30f5fb6f58d7f6744b 100644 (file)
@@ -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,
   }
index 96ad467c0307d575451607ce1fa1f020e464bf9d..ec53e8604b1791cb590d10f2ffe619915e9ccf94 100644 (file)
@@ -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,
   }
index 24228cf84d35e9872003c0501fa8186ac9a93a6e..8b7f90fd9778414e127aba851aee0eed434fe605 100644 (file)
@@ -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'];
   }
 }
index 62d65021464f43a41d782f3f216cd889019ad84d..233e5b66d185ded5891b4588e028ba197b844338 100644 (file)
@@ -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
index ed077e9febb263b7b33bde04434ebd8bf7d22f13..ddc42bc925123291c42acd63d37aceccdf0dd35e 100644 (file)
@@ -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>
index ce5897d81062557760713724a92b70b557c46445..1f5414f47d294d12f779534460cc3730b1ee4d80 100644 (file)
@@ -1,4 +1,4 @@
 # reprepro uploaders, file managed by puppet
-<% reprepro_uploaders.each do |uploader| -%> 
+<% @uploaders.each do |uploader| -%> 
 allow * by key <%= uploader %>
 <% end -%>