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
9569be8b
Commit
9569be8b
authored
Mar 30, 2012
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Need for quoting/unquoting problems go away once module_args are all treated as strings throughout.
parent
3ded27fe
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
18 deletions
+2
-18
lib/ansible/utils.py
+2
-18
No files found.
lib/ansible/utils.py
View file @
9569be8b
...
...
@@ -260,29 +260,13 @@ def parse_yaml_from_file(path):
raise
errors
.
AnsibleError
(
"file not found:
%
s"
%
path
)
return
parse_yaml
(
data
)
def
unquote_string
(
string
):
''' remove single or double quotes from beginning/end of string'''
if
(
string
.
startswith
(
'"'
)
and
string
.
endswith
(
'"'
))
or
\
(
string
.
startswith
(
"'"
)
and
string
.
endswith
(
"'"
)):
return
string
[
1
:
-
1
]
else
:
return
string
def
parse_kv
(
args
,
unquote
=
True
):
def
parse_kv
(
args
):
''' convert a string of key/value items to a dict '''
options
=
{}
# FIXME: this should be mostly unneccessary once we convert
# things to stop parsing/unparsing
if
type
(
args
)
==
list
:
vargs
=
args
else
:
vargs
=
shlex
.
split
(
args
,
posix
=
True
)
for
x
in
vargs
:
if
x
.
find
(
"="
)
!=
-
1
:
k
,
v
=
x
.
split
(
"="
)
if
unquote
:
options
[
k
]
=
unquote_string
(
v
)
else
:
v
options
[
k
]
=
v
return
options
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