[pve-devel] [PATCH common] JSONSchema: add fingerprint-sha256 standard option

Wolfgang Bumiller w.bumiller at proxmox.com
Thu Dec 28 12:08:48 CET 2017


On Wed, Dec 20, 2017 at 03:13:36PM +0100, Thomas Lamprecht wrote:
> Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
> ---
>  src/PVE/JSONSchema.pm | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/src/PVE/JSONSchema.pm b/src/PVE/JSONSchema.pm
> index 9c26184..2b646fd 100644
> --- a/src/PVE/JSONSchema.pm
> +++ b/src/PVE/JSONSchema.pm
> @@ -99,6 +99,12 @@ register_standard_option('extra-args', {
>      optional => 1
>  });
>  
> +register_standard_option('fingerprint-sha256', {
> +    description => "Certificate SHA 256 fingerprint.",
> +    type => 'string',
> +    pattern => '^(:?[A-Z0-9]{2}:){31}[A-Z0-9]{2}$',

Should be [A-F] rather than [A-Z].

Should this not be case insensitive btw.?
In new code I'd prefer qr// where you could just append /i. (Thought
[A-Fa-f0-9] is also fine of course.)

Also note that patterns are always anchored anyway during verification,
so no need for the ^ and $.

> +});
> +
>  my $format_list = {};
>  
>  sub register_format {
> -- 
> 2.11.0




More information about the pve-devel mailing list