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

Marc Hartmayer mhartmay at linux.ibm.com
Tue Dec 18 13:44:52 UTC 2018


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

Signed-off-by: Marc Hartmayer <mhartmay at linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy at linux.ibm.com>
---
 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




More information about the virt-tools-list mailing list