From daf0bfad8fbd10e765d9e43eb0f17c6f15eeb515 Mon Sep 17 00:00:00 2001 From: Plamen Dimitrov Date: Wed, 20 Apr 2022 10:45:23 +0300 Subject: [PATCH] Restore support for zero instance filtering in binary cnf store queries Some cnfvars like NICs support zero instance numbers and without this fix the query would simply return all cnfvars in a cnf list if we need `get_cnf CNFVAR 0` from the query. --- src/cnfvar/binary.py | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/src/cnfvar/binary.py b/src/cnfvar/binary.py index 63311cc..d707daa 100644 --- a/src/cnfvar/binary.py +++ b/src/cnfvar/binary.py @@ -105,7 +105,8 @@ class CnfBinary: elif instance is not None and not isinstance(instance, int): raise TypeError(f"`instance` is of wrong type {type(instance)}") - cmd = f"{BIN_GET_CNF} {name or ''} {instance or ''}" + # make sure 0 instance cnfvars like e.g. NICs can also be filtered by instance + cmd = f"{BIN_GET_CNF} {name or ''} {instance if instance is not None else ''}" encoding = ENCODING if no_children: -- 1.7.1