Merge pull request 'New and improved with central fullfillment-pipeline and check for customer name and email adress' (#25) from peignerpausz-patch-1 into main
Reviewed-on: #25 Reviewed-by: Loki <alexander@dominikus.one>
This commit was merged in pull request #25.
This commit is contained in:
commit
8e62cb9001
15 files changed
+1345
-64
No files matched your search
@@ -67,6 +67,8 @@ Optimierte Bash-Konfigurationen für verschiedene Support-Umgebungen:
|
||||
Dieses Skript stellt eine SSH-Verbindung zu einem angegebenen Webserver her und generiert so einen einmaligen Login-Link für das Plesk Admin Panel des gewünschten Servers.
|
||||
- [`wh20`](./wh20/wh20)
|
||||
Dieses Skript verbindet zum angegbenen Webserver via SSH
|
||||
- [`pendingcontracts`](./wh20/pendingcontracts)
|
||||
Diese Sammlung von Skripten ermöglicht eine Beschleunigung bei der Bearbeitung offener Bestellungen im oneCRM. Zentral ist dabei das [`fullfillment_pipeline.py`-Skript](./wh20/pendingcontracts/fullfillment_pipeline.py), das die anderen Skripte orchestriert. Die anderen Skripte können auch unabhängig voneinander benutzt werden.
|
||||
- [`damagecontrol`](./wh20/damagereport)
|
||||
Dieses Skript ermöglicht die kombinierte Abfrage zu geläufigen Problemen mit MS365-Empfängern über [`checkms`](./legacy/checkms), [`adspam`](./wh20/adspam), [`donaspam`](wh20/donaspam) sowie [`spamcheck` selbst](.wh20/spamcheck).
|
||||
- [`adspam`](./adspam)
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"folders": [
|
||||
{
|
||||
"path": "."
|
||||
}
|
||||
],
|
||||
"settings": {}
|
||||
}
|
||||
@@ -26,6 +26,10 @@ Dieses Skript stellt eine SSH-Verbindung zu einem angegebenen Webserver her und
|
||||
Dieses Skript verbindet zum angegbenen Webserver via SSH
|
||||
- [Dokumentation & Beispiele](./wh20/README.md)
|
||||
|
||||
### [`pendingcontracts`](./pendingcontracts)
|
||||
Diese Sammlung von Python-Skripten ermöglicht eine schnellere Bearbeitung der offenen Bestellugnen im oneCRM bzw. im Jira-Fulllfimmentboard. Die einzelnen Skripte können auch unabhängig voneinander verwendet werden, allerdings empfiehlt es sich direkt mit der Fullfillment-Pipeline als Orchestrator zu arbeiten.
|
||||
- [Dokumentation & Beispiele](./pendingcontracts/README.md)
|
||||
|
||||
### [`spamcheck`](./spamcheck)
|
||||
Dieses Skript ermöglicht den schnellen Check nach MS365-Fehlercodes, sowie für Spamhaus-Blockmeldungen.
|
||||
- [Dokumentation & Beispiele](./spamcheck/README.md)
|
||||
|
||||
@@ -1,3 +1,326 @@
|
||||
# Pending Contract Parser und Mailtools
|
||||
# Fullfillment Automatisierer
|
||||
|
||||
tba.
|
||||
## Kurzbeschreibung des Projekts
|
||||
|
||||
Der Fullfillment Automatisierer unterstützt die Bearbeitung manuell bereitzustellender easyname-Produkte. Das System verarbeitet OneCRM-Bestellungen, gleicht diese mit offenen Jira-Fulfillment-Tickets ab, erzeugt Aktivierungslisten sowie Mailvorlagen und bereitet Jira-Kommentare für die Bearbeitung vor. Die einzelnen Werkzeuge werden über einen zentralen Orchestrator (`fulfillment_pipeline.py`) gesteuert.
|
||||
|
||||
---
|
||||
|
||||
## Architektur
|
||||
|
||||
```text
|
||||
OneCRM JSON Exporte
|
||||
│
|
||||
▼
|
||||
pendingcontractsparser.py
|
||||
│
|
||||
▼
|
||||
activation_overview.csv
|
||||
│
|
||||
▼
|
||||
fullfillment_updater.py
|
||||
│
|
||||
▼
|
||||
activation_checklist.md
|
||||
│
|
||||
├─────────────► generate_spamcontrol_credentials.py
|
||||
│
|
||||
├─────────────► generate_spamcontrol_mails.py
|
||||
│
|
||||
├─────────────► generate_mailversand_mails.py
|
||||
│
|
||||
├─────────────► generate_domainprotection_mails.py
|
||||
│
|
||||
├─────────────► generate_vipsupport_mails.py
|
||||
│
|
||||
▼
|
||||
jira_updater.py
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Komponenten
|
||||
|
||||
### pendingcontractsparser.py
|
||||
|
||||
Verarbeitet die aus OneCRM exportierten JSON-Dateien und erzeugt die zentrale Aktivierungsdatenbank:
|
||||
|
||||
```text
|
||||
activation_overview.csv
|
||||
```
|
||||
|
||||
Enthaltene Informationen:
|
||||
|
||||
- Bestellnummer
|
||||
- Bestelldatum
|
||||
- Kundennummer
|
||||
- Kundenname
|
||||
- Kunden-E-Mail
|
||||
- Produkt
|
||||
- Domain
|
||||
|
||||
---
|
||||
|
||||
### fullfillment_updater.py
|
||||
|
||||
Gleicht offene Jira-Fulfillment-Tickets mit den Aktivierungsdaten ab.
|
||||
|
||||
Funktionen:
|
||||
|
||||
- Jira API Abfrage
|
||||
- ADF Parsing
|
||||
- Produktnormalisierung
|
||||
- Kundennummern-Erkennung
|
||||
- CSV Matching
|
||||
- Statistik
|
||||
- Fehleranalyse
|
||||
|
||||
Erzeugt:
|
||||
|
||||
```text
|
||||
activation_checklist.md
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### jira_updater.py
|
||||
|
||||
Verarbeitet die erzeugte Aktivierungsliste.
|
||||
|
||||
Aktuelle Version:
|
||||
|
||||
- Dry Run
|
||||
- Zendesk-Ticketübernahme
|
||||
- Kommentarvorschau
|
||||
- Vorbereitung für Jira-Kommentare
|
||||
- Vorbereitung für Statuswechsel
|
||||
|
||||
Kommentarformat:
|
||||
|
||||
```text
|
||||
2026-11-11 17:51
|
||||
|
||||
Spam Control für thehousegras.com
|
||||
|
||||
Siehe Zendesk-Ticket: 19564741
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### generate_spamcontrol_credentials.py
|
||||
|
||||
Erzeugt automatisch:
|
||||
|
||||
```text
|
||||
Login
|
||||
Passwort
|
||||
Kunden-E-Mail
|
||||
```
|
||||
|
||||
für SpamControl-Konten.
|
||||
|
||||
---
|
||||
|
||||
### generate_spamcontrol_mails.py
|
||||
|
||||
Erzeugt Mailvorlagen für:
|
||||
|
||||
```text
|
||||
Spam Control
|
||||
```
|
||||
|
||||
inklusive Verzögerungshinweis bei älteren Bestellungen.
|
||||
|
||||
---
|
||||
|
||||
### generate_mailversand_mails.py
|
||||
|
||||
Erzeugt Mailvorlagen für:
|
||||
|
||||
```text
|
||||
Mailversand Basic
|
||||
Mailversand Pro
|
||||
```
|
||||
|
||||
und berücksichtigt automatisch, ob bereits eine Domain hinterlegt wurde.
|
||||
|
||||
---
|
||||
|
||||
### generate_domainprotection_mails.py
|
||||
|
||||
Erzeugt Bereitstellungsmails für:
|
||||
|
||||
```text
|
||||
Domain Protection
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### generate_vipsupport_mails.py
|
||||
|
||||
Erzeugt Bereitstellungsmails für:
|
||||
|
||||
```text
|
||||
VIP Support
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## fulfillment_pipeline.py
|
||||
|
||||
Der Orchestrator dient als zentrale Einstiegskomponente.
|
||||
|
||||
Alle Einzelskripte bleiben unabhängig nutzbar, können jedoch komfortabel über den Orchestrator ausgeführt werden.
|
||||
|
||||
### Standardaufruf
|
||||
|
||||
```bash
|
||||
python3 fulfillment_pipeline.py
|
||||
```
|
||||
|
||||
Es erscheint ein interaktives Menü.
|
||||
|
||||
### Menü
|
||||
|
||||
```text
|
||||
1) Pending Contracts parsen
|
||||
2) Aktivierungsliste erzeugen
|
||||
3) SpamControl Zugangsdaten
|
||||
4) SpamControl Mailvorlagen
|
||||
5) Mailcloud Vorlagen
|
||||
6) Domain Protection Vorlagen
|
||||
7) VIP Support Vorlagen
|
||||
8) Jira Dry Run
|
||||
9) Gesamte Pipeline
|
||||
0) Beenden
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Typischer Workflow
|
||||
|
||||
### Neue Pending Contracts verarbeiten
|
||||
|
||||
```bash
|
||||
python3 fulfillment_pipeline.py
|
||||
```
|
||||
|
||||
Option:
|
||||
|
||||
```text
|
||||
9) Gesamte Pipeline
|
||||
```
|
||||
|
||||
Dadurch werden automatisch ausgeführt:
|
||||
|
||||
```text
|
||||
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
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Installation
|
||||
|
||||
Repository klonen:
|
||||
|
||||
```bash
|
||||
git clone <gitea-url>/fullfillmentautomatisierer.git
|
||||
|
||||
cd fullfillmentautomatisierer
|
||||
```
|
||||
|
||||
Skripte ausführbar machen:
|
||||
|
||||
```bash
|
||||
chmod +x *.py
|
||||
```
|
||||
|
||||
Abhängigkeiten:
|
||||
|
||||
```bash
|
||||
sudo apt-get oder pip install requests
|
||||
|
||||
Für Jira:
|
||||
|
||||
export JIRA_USER="euer Jira-User, meistens eure Mailadresse"
|
||||
export JIRA_TOKEN="<jira-token>"
|
||||
```
|
||||
|
||||
Anschließend:
|
||||
|
||||
```bash
|
||||
source ~/.bashrc
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Verzeichnisstruktur
|
||||
|
||||
```text
|
||||
fullfillmentautomatisierer/
|
||||
│
|
||||
├── fulfillment_pipeline.py
|
||||
│
|
||||
├── pendingcontractspar*er.py
|
||||
├── fullfillment_updater.py
|
||||
|── jira_updater.py
|
||||
│
|
||||
├── generate_spamcontrol_credentials.py
|
||||
├── gene*ate_spamcontrol_mails.py
|
||||
├── gener*te_mailversand_mails.py
|
||||
├── genera*e_domainprotection_mails.py
|
||||
├── generate_vipsupport_mails.py
|
||||
│
|
||||
├── activation_overview.csv
|
||||
├── activationchecklist.md
|
||||
│
|
||||
├── spamcontrol_credentials/
|
||||
├── spamcontrol_templates/
|
||||
├── mailversand_templates/
|
||||
├── domainprotection_templates/
|
||||
└── vipsupport_templates/
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Setup-Hinweise
|
||||
|
||||
```
|
||||
#Optional Alias anlegen:
|
||||
|
||||
alias fulfillment='python3 ~/esn-support-work/fullfillmentautomatisierer/fulfillment_pipeline.py'
|
||||
|
||||
#Danach:
|
||||
|
||||
source ~/.bashrc
|
||||
|
||||
#Anschließend genügt:
|
||||
|
||||
fulfillment
|
||||
```
|
||||
|
||||
|
||||
---
|
||||
|
||||
### Notes
|
||||
|
||||
- Die Skripte können einzeln oder über den Orchestrator ausgeführt werden.
|
||||
- Die Aktivierungsliste (`activation_checklist.md` dient als zentrale Arbeitsgrundlage.
|
||||
- Das Matching erfolgt über Kundennummer und Produkt.
|
||||
- Unterschiedliche Jira- und OneCRM-Bestellnummern werden bewusst ignoriert.
|
||||
- Die aktuelle Jira-Integration arbeitet standardmäßig im Dry-Run-Modus.
|
||||
- Die Architektur ist bewusst modular gehalten, sodass weitere Produkttypen unkompliziert ergänzt werden können.
|
||||
@@ -0,0 +1,225 @@
|
||||
#!/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()
|
||||
@@ -0,0 +1,457 @@
|
||||
#!/usr/bin/env python3
|
||||
# fullfillment_updater.py
|
||||
# zentrales Skript für die Aktualisierung der Fulfillment-Tickets in Jira
|
||||
# Maintainer: peignerpausz
|
||||
# Version: 1.0.0
|
||||
|
||||
import re
|
||||
import csv
|
||||
import base64
|
||||
import requests
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
# ==================================================
|
||||
# KONFIGURATION
|
||||
# ==================================================
|
||||
|
||||
JIRA_BASE_URL = "https://group-one.atlassian.net"
|
||||
|
||||
USER_EMAIL = "patrick.eigner-pausz@easyname.at"
|
||||
API_TOKEN = "ATATT3xFfGF0iyWQgMQK0nzyAAv0CzsNW0A3edG3Tn24d4xR9rWUPa-tjwN58KGPkfbLpYEZThwVYY6KJVWQNwSqi6XPyktF0rcz9J_qkRLMwdADiB29ngg1UsCle-gkA0jQGHSyEBg7h52Rh_L5TcbvzSv6z6E-BO_WFYRrkBQPUg-RJLkZcO8=7AB0E5BE"
|
||||
|
||||
JQL_QUERY = (
|
||||
'project = FUL AND '
|
||||
'(textfields ~ "easyname-Bestellung*" OR textfields ~ "easyname Bestellung*") AND '
|
||||
'statusCategory != Done '
|
||||
'ORDER BY created ASC'
|
||||
)
|
||||
|
||||
INPUT_CSV = "activation_overview.csv"
|
||||
OUTPUT_MD = "activation_checklist.md"
|
||||
|
||||
# ==================================================
|
||||
# AUTH
|
||||
# ==================================================
|
||||
|
||||
auth_string = f"{USER_EMAIL}:{API_TOKEN}"
|
||||
|
||||
encoded_auth = base64.b64encode(
|
||||
auth_string.encode("utf-8")
|
||||
).decode("utf-8")
|
||||
|
||||
HEADERS = {
|
||||
"Accept": "application/json",
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": f"Basic {encoded_auth}"
|
||||
}
|
||||
|
||||
# ==================================================
|
||||
# ADF -> TEXT
|
||||
# ==================================================
|
||||
|
||||
def adf_to_text(node):
|
||||
|
||||
if node is None:
|
||||
return ""
|
||||
|
||||
if isinstance(node, str):
|
||||
return node
|
||||
|
||||
if isinstance(node, list):
|
||||
return " ".join(
|
||||
adf_to_text(item)
|
||||
for item in node
|
||||
)
|
||||
|
||||
if isinstance(node, dict):
|
||||
|
||||
parts = []
|
||||
|
||||
if "text" in node:
|
||||
parts.append(node["text"])
|
||||
|
||||
if "content" in node:
|
||||
parts.append(
|
||||
adf_to_text(node["content"])
|
||||
)
|
||||
|
||||
return " ".join(parts)
|
||||
|
||||
return ""
|
||||
|
||||
# ==================================================
|
||||
# KUNDE AUS JIRA ERMITTELN
|
||||
# ==================================================
|
||||
|
||||
def extract_customer_number(text):
|
||||
|
||||
match = re.search(
|
||||
r"Kunde:\s*(\d+)",
|
||||
text,
|
||||
re.IGNORECASE
|
||||
)
|
||||
|
||||
if match:
|
||||
return match.group(1)
|
||||
|
||||
return None
|
||||
|
||||
# ==================================================
|
||||
# PRODUKT AUS JIRA ERMITTELN
|
||||
# ==================================================
|
||||
# ==================================================
|
||||
# PRODUKTNORMALISIERUNG
|
||||
# ==================================================
|
||||
|
||||
PRODUCT_ALIASES = {
|
||||
|
||||
# Spam Control
|
||||
|
||||
"spam control": "SpamControl",
|
||||
"spamcontrol": "SpamControl",
|
||||
"spam-control": "SpamControl",
|
||||
|
||||
# Mailversand Basic
|
||||
|
||||
"Mailversand Basic": "Mailversand Basic",
|
||||
"mailversand basic": "Mailversand Basic",
|
||||
"mailversand-basic": "Mailversand Basic",
|
||||
"mail basic": "Mailversand Basic",
|
||||
|
||||
# Mailversand Pro
|
||||
|
||||
"Mailversand Pro": "Mailversand Pro",
|
||||
"mailversand pro": "Mailversand Pro",
|
||||
"mailversand-pro": "Mailversand Pro",
|
||||
"mail pro": "Mailversand Pro",
|
||||
|
||||
# Domain Protection
|
||||
|
||||
"Domain Protection": "Domain Protection",
|
||||
"domain protection": "Domain Protection",
|
||||
"domain-protection": "Domain Protection",
|
||||
"domainprotect": "Domain Protection",
|
||||
|
||||
# VIP Support
|
||||
|
||||
"VIP Support": "VIP Support",
|
||||
"vip support": "VIP Support",
|
||||
"vip-support": "VIP Support",
|
||||
"priority support": "VIP Support",
|
||||
|
||||
# Wp Premium Care
|
||||
"WP Premium Care Basic ": "WP Premium Care Basic",
|
||||
"WP Premium Care Premium": "WP Premium Care Premium",
|
||||
"WP Premium Care Professional": "WP Premium Care Professional"
|
||||
}
|
||||
|
||||
|
||||
def normalize_product(product):
|
||||
|
||||
if not product:
|
||||
return None
|
||||
|
||||
key = (
|
||||
product
|
||||
.strip()
|
||||
.lower()
|
||||
)
|
||||
|
||||
return PRODUCT_ALIASES.get(
|
||||
key,
|
||||
product.strip()
|
||||
)
|
||||
|
||||
def extract_product(text):
|
||||
|
||||
lower = text.lower()
|
||||
|
||||
#
|
||||
# Produkt-ID hat Vorrang
|
||||
#
|
||||
|
||||
if "(6051)" in text:
|
||||
return "SpamControl"
|
||||
|
||||
if "(6052)" in text:
|
||||
return "Mailversand Basic"
|
||||
|
||||
if "(6053)" in text:
|
||||
return "Mailversand Pro"
|
||||
|
||||
if "(6057)" in text:
|
||||
return "Domain Protection"
|
||||
|
||||
if "(6054)" in text:
|
||||
return "WP Premium Care Basic"
|
||||
|
||||
if "(6055)" in text:
|
||||
return "WP Premium Care Premium"
|
||||
|
||||
if "(6056)" in text:
|
||||
return "WP Premium Care Professional"
|
||||
|
||||
#
|
||||
# Fallback auf Namen
|
||||
#
|
||||
|
||||
for alias, canonical in PRODUCT_ALIASES.items():
|
||||
|
||||
if alias in lower:
|
||||
return canonical
|
||||
|
||||
return None
|
||||
|
||||
# ==================================================
|
||||
# JIRA API
|
||||
# ==================================================
|
||||
|
||||
def search_issues():
|
||||
|
||||
url = (
|
||||
f"{JIRA_BASE_URL}"
|
||||
"/rest/api/3/search/jql"
|
||||
)
|
||||
|
||||
payload = {
|
||||
"jql": JQL_QUERY,
|
||||
"maxResults": 500,
|
||||
"fields": [
|
||||
"summary",
|
||||
"status",
|
||||
"description",
|
||||
"created"
|
||||
]
|
||||
}
|
||||
|
||||
response = requests.post(
|
||||
url,
|
||||
headers=HEADERS,
|
||||
json=payload
|
||||
)
|
||||
|
||||
response.raise_for_status()
|
||||
|
||||
return response.json().get(
|
||||
"issues",
|
||||
[]
|
||||
)
|
||||
|
||||
# ==================================================
|
||||
# CSV LADEN
|
||||
# ==================================================
|
||||
|
||||
activation_data = {}
|
||||
|
||||
with open(
|
||||
INPUT_CSV,
|
||||
newline="",
|
||||
encoding="utf-8"
|
||||
) as f:
|
||||
|
||||
reader = csv.DictReader(f)
|
||||
|
||||
for row in reader:
|
||||
|
||||
normalized_product = normalize_product(
|
||||
row["product"]
|
||||
)
|
||||
|
||||
key = (
|
||||
row["customer_no"].strip(),
|
||||
normalized_product
|
||||
)
|
||||
|
||||
activation_data[key] = row
|
||||
|
||||
print(
|
||||
f"{len(activation_data)} "
|
||||
"Aktivierungsdatensätze geladen."
|
||||
)
|
||||
|
||||
# ==================================================
|
||||
# JIRA TICKETS HOLEN
|
||||
# ==================================================
|
||||
|
||||
print("Lade Jira-Tickets...")
|
||||
|
||||
issues = search_issues()
|
||||
|
||||
print(f"{len(issues)} Tickets gefunden.")
|
||||
|
||||
merged = []
|
||||
|
||||
for issue in issues:
|
||||
|
||||
jira_key = issue["key"]
|
||||
|
||||
status = (
|
||||
issue["fields"]["status"]["name"]
|
||||
)
|
||||
|
||||
summary = (
|
||||
issue["fields"]
|
||||
.get("summary", "")
|
||||
)
|
||||
|
||||
description = (
|
||||
issue["fields"]
|
||||
.get("description")
|
||||
)
|
||||
|
||||
description_text = (
|
||||
adf_to_text(description)
|
||||
)
|
||||
|
||||
search_text = (
|
||||
summary
|
||||
+ "\n"
|
||||
+ description_text
|
||||
)
|
||||
|
||||
customer_no = extract_customer_number(
|
||||
search_text
|
||||
)
|
||||
|
||||
product = extract_product(
|
||||
search_text
|
||||
)
|
||||
|
||||
if not customer_no:
|
||||
|
||||
print(
|
||||
f"[WARN] Keine Kundennummer "
|
||||
f"gefunden: {jira_key}"
|
||||
)
|
||||
|
||||
continue
|
||||
|
||||
if not product:
|
||||
|
||||
print(
|
||||
f"[WARN] Kein Produkt "
|
||||
f"gefunden: {jira_key}"
|
||||
)
|
||||
|
||||
continue
|
||||
|
||||
match_key = (
|
||||
|
||||
customer_no.strip(),
|
||||
|
||||
normalize_product(product)
|
||||
|
||||
)
|
||||
|
||||
if match_key not in activation_data:
|
||||
|
||||
print(
|
||||
f"[WARN] Kein Match: "
|
||||
f"{jira_key} -> "
|
||||
f"{customer_no} / "
|
||||
f"{product}"
|
||||
)
|
||||
|
||||
continue
|
||||
|
||||
activation = activation_data[
|
||||
match_key
|
||||
]
|
||||
|
||||
merged.append({
|
||||
|
||||
"jira": jira_key,
|
||||
|
||||
"status": status,
|
||||
|
||||
"order_no":
|
||||
activation["order_no"],
|
||||
|
||||
"order_date":
|
||||
activation["order_date"],
|
||||
|
||||
"product":
|
||||
activation["product"],
|
||||
|
||||
"domain":
|
||||
activation["domain"],
|
||||
|
||||
"customer":
|
||||
activation["customer_name"],
|
||||
|
||||
"customer_no":
|
||||
activation["customer_no"]
|
||||
})
|
||||
|
||||
# ==================================================
|
||||
# ÄLTESTE ZUERST
|
||||
# ==================================================
|
||||
|
||||
merged.sort(
|
||||
key=lambda item:
|
||||
datetime.strptime(
|
||||
item["order_date"],
|
||||
"%Y-%m-%d"
|
||||
)
|
||||
)
|
||||
|
||||
# ==================================================
|
||||
# MARKDOWN ERZEUGEN
|
||||
# ==================================================
|
||||
|
||||
with open(
|
||||
OUTPUT_MD,
|
||||
"w",
|
||||
encoding="utf-8"
|
||||
) as md:
|
||||
|
||||
md.write(
|
||||
"# Aktivierungsliste\n\n"
|
||||
)
|
||||
|
||||
md.write(
|
||||
"Älteste Bestellungen zuerst.\n\n"
|
||||
)
|
||||
|
||||
md.write(
|
||||
f"Generiert: "
|
||||
f"{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n\n"
|
||||
)
|
||||
|
||||
current_date = None
|
||||
|
||||
for item in merged:
|
||||
|
||||
if item["order_date"] != current_date:
|
||||
|
||||
current_date = item[
|
||||
"order_date"
|
||||
]
|
||||
|
||||
md.write(
|
||||
f"\n## {current_date}\n\n"
|
||||
)
|
||||
|
||||
md.write(
|
||||
"- [ ] "
|
||||
"Zendesk: __________\n"
|
||||
f" Jira: {item['jira']}\n"
|
||||
f" Status: {item['status']}\n"
|
||||
f" Kunde: {item['customer']}\n"
|
||||
f" Kundennr.: {item['customer_no']}\n"
|
||||
f" Produkt: {item['product']}\n"
|
||||
f" Domain: {item['domain']}\n"
|
||||
f" Bestellung: {item['order_no']}\n\n"
|
||||
)
|
||||
|
||||
print()
|
||||
print(
|
||||
f"{len(merged)} Tickets erfolgreich gematcht."
|
||||
)
|
||||
print(
|
||||
f"Markdown-Datei geschrieben:"
|
||||
)
|
||||
print(
|
||||
f" {OUTPUT_MD}"
|
||||
)
|
||||
@@ -1,4 +1,8 @@
|
||||
#!/usr/bin/env python3
|
||||
# generate_domainprotection_mails.py
|
||||
# Skript zur Erstellung von E-Mail-Templates für Domain Protection Bestellungen
|
||||
# Maintainer: peignerpausz
|
||||
# Version: 1.0.0
|
||||
|
||||
import csv
|
||||
from pathlib import Path
|
||||
|
||||
Regular → Executable
+19
-1
@@ -1,6 +1,11 @@
|
||||
#!/usr/bin/env python3
|
||||
# generate_domainprotection_mails.py
|
||||
# Skript zur Erstellung von E-Mail-Templates für Domain Protection Bestellungen
|
||||
# Maintainer: peignerpausz
|
||||
# Version: 1.0.0
|
||||
|
||||
import csv
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
INPUT_CSV = "activation_overview.csv"
|
||||
@@ -34,6 +39,19 @@ with open(INPUT_CSV, newline="", encoding="utf-8") as f:
|
||||
|
||||
if not domain:
|
||||
|
||||
try:
|
||||
verification_code = subprocess.check_output(
|
||||
["pwgen-tyhicks.pwgen", "-ya", "10", "1"],
|
||||
text=True
|
||||
).strip()
|
||||
except FileNotFoundError:
|
||||
print(
|
||||
"FEHLER: pwgen ist nicht installiert.\n"
|
||||
"Installation unter Ubuntu:\n"
|
||||
"sudo apt install pwgen"
|
||||
)
|
||||
exit(1)
|
||||
|
||||
mail = f"""Guten Tag {customer_name},
|
||||
|
||||
vielen Dank für Ihre Bestellung des erweiterten Mailversands!
|
||||
@@ -52,7 +70,7 @@ Sollte die Wahl auf die Option mit DKIM-Signierung fallen, teilen Sie uns bitte
|
||||
|
||||
Falls diese Domain nicht über easyname verwaltet wird, hinterlegen Sie bitte zur Verifizierung einen TXT-Eintrag mit einem Wert nach folgendem Muster:
|
||||
|
||||
easyname-verify-XXXXXXXXXX
|
||||
easyname-verify-{verification_code}
|
||||
|
||||
Daraufhin senden wir Ihnen die Postausgangsserver-Zugangsdaten inklusive Hostnamen, Benutzername, Passwort sowie die benötigten SPF- und gegebenenfalls DKIM-Einträge zu.
|
||||
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
#!/usr/bin/env python3
|
||||
# generate_spamcontrol_credentials.py
|
||||
# Skript zur Erstellung von Spam Control Zugangsdaten
|
||||
# Maintainer: peignerpausz
|
||||
# Version: 1.0.0
|
||||
|
||||
import csv
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
INPUT_CSV = "activation_overview.csv"
|
||||
OUTPUT_DIR = "spamcontrol_credentials"
|
||||
|
||||
Path(OUTPUT_DIR).mkdir(exist_ok=True)
|
||||
|
||||
for old_file in Path(OUTPUT_DIR).glob("*.txt"):
|
||||
old_file.unlink()
|
||||
|
||||
with open(INPUT_CSV, newline="", encoding="utf-8") as f:
|
||||
|
||||
reader = csv.DictReader(f)
|
||||
|
||||
for row in reader:
|
||||
|
||||
if row["product"] != "Spam Control":
|
||||
continue
|
||||
|
||||
domain = row["domain"].strip()
|
||||
|
||||
if not domain:
|
||||
print(
|
||||
f"Übersprungen (keine Domain): "
|
||||
f"Bestellung {row['order_no']}"
|
||||
)
|
||||
continue
|
||||
|
||||
try:
|
||||
password = (
|
||||
subprocess.check_output(
|
||||
["pwgen-tyhicks.pwgen", "-ya", "16", "1"],
|
||||
text=True
|
||||
)
|
||||
.strip()
|
||||
)
|
||||
|
||||
except FileNotFoundError:
|
||||
print(
|
||||
"FEHLER: pwgen ist nicht installiert.\n"
|
||||
"Installation unter Ubuntu:\n"
|
||||
"sudo apt install pwgen"
|
||||
)
|
||||
exit(1)
|
||||
|
||||
customer_email = row.get(
|
||||
"customer_email",
|
||||
""
|
||||
).strip()
|
||||
|
||||
content = f"""Login: {domain}
|
||||
PW: {password}
|
||||
E-Mail: {customer_email}
|
||||
"""
|
||||
|
||||
safe_domain = (
|
||||
domain
|
||||
.replace("/", "_")
|
||||
.replace("\\", "_")
|
||||
.replace(":", "_")
|
||||
)
|
||||
|
||||
filename = (
|
||||
Path(OUTPUT_DIR)
|
||||
/ f"{safe_domain}.txt"
|
||||
)
|
||||
|
||||
with open(filename, "w", encoding="utf-8") as out:
|
||||
out.write(content)
|
||||
|
||||
print(f"Erstellt: {filename}")
|
||||
|
||||
print("\nFertig.")
|
||||
@@ -1,4 +1,8 @@
|
||||
#!/usr/bin/env python3
|
||||
# generate_spamcontrol_mails.py
|
||||
# Skript zur Erstellung von E-Mail-Templates für Spam Control Bestellungen
|
||||
# Maintainer: peignerpausz
|
||||
# Version: 1.0.0
|
||||
|
||||
import csv
|
||||
from pathlib import Path
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
#!/usr/bin/env python3
|
||||
# generate_domainprotection_mails.py
|
||||
# Skript zur Erstellung von E-Mail-Templates für Domain Protection Bestellungen
|
||||
# Maintainer: peignerpausz
|
||||
# Version: 1.0.0
|
||||
|
||||
import csv
|
||||
from pathlib import Path
|
||||
|
||||
@@ -0,0 +1,186 @@
|
||||
#!/usr/bin/env python3
|
||||
# jira_updater.py
|
||||
# Skript zur Aktualisierung von Jira-Tickets basierend auf der Fulfillment-Checkliste
|
||||
# Maintainer: peignerpausz
|
||||
# Version: 1.0.0
|
||||
|
||||
import re
|
||||
from datetime import datetime
|
||||
|
||||
CHECKLIST_FILE = "activation_checklist.md"
|
||||
|
||||
|
||||
def load_checklist():
|
||||
|
||||
with open(
|
||||
CHECKLIST_FILE,
|
||||
"r",
|
||||
encoding="utf-8"
|
||||
) as f:
|
||||
markdown = f.read()
|
||||
|
||||
matches = re.findall(
|
||||
r"Zendesk:\s*(.*?)\s*\n"
|
||||
r"\s*Jira:\s*(FUL-\d+)\s*\n"
|
||||
r"\s*Status:\s*(.*?)\s*\n"
|
||||
#r"\s*Kunde:\s*(.*?)\s*\n"
|
||||
r"\s*Kunde:\s*([^\n]*)\n"
|
||||
r"\s*Kundennr\.\:\s*(\d+)\s*\n"
|
||||
r"\s*Produkt:\s*(.*?)\s*\n"
|
||||
r"\s*Domain:\s*(.*?)\s*\n"
|
||||
r"\s*Bestellung:\s*(\d+)",
|
||||
markdown,
|
||||
re.MULTILINE
|
||||
)
|
||||
|
||||
tickets = []
|
||||
|
||||
for (
|
||||
zendesk,
|
||||
jira,
|
||||
status,
|
||||
customer,
|
||||
customer_no,
|
||||
product,
|
||||
domain,
|
||||
order_no
|
||||
) in matches:
|
||||
|
||||
tickets.append({
|
||||
"zendesk": zendesk.strip(),
|
||||
"jira": jira.strip(),
|
||||
"status": status.strip(),
|
||||
"customer": customer.strip(),
|
||||
"customer_no": customer_no.strip(),
|
||||
"product": product.strip(),
|
||||
"domain": domain.strip(),
|
||||
"order_no": order_no.strip()
|
||||
})
|
||||
|
||||
return tickets
|
||||
|
||||
|
||||
def build_comment(
|
||||
zendesk,
|
||||
product,
|
||||
domain
|
||||
):
|
||||
|
||||
timestamp = datetime.now().strftime(
|
||||
"%Y-%m-%d %H:%M"
|
||||
)
|
||||
|
||||
zendesk = zendesk.strip()
|
||||
|
||||
if zendesk:
|
||||
return (
|
||||
f"{timestamp}\n\n"
|
||||
f"{product} für {domain}\n\n"
|
||||
f"Siehe Zendesk-Ticket: {zendesk}"
|
||||
)
|
||||
return (
|
||||
f"{timestamp}\n\n"
|
||||
f"{product} für {domain}"
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
try:
|
||||
|
||||
tickets = load_checklist()
|
||||
|
||||
except FileNotFoundError:
|
||||
|
||||
print(
|
||||
f"Datei nicht gefunden: "
|
||||
f"{CHECKLIST_FILE}"
|
||||
)
|
||||
|
||||
return
|
||||
|
||||
print()
|
||||
print("================================")
|
||||
print("JIRA UPDATER V1")
|
||||
print("DRY RUN")
|
||||
print("================================")
|
||||
print()
|
||||
|
||||
print(
|
||||
f"{len(tickets)} Tickets "
|
||||
f"aus Markdown geladen.\n"
|
||||
)
|
||||
|
||||
if not tickets:
|
||||
|
||||
print(
|
||||
"Keine Tickets erkannt."
|
||||
)
|
||||
|
||||
return
|
||||
|
||||
for ticket in tickets:
|
||||
|
||||
comment = build_comment(
|
||||
ticket["zendesk"],
|
||||
ticket["product"],
|
||||
ticket["domain"]
|
||||
)
|
||||
|
||||
print("================================")
|
||||
print(ticket["jira"])
|
||||
print("================================")
|
||||
print(
|
||||
f"Status : "
|
||||
f"{ticket['status']}"
|
||||
)
|
||||
|
||||
print(
|
||||
f"Kunde : "
|
||||
f"{ticket['customer']}"
|
||||
)
|
||||
|
||||
print(
|
||||
f"Kundennr. : "
|
||||
f"{ticket['customer_no']}"
|
||||
)
|
||||
|
||||
print(
|
||||
f"Produkt : "
|
||||
f"{ticket['product']}"
|
||||
)
|
||||
|
||||
print(
|
||||
f"Domain : "
|
||||
f"{ticket['domain']}"
|
||||
)
|
||||
|
||||
print(
|
||||
f"Bestellung : "
|
||||
f"{ticket['order_no']}"
|
||||
)
|
||||
|
||||
print()
|
||||
print("Kommentar:")
|
||||
print("--------------------------------")
|
||||
|
||||
print(comment)
|
||||
|
||||
print("--------------------------------")
|
||||
print()
|
||||
|
||||
print(
|
||||
f"{len(tickets)} Tickets "
|
||||
f"würden verarbeitet werden."
|
||||
)
|
||||
|
||||
print()
|
||||
print(
|
||||
"Es wurden keine Änderungen "
|
||||
"an Jira durchgeführt."
|
||||
)
|
||||
print()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1,33 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import csv
|
||||
from datetime import datetime
|
||||
|
||||
INPUT_CSV = "activation_overview.csv"
|
||||
|
||||
ticket = input("Ticketnummer: ").strip()
|
||||
order_no = input("Bestellnummer: ").strip()
|
||||
|
||||
found = False
|
||||
|
||||
with open(INPUT_CSV, newline="", encoding="utf-8") as f:
|
||||
|
||||
reader = csv.DictReader(f)
|
||||
|
||||
for row in reader:
|
||||
|
||||
if row["order_no"] == order_no:
|
||||
|
||||
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M")
|
||||
|
||||
print("\n--- JIRA Status ---\n")
|
||||
print(
|
||||
f"{timestamp} {ticket}\n\n"
|
||||
f"{row['product']} für {row['domain']}"
|
||||
)
|
||||
|
||||
found = True
|
||||
break
|
||||
|
||||
if not found:
|
||||
print("Bestellung nicht gefunden.")
|
||||
@@ -27,6 +27,11 @@ def get_customer_name(order):
|
||||
return f"{firstname} {lastname}".strip()
|
||||
|
||||
|
||||
def get_customer_email(order):
|
||||
customer = order.get("customer", {})
|
||||
return customer.get("email", "").strip()
|
||||
|
||||
|
||||
def get_domains(order):
|
||||
|
||||
domains = set()
|
||||
@@ -75,7 +80,10 @@ for filename in glob.glob("*.json"):
|
||||
order_date = order_date.split("T")[0]
|
||||
|
||||
customer_name = get_customer_name(order)
|
||||
customer_email = get_customer_email(order)
|
||||
domains = get_domains(order)
|
||||
customer_name_prompted = False
|
||||
customer_email_prompted = False
|
||||
|
||||
for item in order.get("data", []):
|
||||
|
||||
@@ -84,6 +92,22 @@ for filename in glob.glob("*.json"):
|
||||
if product not in TARGET_PRODUCTS:
|
||||
continue
|
||||
|
||||
if not customer_name and not customer_name_prompted:
|
||||
customer_name = input(
|
||||
f"No customer name found for customer {customer_no} "
|
||||
f"(order {order_no}). "
|
||||
"Enter a name to add to the CSV: "
|
||||
).strip()
|
||||
customer_name_prompted = True
|
||||
|
||||
if not customer_email and not customer_email_prompted:
|
||||
customer_email = input(
|
||||
f"No customer email found for customer {customer_no} "
|
||||
f"(order {order_no}). "
|
||||
"Enter an email to add to the CSV: "
|
||||
).strip()
|
||||
customer_email_prompted = True
|
||||
|
||||
domain = get_domain_for_product(item, domains)
|
||||
|
||||
rows.append({
|
||||
@@ -91,6 +115,7 @@ for filename in glob.glob("*.json"):
|
||||
"order_date": order_date,
|
||||
"customer_no": customer_no,
|
||||
"customer_name": customer_name,
|
||||
"customer_email": customer_email,
|
||||
"product": product,
|
||||
"domain": domain
|
||||
})
|
||||
@@ -107,6 +132,7 @@ with open(OUTPUT_FILE, "w", newline="", encoding="utf-8") as csvfile:
|
||||
"order_date",
|
||||
"customer_no",
|
||||
"customer_name",
|
||||
"customer_email",
|
||||
"product",
|
||||
"domain"
|
||||
]
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
#! /usr/bin/env bash
|
||||
# Tool zum Schnellen prüfen mehrerer WordPress-Installationen
|
||||
# Maintainer: peignerpausz
|
||||
|
||||
declare -a WORDPRESS=()
|
||||
WORDPRESS="$(ls | grep wordpress)"
|
||||
printf "Beginne Prüfung der Adminnutzer\n\n"
|
||||
for wordpress in wordpress*/; do
|
||||
[[ -d "$wordpress" ]] || continue
|
||||
echo "Prüfe $wordpress"
|
||||
userlist=$(php ~/bin/wp-cli.phar user list --role=administrator --path="$wordpress" 2>/dev/null)
|
||||
if [[ -n "$userlist" ]]; then
|
||||
printf "%s\n\n" "$userlist"
|
||||
else
|
||||
printf "Fehler bei %s\n\n" "$wordpress"
|
||||
fi
|
||||
done
|
||||
for uneasy in $(find html/. -type f -name "wp-config.php" -exec dirname {} \;); do
|
||||
[[ -f "$uneasy" ]] || continue
|
||||
echo "Prüfe $uneasy"
|
||||
userlist2=$(php ~/bin/wp-cli.phar user list --role=administrator --path="$uneasy")
|
||||
echo $userlist2
|
||||
if [[ -n "$userlist2" ]]; then
|
||||
printf "%s\n\n" "$userlist2"
|
||||
else
|
||||
printf "Fehler bei %s\n\n" "$uneasy"
|
||||
fi
|
||||
done
|
||||
Reference in new issue
Block a user