John F. Lewis has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/232494

Change subject: add disable/enable list script to mailman::scripts
......................................................................

add disable/enable list script to mailman::scripts

To make things simplier and more uniform, add a script that can be ran to
disable and enable mailman lists through configuration variables only.

Change-Id: I354475e0c2071c9d18ce7c8d2e039898b36ce86c
---
A modules/mailman/files/scripts/disable_list.sh
M modules/mailman/manifests/scripts.pp
2 files changed, 60 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/94/232494/1

diff --git a/modules/mailman/files/scripts/disable_list.sh 
b/modules/mailman/files/scripts/disable_list.sh
new file mode 100644
index 0000000..8dbf14a
--- /dev/null
+++ b/modules/mailman/files/scripts/disable_list.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+#
+# Enables and Disables a Mailman mailing list simply thorugh configuration 
settings.
+#
+# John Lewis 2015
+
+ENABLE=0
+
+function disable_list {
+    echo "advertised=0" | config_list -i /dev/stdin $list
+    echo "emergency=1"  | config_list -i /dev/stdin $list
+    echo "member_moderation_action=2" | config_list -i /dev/stdin $list
+    echo "generic_nonmember_action=2" | config_list -i /dev/stdin $list
+    rm /var/lib/mailman/data/heldmsg-$list-*.pck
+}
+
+function enable_list {
+    echo "advertised=1" | config_list -i /dev/stdin $list
+    echo "emergency=0"  | config_list -i /dev/stdin $list
+    echo "member_moderation_action=0" | config_list -i /dev/stdin $list
+    echo "generic_nonmember_action=1" | config_list -i /dev/stdin $list
+}
+
+function usage {
+    echo "Usage: $0 [-e|--enable] <listname>"; exit 1;
+}
+
+while test "$#" -gt 0; do
+    case "$1" in
+        --help|-h)
+            usage
+            exit 0
+            ;;
+        --enable|-e)
+            ENABLE=1
+            shift
+            ;;
+        *)
+            list=$1
+            shift
+            ;;
+
+    esac
+done
+
+if [ $ENABLE -eq 1 ]; then
+    enable_list
+    echo "$list enabled. Please verify archives are intact and the list 
administrative page works."
+else
+    disable_list
+    echo "$list disabled. Archives should be available at current location, 
all mail should be moderated and the list should not be on the listinfo page."
+fi
diff --git a/modules/mailman/manifests/scripts.pp 
b/modules/mailman/manifests/scripts.pp
index 4612112..2b2f8d7 100644
--- a/modules/mailman/manifests/scripts.pp
+++ b/modules/mailman/manifests/scripts.pp
@@ -24,4 +24,12 @@
         mode   => '0540',
         source => 'puppet:///modules/mailman/scripts/import_all_lists.sh'
     }
+
+    file { '/var/lib/mailman/bin/disable_list.sh':
+        ensure => 'present',
+        owner  => 'root',
+        group  => 'list',
+        mode   => '0540',
+        source => 'puppet:///modules/mailman/scripts/disable_list.sh'
+    }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/232494
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I354475e0c2071c9d18ce7c8d2e039898b36ce86c
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: John F. Lewis <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to