diff --git a/lib/ansible/playbook/play.py b/lib/ansible/playbook/play.py index e88667480d..1f8b67b617 100644 --- a/lib/ansible/playbook/play.py +++ b/lib/ansible/playbook/play.py @@ -195,22 +195,23 @@ class Play(Base, Taggable, Become): def _load_vars_prompt(self, attr, ds): new_ds = preprocess_vars(ds) vars_prompts = [] - for prompt_data in new_ds: - if 'name' not in prompt_data: - display.deprecated("Using the 'short form' for vars_prompt has been deprecated", version="2.7") - for vname, prompt in prompt_data.items(): - vars_prompts.append(dict( - name=vname, - prompt=prompt, - default=None, - private=None, - confirm=None, - encrypt=None, - salt_size=None, - salt=None, - )) - else: - vars_prompts.append(prompt_data) + if new_ds is not None: + for prompt_data in new_ds: + if 'name' not in prompt_data: + display.deprecated("Using the 'short form' for vars_prompt has been deprecated", version="2.7") + for vname, prompt in prompt_data.items(): + vars_prompts.append(dict( + name=vname, + prompt=prompt, + default=None, + private=None, + confirm=None, + encrypt=None, + salt_size=None, + salt=None, + )) + else: + vars_prompts.append(prompt_data) return vars_prompts def _compile_roles(self): diff --git a/lib/ansible/vars/manager.py b/lib/ansible/vars/manager.py index 09e8c400ad..f1b48e85ef 100644 --- a/lib/ansible/vars/manager.py +++ b/lib/ansible/vars/manager.py @@ -151,26 +151,6 @@ class VariableManager: raise AnsibleAssertionError("the type of 'value' for options_vars should be a dict, but is a %s" % type(value)) self._options_vars = value.copy() - def _preprocess_vars(self, a): - ''' - Ensures that vars contained in the parameter passed in are - returned as a list of dictionaries, to ensure for instance - that vars loaded from a file conform to an expected state. - ''' - - if a is None: - return None - elif not isinstance(a, list): - data = [a] - else: - data = a - - for item in data: - if not isinstance(item, MutableMapping): - raise AnsibleError("variable files must contain either a dictionary of variables, or a list of dictionaries. Got: %s (%s)" % (a, type(a))) - - return data - def get_vars(self, play=None, host=None, task=None, include_hostvars=True, include_delegate_to=True, use_cache=True): ''' Returns the variables, with optional "context" given via the parameters