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
031ba43d
Commit
031ba43d
authored
Jul 15, 2012
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor code cleanup
parent
1d8bb177
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
14 deletions
+2
-14
lib/ansible/utils.py
+2
-14
No files found.
lib/ansible/utils.py
View file @
031ba43d
...
@@ -71,14 +71,7 @@ def write_tree_file(tree, hostname, buf):
...
@@ -71,14 +71,7 @@ def write_tree_file(tree, hostname, buf):
def
is_failed
(
result
):
def
is_failed
(
result
):
''' is a given JSON result a failed result? '''
''' is a given JSON result a failed result? '''
failed
=
False
return
((
result
.
get
(
'rc'
,
0
)
!=
0
)
or
(
result
.
get
(
'failed'
,
False
)
in
[
True
,
'True'
,
'true'
]))
rc
=
0
if
type
(
result
)
==
dict
:
failed
=
result
.
get
(
'failed'
,
0
)
rc
=
result
.
get
(
'rc'
,
0
)
if
rc
!=
0
:
return
True
return
failed
def
prepare_writeable_dir
(
tree
):
def
prepare_writeable_dir
(
tree
):
''' make sure a directory exists and is writeable '''
''' make sure a directory exists and is writeable '''
...
@@ -200,8 +193,7 @@ def _template(text, vars, setup_cache=None):
...
@@ -200,8 +193,7 @@ def _template(text, vars, setup_cache=None):
''' run a text buffer through the templating engine '''
''' run a text buffer through the templating engine '''
vars
=
vars
.
copy
()
vars
=
vars
.
copy
()
vars
[
'hostvars'
]
=
setup_cache
vars
[
'hostvars'
]
=
setup_cache
text
=
varReplace
(
unicode
(
text
),
vars
)
return
varReplace
(
unicode
(
text
),
vars
)
return
text
def
template
(
text
,
vars
,
setup_cache
=
None
):
def
template
(
text
,
vars
,
setup_cache
=
None
):
''' run a text buffer through the templating engine
''' run a text buffer through the templating engine
...
@@ -265,14 +257,10 @@ def md5(filename):
...
@@ -265,14 +257,10 @@ def md5(filename):
infile
.
close
()
infile
.
close
()
return
digest
.
hexdigest
()
return
digest
.
hexdigest
()
####################################################################
####################################################################
# option handling code for /usr/bin/ansible and ansible-playbook
# option handling code for /usr/bin/ansible and ansible-playbook
# below this line
# below this line
# FIXME: move to seperate file
class
SortedOptParser
(
optparse
.
OptionParser
):
class
SortedOptParser
(
optparse
.
OptionParser
):
'''Optparser which sorts the options by opt before outputting --help'''
'''Optparser which sorts the options by opt before outputting --help'''
def
format_help
(
self
,
formatter
=
None
):
def
format_help
(
self
,
formatter
=
None
):
...
...
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