From b07f0c0edb8d687bcd3c06d3c185bf49fc2e2754 Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Sat, 7 Jan 2012 23:19:13 +0000 Subject: split maintdb in a separate class, and clean it a little bit --- modules/buildsystem/manifests/init.pp | 74 --------------------------- modules/buildsystem/manifests/maintdb.pp | 71 +++++++++++++++++++++++++ modules/buildsystem/templates/sudoers.maintdb | 4 +- modules/buildsystem/templates/wrapper.maintdb | 2 +- 4 files changed, 74 insertions(+), 77 deletions(-) create mode 100644 modules/buildsystem/manifests/maintdb.pp diff --git a/modules/buildsystem/manifests/init.pp b/modules/buildsystem/manifests/init.pp index d51c0be4..8deed56f 100644 --- a/modules/buildsystem/manifests/init.pp +++ b/modules/buildsystem/manifests/init.pp @@ -112,80 +112,6 @@ class buildsystem { } } - class maintdb inherits base { - include sudo - $maintdb_login = "maintdb" - $maintdb_homedir = "/var/lib/maintdb" - $maintdb_dbdir = "$maintdb_homedir/db" - $maintdb_binpath = "/usr/local/sbin/maintdb" - $maintdb_wrappath = "/usr/local/bin/wrapper.maintdb" - $maintdb_dump = "/var/www/bs/data/maintdb.txt" - $maintdb_unmaintained = "/var/www/bs/data/unmaintained.txt" - - user {"$maintdb_login": - ensure => present, - comment => "Maintainers database", - managehome => true, - shell => "/bin/bash", - home => "$maintdb_homedir", - } - - file { "$maintdb_homedir": - ensure => directory, - owner => "$maintdb_login", - group => "$maintdb_login", - mode => 711, - require => User["$maintdb_login"], - } - - file { "$maintdb_dbdir": - ensure => directory, - owner => "$maintdb_login", - group => "$maintdb_login", - mode => 711, - require => User["$maintdb_login"], - } - - file { "$maintdb_binpath": - ensure => present, - owner => root, - group => root, - mode => 755, - content => template("buildsystem/maintdb") - } - - file { "$maintdb_wrappath": - ensure => present, - owner => root, - group => root, - mode => 755, - content => template("buildsystem/wrapper.maintdb") - } - - sudo::sudoers_config { "maintdb": - content => template("buildsystem/sudoers.maintdb") - } - - file { ["$maintdb_dump","$maintdb_dump.new"]: - ensure => present, - owner => $maintdb_login, - mode => 644, - require => File["/var/www/bs/data"], - } - - cron { "update maintdb export": - user => $maintdb_login, - command => "$maintdb_binpath root get > $maintdb_dump.new; mv -f $maintdb_dump.new $maintdb_dump; grep ' nobody\$' $maintdb_dump | sed 's/ nobody\$//' > $maintdb_unmaintained.new; mv -f $maintdb_unmaintained.new $maintdb_unmaintained", - minute => "*/30", - require => User[$maintdb_login], - } - - apache::vhost_base { "maintdb.$domain": - location => $maintdb_dbdir, - content => template("buildsystem/vhost_maintdb.conf"), - } - } - class binrepo inherits base { include sudo $binrepo_login = "binrepo" diff --git a/modules/buildsystem/manifests/maintdb.pp b/modules/buildsystem/manifests/maintdb.pp new file mode 100644 index 00000000..3e231745 --- /dev/null +++ b/modules/buildsystem/manifests/maintdb.pp @@ -0,0 +1,71 @@ +class buildsystem { + class maintdb inherits base { + include sudo + $maintdb_login = "maintdb" + $maintdb_homedir = "/var/lib/maintdb" + $maintdb_dbdir = "$maintdb_homedir/db" + $maintdb_binpath = "/usr/local/sbin/maintdb" + $maintdb_wrappath = "/usr/local/bin/wrapper.maintdb" + $maintdb_dump = "/var/www/bs/data/maintdb.txt" + $maintdb_unmaintained = "/var/www/bs/data/unmaintained.txt" + + user {"$maintdb_login": + ensure => present, + comment => "Maintainers database", + managehome => true, + shell => "/bin/bash", + home => "$maintdb_homedir", + } + + file { "$maintdb_homedir": + ensure => directory, + owner => "$maintdb_login", + group => "$maintdb_login", + mode => 711, + require => User["$maintdb_login"], + } + + file { "$maintdb_dbdir": + ensure => directory, + owner => "$maintdb_login", + group => "$maintdb_login", + mode => 711, + require => User["$maintdb_login"], + } + + file { "$maintdb_binpath": + mode => 755, + content => template("buildsystem/maintdb") + } + + file { "$maintdb_wrappath": + mode => 755, + content => template("buildsystem/wrapper.maintdb") + } + + sudo::sudoers_config { "maintdb": + content => template("buildsystem/sudoers.maintdb") + } + + file { ["$maintdb_dump","$maintdb_dump.new", + "$maintdb_unmaintained","$maintdb_unmaintained.new"]: + ensure => present, + owner => $maintdb_login, + mode => 644, + require => File["/var/www/bs/data"], + } + + cron { "update maintdb export": + user => $maintdb_login, + command => "$maintdb_binpath root get > $maintdb_dump.new; mv -f $maintdb_dump.new $maintdb_dump; grep ' nobody\$' $maintdb_dump | sed 's/ nobody\$//' > $maintdb_unmaintained.new; mv -f $maintdb_unmaintained.new $maintdb_unmaintained", + minute => "*/30", + require => User[$maintdb_login], + } + + apache::vhost_base { "maintdb.$domain": + location => $maintdb_dbdir, + content => template("buildsystem/vhost_maintdb.conf"), + } + } +} + diff --git a/modules/buildsystem/templates/sudoers.maintdb b/modules/buildsystem/templates/sudoers.maintdb index 26e8a26d..7503eae4 100644 --- a/modules/buildsystem/templates/sudoers.maintdb +++ b/modules/buildsystem/templates/sudoers.maintdb @@ -1,2 +1,2 @@ -%<%= packagers_group %> ALL =(<%= maintdb_login %>) NOPASSWD: <%= maintdb_binpath %> -<%= sched_login %> ALL =(<%= maintdb_login %>) NOPASSWD: <%= maintdb_binpath %> +%<%= scope.lookupvar('buildsystem::base::packagers_group') %> ALL =(<%= maintdb_login %>) NOPASSWD: <%= maintdb_binpath %> +<%= scope.lookupvar('buildsystem::base::sched_login') %> ALL =(<%= maintdb_login %>) NOPASSWD: <%= maintdb_binpath %> diff --git a/modules/buildsystem/templates/wrapper.maintdb b/modules/buildsystem/templates/wrapper.maintdb index 2f6e2324..a1ebf1f0 100644 --- a/modules/buildsystem/templates/wrapper.maintdb +++ b/modules/buildsystem/templates/wrapper.maintdb @@ -2,7 +2,7 @@ maintdbuser="<%= maintdb_login %>" maintdbpath="<%= maintdb_binpath %>" -packagersgroup="<%= packagers_group %>" +packagersgroup="<%= scope.lookupvar('buildsystem::base::packagers_group') %>" function isingroup() { -- cgit v1.2.1