226 lines
3.4 KiB
Python
226 lines
3.4 KiB
Python
#!/usr/bin/env python3
|
|
# fullfillment_pipeline.py
|
|
# zentrales Orchestrierungsskript für die Fullfillment Pipeline
|
|
# Maintainer: peignerpausz
|
|
# Version: 1.0.0
|
|
|
|
import subprocess
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
BASE_DIR = Path(__file__).resolve().parent
|
|
|
|
PIPELINE = [
|
|
|
|
"pendingcontractsparser.py",
|
|
|
|
"fullfillment_updater.py",
|
|
|
|
"generate_spamcontrol_credentials.py",
|
|
|
|
"generate_spamcontrol_mails.py",
|
|
|
|
"generate_mailcloud_mails.py",
|
|
|
|
"generate_domainprotection_mails.py",
|
|
|
|
"generate_vipsupport_mails.py",
|
|
|
|
"jira_updater.py"
|
|
|
|
]
|
|
|
|
|
|
def banner(title):
|
|
|
|
print()
|
|
print("=" * 70)
|
|
print(title)
|
|
print("=" * 70)
|
|
print()
|
|
|
|
|
|
def run_script(script_name):
|
|
|
|
script = BASE_DIR / script_name
|
|
|
|
if not script.exists():
|
|
|
|
print(
|
|
f"[WARN] "
|
|
f"{script_name} "
|
|
f"nicht gefunden."
|
|
)
|
|
|
|
return False
|
|
|
|
print(
|
|
f"[RUN] "
|
|
f"{script_name}"
|
|
)
|
|
|
|
result = subprocess.run(
|
|
[
|
|
sys.executable,
|
|
str(script)
|
|
],
|
|
cwd=BASE_DIR
|
|
)
|
|
|
|
if result.returncode != 0:
|
|
|
|
print(
|
|
f"[ERROR] "
|
|
f"{script_name}"
|
|
)
|
|
|
|
return False
|
|
|
|
print(
|
|
f"[OK] "
|
|
f"{script_name}"
|
|
)
|
|
|
|
return True
|
|
|
|
|
|
def run_pipeline():
|
|
|
|
banner(
|
|
"FULLFILLMENT PIPELINE"
|
|
)
|
|
|
|
for script in PIPELINE:
|
|
|
|
success = run_script(
|
|
script
|
|
)
|
|
|
|
if not success:
|
|
|
|
print()
|
|
print(
|
|
"Pipeline abgebrochen."
|
|
)
|
|
|
|
return
|
|
|
|
print()
|
|
print(
|
|
"Pipeline erfolgreich abgeschlossen."
|
|
)
|
|
|
|
|
|
def menu():
|
|
|
|
while True:
|
|
|
|
banner(
|
|
"FULLFILLMENT AUTOMATISIERER"
|
|
)
|
|
|
|
print(
|
|
"1) Pending Contracts parsen"
|
|
)
|
|
|
|
print(
|
|
"2) Aktivierungsliste erzeugen"
|
|
)
|
|
|
|
print(
|
|
"3) SpamControl Zugangsdaten"
|
|
)
|
|
|
|
print(
|
|
"4) SpamControl Mailvorlagen"
|
|
)
|
|
|
|
print(
|
|
"5) Mailcloud Vorlagen"
|
|
)
|
|
|
|
print(
|
|
"6) Domain Protection Vorlagen"
|
|
)
|
|
|
|
print(
|
|
"7) VIP Support Vorlagen"
|
|
)
|
|
|
|
print(
|
|
"8) Jira Dry Run"
|
|
)
|
|
|
|
print(
|
|
"9) Gesamte Pipeline"
|
|
)
|
|
|
|
print(
|
|
"0) Beenden"
|
|
)
|
|
|
|
choice = input(
|
|
"\nAuswahl: "
|
|
).strip()
|
|
|
|
mapping = {
|
|
|
|
"1":
|
|
"pendingcontractsparser.py",
|
|
|
|
"2":
|
|
"fullfillment_updater.py",
|
|
|
|
"3":
|
|
"generate_spamcontrol_credentials.py",
|
|
|
|
"4":
|
|
"generate_spamcontrol_mails.py",
|
|
|
|
"5":
|
|
"generate_mailcloud_mails.py",
|
|
|
|
"6":
|
|
"generate_domainprotection_mails.py",
|
|
|
|
"7":
|
|
"generate_vipsupport_mails.py",
|
|
|
|
"8":
|
|
"jira_updater.py"
|
|
|
|
}
|
|
|
|
if choice == "0":
|
|
|
|
print(
|
|
"\nAuf Wiedersehen."
|
|
)
|
|
|
|
break
|
|
|
|
elif choice == "9":
|
|
|
|
run_pipeline()
|
|
|
|
elif choice in mapping:
|
|
|
|
run_script(
|
|
mapping[choice]
|
|
)
|
|
|
|
else:
|
|
|
|
print(
|
|
"\nUngültige Auswahl."
|
|
)
|
|
|
|
input(
|
|
"\nENTER drücken..."
|
|
)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
menu()
|