Style fixes so "make pep8" is clean.

This commit is contained in:
Michael DeHaan 2013-04-10 16:37:49 -04:00
commit 29209c4913
11 changed files with 76 additions and 74 deletions

View file

@ -334,12 +334,12 @@ class Inventory(object):
results = []
# allow Unix style @filename data
for x in subset_pattern:
if x.startswith("@"):
fd = open(x[1:])
results.extend(fd.read().split("\n"))
fd.close()
else:
results.append(x)
if x.startswith("@"):
fd = open(x[1:])
results.extend(fd.read().split("\n"))
fd.close()
else:
results.append(x)
self._subset = results
def lift_restriction(self):

View file

@ -505,7 +505,7 @@ class PlayBook(object):
host_list = self._list_available_hosts(play.hosts)
if task.any_errors_fatal and len(host_list) < hosts_count:
host_list = None
host_list = None
# if no hosts remain, drop out
if not host_list:

View file

@ -90,7 +90,7 @@ class Play(object):
load_vars = {}
if self.playbook.inventory.basedir() is not None:
load_vars['inventory_dir'] = self.playbook.inventory.basedir();
load_vars['inventory_dir'] = self.playbook.inventory.basedir()
self._tasks = self._load_tasks(self._ds.get('tasks', []), load_vars)
self._handlers = self._load_tasks(self._ds.get('handlers', []), load_vars)
@ -226,7 +226,7 @@ class Play(object):
mv[k] = utils.template(self.basedir, v, mv)
dirname = self.basedir
if original_file:
dirname = os.path.dirname(original_file)
dirname = os.path.dirname(original_file)
include_file = utils.template(dirname, tokens[0], mv)
include_filename = utils.path_dwim(dirname, include_file)
data = utils.parse_yaml_from_file(include_filename)

View file

@ -674,33 +674,33 @@ def get_diff(diff):
return ">> the files are different, but the diff library cannot compare unicode strings"
def is_list_of_strings(items):
for x in items:
if not isinstance(x, basestring):
return False
return True
for x in items:
if not isinstance(x, basestring):
return False
return True
def safe_eval(str):
'''
this is intended for allowing things like:
with_items: {{ a_list_variable }}
where Jinja2 would return a string
but we do not want to allow it to call functions (outside of Jinja2, where
the env is constrained)
'''
# FIXME: is there a more native way to do this?
'''
this is intended for allowing things like:
with_items: {{ a_list_variable }}
where Jinja2 would return a string
but we do not want to allow it to call functions (outside of Jinja2, where
the env is constrained)
'''
# FIXME: is there a more native way to do this?
def is_set(var):
return not var.startswith("$") and not '{{' in var
def is_unset(var):
return var.startswith("$") or '{{' in var
def is_set(var):
return not var.startswith("$") and not '{{' in var
def is_unset(var):
return var.startswith("$") or '{{' in var
# do not allow method calls to modules
if re.search(r'\w\.\w+\(', str):
return str
# do not allow imports
if re.search(r'import \w+', str):
return str
return eval(str)
# do not allow method calls to modules
if re.search(r'\w\.\w+\(', str):
return str
# do not allow imports
if re.search(r'import \w+', str):
return str
return eval(str)