ansible/parsing: PEP8 compliancy (#24701)

- Make PEP8 compliant
This commit is contained in:
Dag Wieers 2017-05-18 19:41:00 +02:00 committed by John R Barker
commit 6f6bdf7914
12 changed files with 58 additions and 71 deletions

View file

@ -19,12 +19,11 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.errors import AnsibleParserError,AnsibleError
from ansible.errors import AnsibleParserError, AnsibleError
from ansible.module_utils.six import iteritems, string_types
from ansible.module_utils._text import to_text
from ansible.plugins import module_loader
from ansible.parsing.splitter import parse_kv, split_args
from ansible.plugins import module_loader
from ansible.template import Templar
@ -96,7 +95,6 @@ class ModuleArgsParser:
assert isinstance(task_ds, dict)
self._task_ds = task_ds
def _split_module_string(self, module_string):
'''
when module names are expressed like:
@ -111,7 +109,6 @@ class ModuleArgsParser:
else:
return (tokens[0], "")
def _handle_shell_weirdness(self, action, args):
'''
given an action name and an args dictionary, return the
@ -253,12 +250,11 @@ class ModuleArgsParser:
task, dealing with all sorts of levels of fuzziness.
'''
thing = None
thing = None
action = None
action = None
delegate_to = self._task_ds.get('delegate_to', None)
args = dict()
args = dict()
# This is the standard YAML form for command-type modules. We grab
# the args and pass them in as additional arguments, which can/will
@ -272,7 +268,6 @@ class ModuleArgsParser:
thing = self._task_ds['action']
action, args = self._normalize_parameters(thing, action=action, additional_args=additional_args)
# local_action
if 'local_action' in self._task_ds:
# local_action is similar but also implies a delegate_to
@ -294,14 +289,13 @@ class ModuleArgsParser:
thing = value
action, args = self._normalize_parameters(thing, action=action, additional_args=additional_args)
# if we didn't see any module in the task at all, it's not a task really
if action is None:
if 'ping' not in module_loader:
raise AnsibleParserError("The requested action was not found in configured module paths. "
"Additionally, core modules are missing. If this is a checkout, "
"run 'git pull --rebase' to correct this problem.",
obj=self._task_ds)
"Additionally, core modules are missing. If this is a checkout, "
"run 'git pull --rebase' to correct this problem.",
obj=self._task_ds)
else:
raise AnsibleParserError("no action detected in task. This often indicates a misspelled module name, or incorrect module path.",