]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
xenapi: fix rootwrap
authorMate Lakat <mate.lakat@citrix.com>
Mon, 3 Jun 2013 09:39:13 +0000 (10:39 +0100)
committerMate Lakat <mate.lakat@citrix.com>
Mon, 3 Jun 2013 09:49:56 +0000 (10:49 +0100)
The xenapi root wrapper did not parse the "exec_dirs" parameter, so it
failed to execute the commands. This patch works around this problem by
parsing the "exec_dirs".

Fixes bug 1185872

Change-Id: I10175c7df5d34e47eb6044711ffbe4fe4cee3ce2

bin/quantum-rootwrap-xen-dom0

index f4e6d2fc45df86dc8256b192f5496178e468281f..159a44657ae35929b055afcb037349c2875c28c3 100755 (executable)
@@ -55,6 +55,7 @@ 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'
         url = config.get(section, "xenapi_connection_url")
@@ -74,10 +75,11 @@ def load_configuration(exec_name, config_file):
         url=url,
         username=username,
         password=password,
+        exec_dirs=exec_dirs,
     )
 
 
-def filter_command(exec_name, filters_path, user_args):
+def filter_command(exec_name, filters_path, user_args, exec_dirs):
     # Add ../ to sys.path to allow running from branch
     possible_topdir = os.path.normpath(os.path.join(os.path.abspath(exec_name),
                                                     os.pardir, os.pardir))
@@ -88,7 +90,8 @@ def filter_command(exec_name, filters_path, user_args):
 
     # Execute command if it matches any of the loaded filters
     filters = wrapper.load_filters(filters_path)
-    filter_match = wrapper.match_filter(filters, user_args)
+    filter_match = wrapper.match_filter(
+        filters, user_args, exec_dirs=exec_dirs)
     if not filter_match:
         print "Unauthorized command: %s" % ' '.join(user_args)
         sys.exit(RC_UNAUTHORIZED)
@@ -110,7 +113,7 @@ def run_command(url, username, password, user_args):
 def main():
     exec_name, config_file, user_args = parse_args()
     config = load_configuration(exec_name, config_file)
-    filter_command(exec_name, config['filters_path'], user_args)
+    filter_command(exec_name, config['filters_path'], user_args, config['exec_dirs'])
     return run_command(config['url'], config['username'], config['password'],
                        user_args)