Commit 958cd6a5 authored by grisel-davy's avatar grisel-davy

ajout de l'option --force et du check regen

parent 95daef9b
...@@ -7,6 +7,7 @@ from django.core.mail import send_mail ...@@ -7,6 +7,7 @@ from django.core.mail import send_mail
from django.template import loader, Context from django.template import loader, Context
from pprint import pprint from pprint import pprint
import sys
config = ConfigParser() config = ConfigParser()
config.read('config.ini') config.read('config.ini')
...@@ -19,6 +20,10 @@ api_client = Re2oAPIClient(api_hostname,api_username,api_password) ...@@ -19,6 +20,10 @@ api_client = Re2oAPIClient(api_hostname,api_username,api_password)
client_hostname = socket.gethostname().split('.',1)[0] client_hostname = socket.gethostname().split('.',1)[0]
for arg in sys.argv:
if arg=="--force":
notif_end_adhesion(api_client)
def notif_end_adhesion(api_client): def notif_end_adhesion(api_client):
asso_options = api_client.list("preferences/assooption") asso_options = api_client.list("preferences/assooption")
from_mail = api_client.list("preferences/generaloption")["email_from"] from_mail = api_client.list("preferences/generaloption")["email_from"]
...@@ -40,3 +45,10 @@ def notif_end_adhesion(api_client): ...@@ -40,3 +45,10 @@ def notif_end_adhesion(api_client):
html_message = template.render(context) html_message = template.render(context)
) )
for service in api_client.list("services/regen/"):
if service['hostname'] == client_hostname and \
service['service_name'] == 'mail' and \
service['need_regen']:
notif_end_adhesion(api_client)
api_client.patch(service['api_url'], data={'need_regen': False})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment