[pmg-devel] [PATCH pmg-api v2] fix #2452: pmgqm support 1-24h timespans for status/send

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Sep 17 17:22:05 CEST 2025


Am 08.08.25 um 12:28 schrieb Hannes Laimer:
> Signed-off-by: Hannes Laimer <h.laimer at proxmox.com>
> ---
> I didn't find a section for this in the docs(maybe I missed it), if
> there is one, and depending on what it says maybe we have to update that
> as well. (I can send a followup in that case)
> 
> since v1:
>  - update default templates
>  - 1..24h instead of 1..23h (thought `today` would be 24h, but it's not)
> 
>  src/PMG/CLI/pmgqm.pm                |  8 ++++----
>  src/PMG/Utils.pm                    | 10 ++++++++--
>  src/templates/spamreport-short.tt   |  4 +++-
>  src/templates/spamreport-verbose.tt |  4 +++-
>  4 files changed, 18 insertions(+), 8 deletions(-)
> 
> diff --git a/src/PMG/CLI/pmgqm.pm b/src/PMG/CLI/pmgqm.pm
> index 23968f2..41f9f1a 100755
> --- a/src/PMG/CLI/pmgqm.pm
> +++ b/src/PMG/CLI/pmgqm.pm
> @@ -90,9 +90,9 @@ __PACKAGE__->register_method({
>          additionalProperties => 0,
>          properties => {
>              timespan => {
> -                description => "Select time span.",
> +                description => "Select time span. Accepts 'today', 'yesterday', 'week' or '1h'..'24h' for the last N hours.",
>                  type => 'string',
> -                enum => ['today', 'yesterday', 'week'],
> +                pattern => '^(today|yesterday|week|([1-9]|1[0-9]|2[0-4])h)$',

Oh and FWIW, was fine as is, but it would have been a potential use case for
the relatively new oneOf schema support to split the enum and the more free
form variants into two different sub-schemas. Mostly mentioning it to ensure
it's known to a wider audience that using the oneOf schema would (or at least
should ;) be possible in the perl based APIs too.




More information about the pmg-devel mailing list