On 09/19/2012 01:43 PM, Lucas Meneghel Rodrigues wrote:
This patch is a solution for bug #502 - drone_utility does not respect
results directory. Drone manager will always use the base autotest
install directory to write results to, making it write in an out of
bounds area for the scheduler:

OSError: [Errno 13] Permission denied:
'/usr/lib/python2.7/site-packages/autotest/results'

I first thought only choosing a different

drone_installation_directory: /usr/lib/python2.7/site-packages/autotest

In /etc/autotest/global_config.ini would help, but I just realized
AUTOTEST_INSTALL_DIR is used for other purposes, such as locating
autoserv, so this change would only cause the code to break further
in the execution path. So if we have a common dir to write results
to in global_config.ini, let's use it instead of
drones.AUTOTEST_INSTALL_DIR.

Signed-off-by: Lucas Meneghel Rodrigues <[email protected]>
---
  scheduler/drone_manager.py | 12 ++++++++++--
  1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/scheduler/drone_manager.py b/scheduler/drone_manager.py
index db57a09..d08980b 100644
--- a/scheduler/drone_manager.py
+++ b/scheduler/drone_manager.py
@@ -621,8 +621,16 @@ class DroneManager(object):
          if on_results_repository:
              base_dir = self._results_dir
          else:
-            base_dir = os.path.join(drones.AUTOTEST_INSTALL_DIR,
-                                    _DRONE_RESULTS_DIR_SUFFIX)
+            output_dir = global_config.global_config.get_config_value('COMMON',
+                                                              
'test_output_dir',
+                                                               default="")
+            if output_dir:
+                base_dir = os.path.join(output_dir, 'results')

^ Nitpick: any reason for mixing _DRONE_RESULTS_DIR_SUFFIX and literal 'results' string ?

+            else:
+                base_dir = drones.AUTOTEST_INSTALL_DIR
+
+            base_dir = os.path.join(base_dir, _DRONE_RESULTS_DIR_SUFFIX)

^ Wouldn't this result in something like "$test_output_dir/results/results" ? Not sure if that's what you intended, but maybe changing _DRONE_RESULTS_DIR_SUFFIX to something other than 'results' or dropping the extra level seems to make sense.

+
          return os.path.join(base_dir, path)

_______________________________________________
Autotest-kernel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/autotest-kernel

Reply via email to