mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-03-12 20:58:28 +03:00
cli: Call validate() on is_single objects too
The way the code was nested, we skipped calling validate() on XMLChildProperty is_single objects. There's no reason to do that, so adjust it. We need to do some hasattr checking here, because --os-variant and --location objects aren't XMLBuilders with validate defined. That's really an issue of having XMLBuilder assumptions baked into the generic CLI parsing infrastructure. Unwinding that is for another day
This commit is contained in:
parent
102a49771f
commit
a80242d998
@ -1432,11 +1432,11 @@ class VirtCLIParser(metaclass=_InitClass):
|
|||||||
ret = []
|
ret = []
|
||||||
try:
|
try:
|
||||||
objs = self._parse(inst is None and self.guest or inst)
|
objs = self._parse(inst is None and self.guest or inst)
|
||||||
if new_object:
|
|
||||||
for obj in xmlutil.listify(objs):
|
for obj in xmlutil.listify(objs):
|
||||||
if validate:
|
if validate and hasattr(obj, "validate"):
|
||||||
obj.validate()
|
obj.validate()
|
||||||
|
if not new_object:
|
||||||
|
continue
|
||||||
if isinstance(obj, Device):
|
if isinstance(obj, Device):
|
||||||
self.guest.add_device(obj)
|
self.guest.add_device(obj)
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user