mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 13:20:23 -07:00
Indentation cleanup (partial)
This commit is contained in:
parent
7b177e8ebb
commit
68a9adc1be
9 changed files with 45 additions and 52 deletions
|
@ -161,7 +161,6 @@ class Inventory(object):
|
|||
|
||||
def restrict_to(self, restriction, append_missing=False):
|
||||
""" Restrict list operations to the hosts given in restriction """
|
||||
|
||||
if type(restriction) != list:
|
||||
restriction = [ restriction ]
|
||||
self._restriction = restriction
|
||||
|
|
|
@ -39,7 +39,7 @@ class Host(object):
|
|||
self.groups.append(group)
|
||||
|
||||
def set_variable(self, key, value):
|
||||
self.vars[key]=value;
|
||||
self.vars[key]=value
|
||||
|
||||
def get_groups(self):
|
||||
groups = {}
|
||||
|
|
|
@ -133,23 +133,17 @@ class PlayBook(object):
|
|||
accumulated_plays = []
|
||||
|
||||
if type(playbook_data) != list:
|
||||
raise errors.AnsibleError(
|
||||
"parse error: playbooks must be formatted as a YAML list"
|
||||
)
|
||||
raise errors.AnsibleError("parse error: playbooks must be formatted as a YAML list")
|
||||
|
||||
for play in playbook_data:
|
||||
if type(play) != dict:
|
||||
raise errors.AnsibleError(
|
||||
"parse error: each play in a playbook must a YAML dictionary (hash), recieved: %s" % play
|
||||
)
|
||||
raise errors.AnsibleError("parse error: each play in a playbook must a YAML dictionary (hash), recieved: %s" % play)
|
||||
if 'include' in play:
|
||||
if len(play.keys()) == 1:
|
||||
included_path = utils.path_dwim(self.basedir, play['include'])
|
||||
accumulated_plays.extend(self._load_playbook_from_file(included_path))
|
||||
else:
|
||||
raise errors.AnsibleError(
|
||||
"parse error: top level includes cannot be used with other directives: %s" % play
|
||||
)
|
||||
raise errors.AnsibleError("parse error: top level includes cannot be used with other directives: %s" % play)
|
||||
else:
|
||||
accumulated_plays.append(play)
|
||||
|
||||
|
|
|
@ -181,7 +181,7 @@ def parse_json(data):
|
|||
tokens = shlex.split(data)
|
||||
except:
|
||||
print "failed to parse json: "+ data
|
||||
raise;
|
||||
raise
|
||||
|
||||
for t in tokens:
|
||||
if t.find("=") == -1:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue