Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
e93ed2c1
Commit
e93ed2c1
authored
Jan 02, 2013
by
Stephen Fromm
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1818 from sfromm/issue1815
Update path_dwim() to return absolute path
parents
b54bb2df
2100a356
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
lib/ansible/utils/__init__.py
+5
-2
No files found.
lib/ansible/utils/__init__.py
View file @
e93ed2c1
...
@@ -168,14 +168,17 @@ def prepare_writeable_dir(tree):
...
@@ -168,14 +168,17 @@ def prepare_writeable_dir(tree):
exit
(
"Cannot write to path
%
s"
%
tree
)
exit
(
"Cannot write to path
%
s"
%
tree
)
def
path_dwim
(
basedir
,
given
):
def
path_dwim
(
basedir
,
given
):
''' make relative paths work like folks expect '''
'''
make relative paths work like folks expect.
if a relative path is provided, convert it to an absolute path.
'''
if
given
.
startswith
(
"/"
):
if
given
.
startswith
(
"/"
):
return
given
return
given
elif
given
.
startswith
(
"~/"
):
elif
given
.
startswith
(
"~/"
):
return
os
.
path
.
expanduser
(
given
)
return
os
.
path
.
expanduser
(
given
)
else
:
else
:
return
os
.
path
.
join
(
basedir
,
given
)
return
os
.
path
.
abspath
(
os
.
path
.
join
(
basedir
,
given
)
)
def
json_loads
(
data
):
def
json_loads
(
data
):
''' parse a JSON string and return a data structure '''
''' parse a JSON string and return a data structure '''
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment