[pve-devel] [PATCH manager 19/19] notifications: use named templates instead of in-code templates

Fiona Ebner f.ebner at proxmox.com
Fri Apr 19 11:59:21 CEST 2024


Am 09.04.24 um 15:25 schrieb Lukas Wagner:
> diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm
> index 152eb3e5..2ea626f0 100644
> --- a/PVE/VZDump.pm
> +++ b/PVE/VZDump.pm

The existing $subject_template and $body_template could be removed now
like for the others

> diff --git a/templates/Makefile b/templates/Makefile
> new file mode 100644
> index 00000000..b0add81e
> --- /dev/null
> +++ b/templates/Makefile
> @@ -0,0 +1,24 @@
> +NOTIFICATION_TEMPLATES=							\
> +	default/test-subject.txt.hbs				\
> +	default/test-body.txt.hbs					\
> +	default/test-body.html.hbs					\
> +	default/vzdump-subject.txt.hbs				\
> +	default/vzdump-body.txt.hbs					\
> +	default/vzdump-body.html.hbs				\
> +	default/replication-subject.txt.hbs			\
> +	default/replication-body.txt.hbs			\
> +	default/replication-body.html.hbs			\
> +	default/package-updates-subject.txt.hbs		\
> +	default/package-updates-body.txt.hbs		\
> +	default/package-updates-body.html.hbs		\
> +

Nit: backslashes are not aligned

> diff --git a/templates/default/replication-body.html.hbs b/templates/default/replication-body.html.hbs
> new file mode 100644
> index 00000000..d1dea6a1
> --- /dev/null
> +++ b/templates/default/replication-body.html.hbs
> @@ -0,0 +1,18 @@
> +<html>
> +    <body>
> +        Replication job '{{job-id}}' with target '{{job-target}}' and schedule '{{job-schedule}}' failed!<br/><br/>
> +
> +        Last successful sync: {{timestamp last-sync}}<br/>
> +        Next sync try: {{timestamp next-sync}}<br/>
> +        Failure count: {{failure-count}}<br/>
> +
> +        {{#if (eq failure-count 3)}}
> +            Note: The system  will now reduce the frequency of error reports, as the job appears to be stuck.
> +        {{/if}}
> +        <br/>
> +        Error:<br/>
> +        <pre>
> +{{error}}

Nit: is there a special reason for not indenting this?

> +        </pre>
> +    </body>
> +</html>




More information about the pve-devel mailing list