From a880939a2ef2df208adc28be083b85873ba94c0e Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Tue, 9 Sep 2025 17:37:43 +0200 Subject: [PATCH] confd: add new container and volume name type This rectifies an omission from the initial yang model. Not all charachters are supported in container and volume names. E.g., simply attempting to create a volume or container with a space in the name causes this error message from podman: podman: Error: running volume create option: names must match [a-zA-Z0-9][a-zA-Z0-9_.-]*: invalid argument In addition to the regexp, the new 'ident' type also enforces a minimum and maximum length. Sure, technically a single char is allowed, but let's be reasonable, and who in their right mind wants an identifier > 64 chars? We have description for that. Signed-off-by: Joachim Wiberg --- src/confd/yang/confd/infix-containers.yang | 22 ++++++++++++++----- ....yang => infix-containers@2025-09-09.yang} | 0 src/confd/yang/containers.inc | 2 +- 3 files changed, 17 insertions(+), 7 deletions(-) rename src/confd/yang/confd/{infix-containers@2025-06-25.yang => infix-containers@2025-09-09.yang} (100%) diff --git a/src/confd/yang/confd/infix-containers.yang b/src/confd/yang/confd/infix-containers.yang index 9226bc24..b4c90ada 100644 --- a/src/confd/yang/confd/infix-containers.yang +++ b/src/confd/yang/confd/infix-containers.yang @@ -22,6 +22,11 @@ module infix-containers { prefix infix-sys; } + revision 2025-09-09 { + description "Add dedicated 'ident' type for container and volume names."; + reference "internal"; + } + revision 2025-06-25 { description "Add file mode option to content mounts, allows creating scripts."; reference "internal"; @@ -62,6 +67,14 @@ module infix-containers { * Typedefs */ + typedef ident { + description "Container name or volume identifiers may not contain spaces."; + type string { + length "2..64"; + pattern '[a-zA-Z0-9][a-zA-Z0-9_.-]+'; + } + } + typedef mount-type { type enumeration { enum bind { @@ -128,7 +141,7 @@ module infix-containers { leaf name { description "Name of the container"; - type string; + type ident; } leaf id { @@ -344,7 +357,7 @@ module infix-containers { For persistent writable directories, *volumes* may be a better fit for your container and easier to set up."; - type string; + type ident; } leaf type { @@ -436,10 +449,7 @@ module infix-containers { with the contents of the container's file system on first use. Hence, upgrading the container image will not update the volume if the image has new/removed files at 'path'."; - type string { - pattern '[a-zA-Z_][a-zA-Z0-9_]*'; - length "1..64"; - } + type ident; } leaf target { diff --git a/src/confd/yang/confd/infix-containers@2025-06-25.yang b/src/confd/yang/confd/infix-containers@2025-09-09.yang similarity index 100% rename from src/confd/yang/confd/infix-containers@2025-06-25.yang rename to src/confd/yang/confd/infix-containers@2025-09-09.yang diff --git a/src/confd/yang/containers.inc b/src/confd/yang/containers.inc index 4b2e3f30..b9199119 100644 --- a/src/confd/yang/containers.inc +++ b/src/confd/yang/containers.inc @@ -1,5 +1,5 @@ # -*- sh -*- MODULES=( "infix-interfaces -e containers" - "infix-containers@2025-06-25.yang" + "infix-containers@2025-09-09.yang" )