Final update of the templating code
This commit is contained in:
parent
a05c1ce0cb
commit
515cb00364
1 changed files with 7 additions and 16 deletions
|
@ -29,27 +29,20 @@ MESSAGE_TEMPLATE = """
|
||||||
## OBS package update report
|
## OBS package update report
|
||||||
|
|
||||||
Updated at {{ date.today().strftime('%Y-%m-%d') }}
|
Updated at {{ date.today().strftime('%Y-%m-%d') }}
|
||||||
|
|
||||||
{% for repository, update in repositories.items() %}
|
{% for repository, update in repositories.items() %}
|
||||||
|
|
||||||
### {{ repository }}
|
### {{ repository }}
|
||||||
|
|
||||||
Updated {{ update | length }} packages.
|
Examined {{ update | length }} packages changed upstream:
|
||||||
|
|
||||||
{% for package, remote, state in update %}
|
{% for package, remote, state in update %}
|
||||||
{% if state != "error" %}
|
{% if state != "error" %}
|
||||||
* {{ package }} [{{ state[0:8] }}(https://commits.kde.org/{{ remote }}/{{ state }}
|
- {{ package }} updated to [{{ state[0:8] }}](https://commits.kde.org/{{ remote }}/{{ state }})
|
||||||
{% else %}
|
{% else %}
|
||||||
{% set errors = errors + [package] %}
|
- {{ package }} not updated (source service error)
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
## Packages with errors
|
|
||||||
|
|
||||||
{% for error in errors %}
|
|
||||||
* {{ error }}
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -178,12 +171,10 @@ class RepoUpdater:
|
||||||
|
|
||||||
def notify_matrix(update_data: Dict[str, List[Tuple[str, str]]]) -> None:
|
def notify_matrix(update_data: Dict[str, List[Tuple[str, str]]]) -> None:
|
||||||
|
|
||||||
template = Environment(loader=BaseLoader).from_string(MESSAGE_TEMPLATE)
|
template = Environment(loader=BaseLoader, lstrip_blocks=True,
|
||||||
|
trim_blocks=True).from_string(MESSAGE_TEMPLATE)
|
||||||
|
|
||||||
errors = list()
|
message = template.render(repositories=update_data, date=date)
|
||||||
import pdb
|
|
||||||
pdb.set_trace()
|
|
||||||
message = template.render(repositories=update_data, errors=errors)
|
|
||||||
|
|
||||||
cmd = [MATRIX_COMMANDER, "--markdown", "-m", message]
|
cmd = [MATRIX_COMMANDER, "--markdown", "-m", message]
|
||||||
logging.debug("Sending Matrix notification")
|
logging.debug("Sending Matrix notification")
|
||||||
|
|
Loading…
Add table
Reference in a new issue