ajoute le worker modifier_compte (paheko --> ldap)
This commit is contained in:
1 parent
79c0cc4057
commit
f6e6d8d8ac
2 files changed
+66
-2
No files matched your search
@@ -0,0 +1,64 @@
|
|||||||
|
import logging
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
def run(message, encours):
|
||||||
|
|
||||||
|
script = "gestUser.sh"
|
||||||
|
email_kaz = message["email_kaz"]
|
||||||
|
|
||||||
|
commandes = []
|
||||||
|
|
||||||
|
if message.get("modifier_mdp", False):
|
||||||
|
commandes.append([script, "-r", email_kaz])
|
||||||
|
|
||||||
|
if message.get("modifier_email_secours", False):
|
||||||
|
commandes.append([
|
||||||
|
script, "-s", email_kaz,
|
||||||
|
message["email_secours"]
|
||||||
|
])
|
||||||
|
|
||||||
|
if message.get("modifier_tel", False):
|
||||||
|
commandes.append([
|
||||||
|
script, "-t", email_kaz,
|
||||||
|
message["telephone"]
|
||||||
|
])
|
||||||
|
|
||||||
|
if message.get("modifier_quota", False):
|
||||||
|
commandes.append([
|
||||||
|
script, "-q", email_kaz,
|
||||||
|
str(message["quota_disque"])
|
||||||
|
])
|
||||||
|
|
||||||
|
if message.get("supprimer_membre", False):
|
||||||
|
commandes.append([script, "-d", email_kaz])
|
||||||
|
|
||||||
|
for command in commandes:
|
||||||
|
|
||||||
|
log.info(
|
||||||
|
f"Exécution : {' '.join(command)}"
|
||||||
|
)
|
||||||
|
|
||||||
|
result = subprocess.run(
|
||||||
|
command,
|
||||||
|
capture_output=True,
|
||||||
|
text=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
if result.stdout:
|
||||||
|
log.info(
|
||||||
|
f"Résultat du script :\n{result.stdout}"
|
||||||
|
)
|
||||||
|
|
||||||
|
if result.stderr:
|
||||||
|
log.warning(
|
||||||
|
f"Sortie stderr du script :\n{result.stderr}"
|
||||||
|
)
|
||||||
|
|
||||||
|
if result.returncode != 0:
|
||||||
|
raise RuntimeError(
|
||||||
|
f"Le script a échoué avec le code "
|
||||||
|
f"{result.returncode} : {' '.join(command)}"
|
||||||
|
)
|
||||||
@@ -14,8 +14,8 @@ import subprocess
|
|||||||
# ],
|
# ],
|
||||||
# "nom_court_orga": "monorga11",
|
# "nom_court_orga": "monorga11",
|
||||||
# "emails": [
|
# "emails": [
|
||||||
# "admin@kaz.bzh",
|
# "titi@toto.fr",
|
||||||
# "contact@kaz.bzh"
|
# "tata@toto.fr"
|
||||||
# ]
|
# ]
|
||||||
# }
|
# }
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user