Project

General

Profile

Actions

Feature #10190

open

expand '~' in suite_path, maybe other variables

Added by Dan Mick over 9 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
% Done:

0%

Source:
other
Tags:
Backport:
Reviewed:
Affected Versions:

Description

I found myself running the wrong version of files because I'd used "--suite-path ~/<path>", which was put literally into sys.path, where it had no effect. This is easy to fix with a call to "os.path.expanduser()":

--- a/teuthology/run.py
+++ b/teuthology/run.py
@@ -1,4 +1,5 @@
 import os
+import os.path
 import yaml
 import StringIO
 import contextlib
@@ -75,7 +76,7 @@ def fetch_tasks_if_needed(job_config):
     # Any scheduled job will already have the suite checked out and its
     # $PYTHONPATH set. We can check for this by looking for 'suite_path'
     # in its config.
-    suite_path = job_config.get('suite_path')
+    suite_path = os.path.expanduser(job_config.get('suite_path'))
     if suite_path:
         log.info("suite_path is set to %s; will attempt to use it", suite_path)
         if suite_path not in sys.path:

Maybe this would be an easy usability feature, and also might apply to other paths supplied by the user, either on the CLI or the config files?

No data to display

Actions

Also available in: Atom PDF