mirror of
https://github.com/kernelkit/infix.git
synced 2026-08-01 05:13:01 +02:00
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 <troglobit@gmail.com>
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- sh -*-
|
||||
MODULES=(
|
||||
"infix-interfaces -e containers"
|
||||
"infix-containers@2025-06-25.yang"
|
||||
"infix-containers@2025-09-09.yang"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user