[pbs-devel] applied: [PATCH proxmox 2/6] subscription: expose the `next_due_date` as an `i64`

Fabian Grünbichler f.gruenbichler at proxmox.com
Mon Nov 27 14:12:45 CET 2023


On November 9, 2023 4:33 pm, Stefan Sterz wrote:
> internally `SubscriptionInfo` already uses the `parse_next_due` helper
> to parse the next due date to an epoch. this exposes a function that
> allows us to use the epoch outside of this crate too. for example, a
> user of pom may have multiple subscription for the same system. in
> that case we want to apply the one with the due date that is furthest
> in the future.
> 
> Signed-off-by: Stefan Sterz <s.sterz at proxmox.com>
> ---
>  proxmox-subscription/src/subscription_info.rs | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/proxmox-subscription/src/subscription_info.rs b/proxmox-subscription/src/subscription_info.rs
> index dc10a2a..45f1796 100644
> --- a/proxmox-subscription/src/subscription_info.rs
> +++ b/proxmox-subscription/src/subscription_info.rs
> @@ -286,6 +286,13 @@ impl SubscriptionInfo {
>              .ok_or_else(|| format_err!("no product key set"))
>              .map(|key| key[..3].parse::<ProductType>())?
>      }
> +
> +    pub fn get_next_due_date(&self) -> Result<i64, Error> {
> +        self.nextduedate
> +            .as_ref()
> +            .ok_or_else(|| format_err!("no next due date set"))
> +            .map(|e| parse_next_due(e))?
> +    }
>  }
> 
>  /// Shortcut for md5 sums.
> --
> 2.39.2
> 
> 
> 
> _______________________________________________
> pbs-devel mailing list
> pbs-devel at lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
> 
> 
> 





More information about the pbs-devel mailing list