diff options
author | Viacheslav Hletenko <v.gletenko@vyos.io> | 2023-02-28 09:15:01 +0000 |
---|---|---|
committer | Viacheslav Hletenko <v.gletenko@vyos.io> | 2023-02-28 09:15:01 +0000 |
commit | 36fea4cb4956ac396f20c785f6ff710c00e2ad8f (patch) | |
tree | b82bfdfd17d5dce8e75c03b720b2f82799b35472 /python/vyos/template.py | |
parent | 0420cea6f0c655aced9668ae01c50d517e1e8f29 (diff) | |
download | vyos-1x-36fea4cb4956ac396f20c785f6ff710c00e2ad8f.tar.gz vyos-1x-36fea4cb4956ac396f20c785f6ff710c00e2ad8f.zip |
T5033: Ability to generate muliple keys from a file or link
We generate only one public key (string) from a file xxx.pub
op-mode with 'generate public-key-command user vyos lik_to_key_file'
Add ability to generate configuration (from op-mode) for multiple keys
As github keys don't use identifiers, generate uuid4 id for them
Diffstat (limited to 'python/vyos/template.py')
-rw-r--r-- | python/vyos/template.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/python/vyos/template.py b/python/vyos/template.py index 88271125c..4778bf1c8 100644 --- a/python/vyos/template.py +++ b/python/vyos/template.py @@ -1,4 +1,4 @@ -# Copyright 2019-2020 VyOS maintainers and contributors <maintainers@vyos.io> +# Copyright 2019-2023 VyOS maintainers and contributors <maintainers@vyos.io> # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -161,6 +161,16 @@ def dot_colon_to_dash(text): text = text.replace(".", "-") return text +@register_filter('generate_uuid4') +def generate_uuid4(text): + """ Generate random unique ID + Example: + % uuid4() + UUID('958ddf6a-ef14-4e81-8cfb-afb12456d1c5') + """ + from uuid import uuid4 + return uuid4() + @register_filter('netmask_from_cidr') def netmask_from_cidr(prefix): """ Take CIDR prefix and convert the prefix length to a "subnet mask". |