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
19a2fc00
Commit
19a2fc00
authored
Jul 15, 2012
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up imports in utils, add nicer recursion depth limit check.
parent
60d64251
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
lib/ansible/utils.py
+8
-4
No files found.
lib/ansible/utils.py
View file @
19a2fc00
...
...
@@ -25,7 +25,9 @@ import codecs
import
jinja2
import
yaml
import
optparse
from
operator
import
methodcaller
import
operator
from
ansible
import
errors
import
ansible.constants
as
C
try
:
import
json
...
...
@@ -37,8 +39,6 @@ try:
except
ImportError
:
from
md5
import
md5
as
_md5
from
ansible
import
errors
import
ansible.constants
as
C
###############################################################
# UTILITY FUNCTIONS FOR COMMAND LINE TOOLS
...
...
@@ -278,7 +278,11 @@ def template(text, vars, setup_cache=None):
''' run a text buffer through the templating engine
until it no longer changes '''
prev_text
=
''
depth
=
0
while
prev_text
!=
text
:
depth
=
depth
+
1
if
(
depth
>
20
):
raise
errors
.
AnsibleError
(
"template recursion depth exceeded"
)
prev_text
=
text
text
=
_template
(
text
,
vars
,
setup_cache
)
return
text
...
...
@@ -343,7 +347,7 @@ def md5(filename):
class
SortedOptParser
(
optparse
.
OptionParser
):
'''Optparser which sorts the options by opt before outputting --help'''
def
format_help
(
self
,
formatter
=
None
):
self
.
option_list
.
sort
(
key
=
methodcaller
(
'get_opt_string'
))
self
.
option_list
.
sort
(
key
=
operator
.
methodcaller
(
'get_opt_string'
))
return
optparse
.
OptionParser
.
format_help
(
self
,
formatter
=
None
)
def
base_parser
(
constants
=
C
,
usage
=
""
,
output_opts
=
False
,
runas_opts
=
False
,
async_opts
=
False
,
connect_opts
=
False
):
...
...
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