diff --git a/bcfg2/bcfg2-report.py b/bcfg2/bcfg2_report.py similarity index 75% rename from bcfg2/bcfg2-report.py rename to bcfg2/bcfg2_report.py index d4870339..0d97c083 100755 --- a/bcfg2/bcfg2-report.py +++ b/bcfg2/bcfg2_report.py @@ -3,6 +3,8 @@ """ Envoie un mail avec la liste des serveurs qui ne sont pas synchro avec bcfg2. + Si appelé sans l'option ``--mail``, affiche le résultat sur stdout. + N'affiche que ceux qui datent d'aujourd'hui, hier ou avant-hier (pour ne pas avoir les vieux serveurs qui traînent). @@ -39,6 +41,9 @@ if __name__ == "__main__": print(hosts, file=sys.stderr) exit(1) debug = "--debug" in sys.argv - sys.path.append("/usr/scripts/") - import utils.sendmail - utils.sendmail.sendmail("root@crans.org", "roots@crans.org", u"Serveurs non synchronisés avec bcfg2", hosts, more_headers={"X-Mailer" : "bcfg2-reports"}, debug=debug) + if "--mail" in sys.argv: + sys.path.append("/usr/scripts/") + import utils.sendmail + utils.sendmail.sendmail("root@crans.org", "roots@crans.org", u"Serveurs non synchronisés avec bcfg2", hosts, more_headers={"X-Mailer" : "bcfg2-reports"}, debug=debug) + else: + print(hosts)