1
0
Fork 0

Update the script to use the systemwide matrix-commander

This commit is contained in:
Luca Beltrame 2022-01-17 22:25:48 +01:00
parent 9c5defda16
commit 414eb15df2
Signed by: einar
GPG key ID: 4707F46E9EC72DEC

View file

@ -4,13 +4,12 @@
import argparse
from datetime import date
from collections import defaultdict
from functools import lru_cache
import logging
import json
from pathlib import Path
import subprocess
from typing import Union, Dict, Any, List, Tuple
from typing import Union, Dict, List, Tuple
from urllib.parse import quote
import git
@ -22,7 +21,9 @@ import sarge
API_URL = "https://invent.kde.org/api/v4/projects/"
OBS_URL = "https://api.opensuse.org/trigger/runservice"
MATRIX_COMMANDER = "/home/mocker/local-venv/bin/matrix-commander.py"
MATRIX_COMMANDER = "/usr/local/bin/matrix-commander.py"
CREDENTIALS_FILE = "/etc/matrix-commander/credentials.json"
STORE_DIR = "/var/lib/matrix-commander/store"
REPO_TEMPLATE = "https://invent.kde.org/{}"
MESSAGE_TEMPLATE = """
@ -177,6 +178,7 @@ def notify_matrix(update_data: Dict[str, List[Tuple[str, str]]]) -> None:
message = template.render(repositories=update_data, date=date)
cmd = [MATRIX_COMMANDER, "--markdown", "--log-level", "ERROR",
"--credentials", CREDENTIALS_FILE, "--store", STORE_DIR,
"-m", message]
logging.debug("Sending Matrix notification")
sarge.run(cmd, stdout=subprocess.DEVNULL)