Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

file module should check invalid arguments (fixes #2135) #2139

Closed
wants to merge 11 commits into from
Closed
4 changes: 2 additions & 2 deletions docsite/rst/playbooks2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ to a task include statement as below. Note this does not work with playbook inc
get evaluated, but the conditional is applied to each and every task::

- include: tasks/sometasks.yml
when_string: 'reticulating splines' in $output
when_string: "'reticulating splines' in $output"

Conditional Imports
```````````````````
Expand Down Expand Up @@ -430,7 +430,7 @@ Loops

To save some typing, repeated tasks can be written in short-hand like so::

- name: add user $item
- name: add several users
action: user name=$item state=present groups=wheel
with_items:
- testuser1
Expand Down
4 changes: 3 additions & 1 deletion lib/ansible/inventory/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def __init__(self, host_list=C.DEFAULT_HOST_LIST):
host_list = [ h for h in host_list if h and h.strip() ]

if type(host_list) == list:
self.parser = None
all = Group('all')
self.groups = [ all ]
for x in host_list:
Expand Down Expand Up @@ -281,7 +282,8 @@ def _get_variables(self, hostname):
vars.update(updated)

vars.update(host.get_variables())
vars.update(self.parser.get_host_variables(host))
if self.parser is not None:
vars.update(self.parser.get_host_variables(host))
return vars

def add_group(self, group):
Expand Down
2 changes: 1 addition & 1 deletion lib/ansible/inventory/dir.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def __init__(self, filename=C.DEFAULT_HOST_LIST):
for host in group.get_hosts():
if host.name not in self.hosts:
self.hosts[host.name] = Host(host.name)
for k, v in host.get_variables().iteritems():
for k, v in host.vars.iteritems():
self.hosts[host.name].set_variable(k, v)
self.groups[name].add_host(self.hosts[host.name])
# This needs to be a second loop to ensure all the parent groups exist
Expand Down
2 changes: 1 addition & 1 deletion lib/ansible/runner/action_plugins/group_by.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def run(self, conn, tmp, module_name, module_args, inject, complex_args=None, **
args = {}
if complex_args:
args.update(complex_args)
args.update(utils.parse_kv(module_args))
args.update(parse_kv(self.runner.module_args))
if not 'key' in args:
raise ae("'key' is a required argument.")

Expand Down
1 change: 0 additions & 1 deletion library/file
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ def main():
global module

module = AnsibleModule(
check_invalid_arguments = False,
argument_spec = dict(
state = dict(choices=['file','directory','link','absent'], default='file'),
path = dict(aliases=['dest', 'name'], required=True),
Expand Down
2 changes: 2 additions & 0 deletions library/slurp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ requirements: []
author: Michael DeHaan
'''

import base64

def main():
module = AnsibleModule(
argument_spec = dict(
Expand Down