[PATCH virt-manager 03/14] cli: register a parser class only once

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Make sure that a parser class can only be registered once.

Signed-off-by: Marc Hartmayer <mhartmay@xxxxxxxxxxxxx>
Reviewed-by: Boris Fiuczynski <fiuczy@xxxxxxxxxxxxx>
---
 virtinst/cli.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/virtinst/cli.py b/virtinst/cli.py
index 21467a4d3430..73b6cdbdea5c 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -1235,7 +1235,9 @@ VIRT_PARSERS = []
 
 
 def _register_virt_parser(parserclass):
-    VIRT_PARSERS.append(parserclass)
+    # register the parser class only once
+    if parserclass not in VIRT_PARSERS:
+        VIRT_PARSERS.append(parserclass)
 
 
 ###################
-- 
2.17.0

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list



[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux