]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
dom0 rootwrap - case insensitive xenapi section
authorMate Lakat <mate.lakat@citrix.com>
Fri, 28 Jun 2013 15:22:04 +0000 (16:22 +0100)
committerMate Lakat <mate.lakat@citrix.com>
Fri, 28 Jun 2013 17:01:15 +0000 (18:01 +0100)
As per change https://review.openstack.org/33429 the config sections
became lowercase. This patch makes the quantum-rootwrap-xen-dom0
rootwrap to be case insensitive for the xenapi section.

This patch also changes the default config file to use a lowercase
xenapi section.

Fixes bug 1195781

Change-Id: Ic24feb1a9ad6f8823745b1febd4a0edd54e73498

bin/quantum-rootwrap-xen-dom0
etc/rootwrap.conf

index 159a44657ae35929b055afcb037349c2875c28c3..062fd216414c66e450fae3764d428c5d496e2bdb 100755 (executable)
@@ -51,13 +51,22 @@ def parse_args():
     return exec_name, config_file, user_args
 
 
+def _xenapi_section_name(config):
+    sections = [sect for sect in config.sections() if sect.lower() == "xenapi"]
+    if len(sections) == 1:
+        return sections[0]
+
+    print "Multiple [xenapi] sections or no [xenapi] section found!"
+    sys.exit(RC_BADCONFIG)
+
+
 def load_configuration(exec_name, config_file):
     config = ConfigParser.RawConfigParser()
     config.read(config_file)
     try:
         exec_dirs = config.get("DEFAULT", "exec_dirs").split(",")
         filters_path = config.get("DEFAULT", "filters_path").split(",")
-        section = 'XENAPI'
+        section = _xenapi_section_name(config)
         url = config.get(section, "xenapi_connection_url")
         username = config.get(section, "xenapi_connection_username")
         password = config.get(section, "xenapi_connection_password")
index 5c70197b545428885909f5714578d0c17528eeba..2169edfa16e838e67d95c267107a3bfab2d67aac 100644 (file)
@@ -9,7 +9,7 @@ filters_path=/etc/quantum/rootwrap.d,/usr/share/quantum/rootwrap
 # These directories MUST all be only writeable by root !
 exec_dirs=/sbin,/usr/sbin,/bin,/usr/bin
 
-[XENAPI]
+[xenapi]
 # XenAPI configuration is only required by the L2 agent if it is to
 # target a XenServer/XCP compute host's dom0.
 xenapi_connection_url=<None>