From: Mate Lakat Date: Mon, 3 Jun 2013 09:39:13 +0000 (+0100) Subject: xenapi: fix rootwrap X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=648d3b76bec723b24a5cbf1309e06117bdd1a980;p=openstack-build%2Fneutron-build.git xenapi: fix rootwrap 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 --- diff --git a/bin/quantum-rootwrap-xen-dom0 b/bin/quantum-rootwrap-xen-dom0 index f4e6d2fc4..159a44657 100755 --- a/bin/quantum-rootwrap-xen-dom0 +++ b/bin/quantum-rootwrap-xen-dom0 @@ -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)