xend: fix bug in option parsing
authorKeir Fraser <keir.fraser@citrix.com>
Tue, 4 May 2010 11:23:54 +0000 (12:23 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Tue, 4 May 2010 11:23:54 +0000 (12:23 +0100)
If you enable legacy tcp xmlrpc in xend's config but omit to enable
ssl then a backtrace is generated when starting xend.

Signed-off-by: Arnd Hannemann <hannemann@nets.rwth-aachen.de>
tools/python/xen/xend/XendOptions.py

index 13145a111ef48ab7ad2daae972f61ca7b49b341c..9abe9b1c2a8c555d6f4fb520faf97cdc78d717f7 100644 (file)
@@ -207,18 +207,18 @@ class XendOptions:
     def get_xend_tcp_xmlrpc_server_ssl_key_file(self):
         name = 'xend-tcp-xmlrpc-server-ssl-key-file'
         file = self.get_config_string(name)
-        if os.path.dirname(file) == "":
+        if file and os.path.dirname(file) == "":
             file = auxbin.xen_configdir() + '/' + file;
-        if not os.path.exists(file):
+        if file and not os.path.exists(file):
             raise XendError("invalid xend config %s: directory '%s' does not exist" % (name, file))
         return file
 
     def get_xend_tcp_xmlrpc_server_ssl_cert_file(self):
         name = 'xend-tcp-xmlrpc-server-ssl-cert-file'
         file = self.get_config_string(name)
-        if os.path.dirname(file) == "":
+        if file and os.path.dirname(file) == "":
             file = auxbin.xen_configdir() + '/' + file;
-        if not os.path.exists(file):
+        if file and not os.path.exists(file):
             raise XendError("invalid xend config %s: directory '%s' does not exist" % (name, file))
         return file