diff --git a/Base/needed.xml b/Base/needed.xml index 034cf67..56bf727 100644 --- a/Base/needed.xml +++ b/Base/needed.xml @@ -18,7 +18,6 @@ - diff --git a/Cfg/etc/cron.daily/mailWarn_dirtyDarcsRepo/info.xml b/Cfg/etc/cron.daily/mailWarn_dirtyDarcsRepo/info.xml deleted file mode 100644 index a0b21f3..0000000 --- a/Cfg/etc/cron.daily/mailWarn_dirtyDarcsRepo/info.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/Cfg/etc/cron.daily/mailWarn_dirtyDarcsRepo/mailWarn_dirtyDarcsRepo b/Cfg/etc/cron.daily/mailWarn_dirtyDarcsRepo/mailWarn_dirtyDarcsRepo deleted file mode 100755 index 72723c1..0000000 --- a/Cfg/etc/cron.daily/mailWarn_dirtyDarcsRepo/mailWarn_dirtyDarcsRepo +++ /dev/null @@ -1,113 +0,0 @@ -#! /usr/bin/env python -# -*- coding: UTF-8 -*- -# -# mailWarn_dirtyDarcsRepo : envoie un email de notification si les dépôts -# darcs enregistrés sur le serveur contiennent des fichiers qui ne sont -# pas à jour. -# -# Copyright (C) 2007 Nicolas Dandrimont -# Basé sur mailWarn_dirtyEtc écrit par Fred et Jérémie Dimino -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; version 2 dated June, -# 1991. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# - - -import smtplib, os, time, sys, subprocess -from socket import gethostname - -os.umask(0002) - -hostname = gethostname().split(".")[0] - -##### CONFIG - -checks = [ '/etc' ] -hostspecificchecks = { -# Passé sous git -# 'bcfg2' : [ '/var/lib/bcfg2' ] , -# 'vert' : [ '/usr/scripts' ] , - 'zamok' : [ '/var/www' ] , - } -checks += hostspecificchecks.get(hostname,[]) - -# Paramètres du mail -params = { 'from_name' : '%s Darcs' % hostname.capitalize() , - 'from_addr' : 'roots@crans.org' , - 'to' : 'roots@crans.org' , - 'subject' : 'Darcs Whatsnew sur %s' % hostname.capitalize() } - -##### FIN CONFIG - -def send_mail(mailhost='localhost', mailport=25): - - barre = '='*25 + '\n' - - # Récupération des dossiers dans lesquels Darcs est effectivement installé - dirs = [] - for dir in checks: - if os.access(dir + "/_darcs", os.F_OK): - dirs.append(dir) - - if dirs == []: - return - - # Valeurs initiales - resume = '' - details = '' - - for dir in dirs: - # Récupération de l'état des fichiers - darcs = subprocess.Popen(["darcs","whatsnew","-s"], cwd = dir, - stdout = subprocess.PIPE) - - if darcs.wait() == 1: - # À l'ouest, rien de nouveau - continue - - lines = darcs.stdout.read() - - resume += barre - resume += 'Fichiers non a jour sur le depot %s de %s\n' % (dir, - hostname) - resume += barre - resume += lines - resume += '\n' - - if not resume: - # Pas de fichiers non à jour - return - - # Préparation du mail - params['date'] = time.strftime('%a, %d %b %Y %H:%M:%S +0000', - time.gmtime(time.time())) - - mail = 'From: %(from_name)s <%(from_addr)s>\n\ -To: %(to)s\n\ -Subject: %(subject)s\n\ -X-CVSinfo: CRANS\n\ -X-DarcsInfo: CRANS\n\ -Date: %(date)s\n\ -X-Mailer: Python Darcs Check\n\n' % params - mail += resume - mail += '\n' - - # Envoi du mail - conn = smtplib.SMTP() - conn.connect(mailhost, mailport) - conn.sendmail(params['from_addr'], params['to'], mail) - conn.close() - -if __name__ == '__main__': - send_mail()