This is a solution to issue #501 - on a system wide install,
running autotest-remote will try to create a results dir on
a non readable python library area:

$ autotest-remote a
DEBUG:root:unable to import site symbol '_SiteRun', using non-site
implementation
Traceback (most recent call last):
File "/bin/autotest-remote", line 17, in
autoserv.main()
File "/usr/lib/python2.7/site-packages/autotest/server/autoserv.py",
line 193, in main
os.makedirs(results)
File "/usr/lib64/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied:
'/usr/share/autotest/results.2012-08-08-08.54.09'

Use the COMMON.test_output_dir setting on global_config.ini
if available, then fall back to use the cwd to generate the
directory if not available (local install).

Signed-off-by: Lucas Meneghel Rodrigues <[email protected]>
---
 server/autoserv.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/server/autoserv.py b/server/autoserv.py
index 3e1512c..5684e9b 100644
--- a/server/autoserv.py
+++ b/server/autoserv.py
@@ -173,9 +173,15 @@ def main():
     if parser.options.no_logging:
         results = None
     else:
+        output_dir = global_config.get_config_value('COMMON',
+                                                    'test_output_dir',
+                                                    default="")
         results = parser.options.results
         if not results:
             results = 'results.' + time.strftime('%Y-%m-%d-%H.%M.%S')
+            if output_dir:
+                results = os.path.join(output_dir, results)
+
         results  = os.path.abspath(results)
         resultdir_exists = False
         for filename in ('control.srv', 'status.log', '.autoserv_execute'):
-- 
1.7.11.2

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

Reply via email to