Closed as not planned
Description
Description
root@centos-srlinux:/home/ubuntu/containerlab# ctr -n clab c ls labels."foo-bar"==bla
ctr: filters: parse error: [labels.foo >|-|< bar==bla]: expected an operator ("=="|"!="|"~="): invalid argument: invalid argument
Dashes in label names are interpreted somehow and not taken as a pure identifier when being used as filters.
Steps to reproduce the issue:
- Take random container and add a label
ctr -n <namespace> c label <container> foo-bar=bla
- Check for the labels
ctr -n <namespace> c info <container> | head -n 16
{
"ID": "clab-clos02-leaf1",
"Labels": {
"clab-node-kind": "srl",
"clab-node-lab-dir": "/home/ubuntu/containerlab/clab-clos02/leaf1",
"clab-node-name": "leaf1",
"clab-node-type": "ixrd2",
"clab-topo-file": "/home/ubuntu/containerlab/lab-examples/clos02/clos02.clab.yml",
"clab.ipv4.addr": "172.20.20.24",
"clab.ipv4.netmask": "24",
"clab.ipv6.addr": "2001:172:20:20::33f",
"clab.ipv6.netmask": "64",
"containerlab": "clos02",
"foo-bar": "bla",
"foo.bar": "bla"
},
- query containers using the the label as filter
ctr -n clab c ls labels."foo.bar"==bla
CONTAINER IMAGE RUNTIME
clab-clos02-leaf1 srlinux:latest io.containerd.runc.v2
Using the label with the dash in it fails.
ctr -n clab c ls labels."foo-bar"==bla
ctr: filters: parse error: [labels.foo >|-|< bar==bla]: expected an operator ("=="|"!="|"~="): invalid argument: invalid argument
Describe the results you received:
The dash is interpreted as an operator instead of as part of the identifier.
Describe the results you expected:
Not interpreting (at least escaped) mathematical operators.
What version of containerd are you using:
Client:
Version: 1.4.6
Revision: d71fcd7d8303cbf684402823e425e9dd2e99285d
Go version: go1.13.15
Server:
Version: 1.4.6
Revision: d71fcd7d8303cbf684402823e425e9dd2e99285d
UUID: 7a75b302-7547-4867-83d7-5dc82915c980