diff --git a/plugins/inventory/float.py b/plugins/inventory/float.py index e9fa22b63c7dd47b8fa403c1edbef121c09dda39..81a01288718568dc29aaaa7c07d4973bb8d212b5 100644 --- a/plugins/inventory/float.py +++ b/plugins/inventory/float.py @@ -54,9 +54,11 @@ def _make_identifier(s): return s.replace('-', '_') -# Returns the absolute path to a file. If the given path is relative, -# it will be evaluated based on the given path_reference. +# Returns the absolute path to a file. Environment variables will be +# substituted. If the given path is relative, it will be evaluated +# based on the given path_reference. def _abspath(path, relative_to='/'): + path = os.path.expandvars(path) if path.startswith('/'): return path return os.path.abspath(os.path.join(os.path.dirname(relative_to), path)) diff --git a/scripts/pwgen.py b/scripts/pwgen.py index 07f999e90ee370e777cede7d31e593fb0107b659..9c67c3f4ddb686e93f78d11f2beceee1c23f2b01 100755 --- a/scripts/pwgen.py +++ b/scripts/pwgen.py @@ -19,9 +19,11 @@ EXIT_CHANGED = 1 EXIT_ERROR = 2 -# Returns the absolute path to a file. If the given path is relative, -# it will be evaluated based on the given path_reference. +# Returns the absolute path to a file. Environment variables will be +# substituted. If the given path is relative, it will be evaluated +# based on the given path_reference. def _abspath(path, relative_to='/'): + path = os.path.expandvars(path) if path.startswith('/'): return path return os.path.abspath(os.path.join(os.path.dirname(relative_to), path))