From: Plamen Dimitrov Date: Wed, 20 Apr 2022 07:45:23 +0000 (+0300) Subject: Restore support for zero instance filtering in binary cnf store queries X-Git-Tag: v1.7.1~4^2~1 X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=daf0bfad8fbd10e765d9e43eb0f17c6f15eeb515;p=pyi2ncommon 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. --- 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: