`ImageVersion=`
: Matches against the configured image version. Image versions can be prepended
- by the operators `==`, `>=`, `<=`, `<`, `>` for rich version comparisons
+ by the operators `==`, `!=`, `>=`, `<=`, `<`, `>` for rich version comparisons
according to the UAPI group version format specification. If no operator is
prepended, the equality operator is assumed by default If this condition is
used and no image Version has be explicitly configured yet, this condition
for v in version_specs:
for sigil, opfunc in {
"==": operator.eq,
+ "!=": operator.ne,
"<=": operator.le,
">=": operator.ge,
">": operator.gt,
cmd = ["systemd-analyze", "compare-versions", self._version, "eq", other._version]
return run(cmd, check=False).returncode == 0
+ def __ne__(self, other: object) -> bool:
+ if not isinstance(other, GenericVersion):
+ return False
+ cmd = ["systemd-analyze", "compare-versions", self._version, "ne", other._version]
+ return run(cmd, check=False).returncode == 0
+
def __lt__(self, other: object) -> bool:
if not isinstance(other, GenericVersion):
return False