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

NameError: global name 'AnsibleError' is not defined #17895

Closed
simon-sinx17 opened this issue Oct 4, 2016 · 2 comments
Closed

NameError: global name 'AnsibleError' is not defined #17895

simon-sinx17 opened this issue Oct 4, 2016 · 2 comments
Labels
affects_2.1 This issue/PR affects Ansible v2.1 bug This issue/PR relates to a bug.
Milestone

Comments

@simon-sinx17
Copy link

ISSUE TYPE
  • Bug Report
COMPONENT NAME

ansible

ANSIBLE VERSION
ansible 2.1.2.0
  config file = /home/user/a-bug-project/ansible.cfg
  configured module search path = Default w/o overrides

CONFIGURATION

empty config file

OS / ENVIRONMENT

F25

SUMMARY

typo in playbook resulted in unhandled exception

STEPS TO REPRODUCE
# site.yml

---

- hosts: all
  tasks:
    - include: test.yml

# test.yml

---
hosts: all

please note the missing "-" before hosts

cmd from dir where the files are located:
ansible-playbook site.yml
EXPECTED RESULTS

error handling

ACTUAL RESULTS
ansible-playbook site.yml -vvvv
Using /home/user/a-bug-project/ansible.cfg as config file
 [WARNING]: provided hosts list is empty, only localhost is available

ERROR! Unexpected Exception: global name 'AnsibleError' is not defined
the full traceback was:

Traceback (most recent call last):
  File "/usr/bin/ansible-playbook", line 92, in <module>
    exit_code = cli.run()
  File "/usr/lib/python2.7/site-packages/ansible/cli/playbook.py", line 154, in run
    results = pbex.run()
  File "/usr/lib/python2.7/site-packages/ansible/executor/playbook_executor.py", line 73, in run
    pb = Playbook.load(playbook_path, variable_manager=self._variable_manager, loader=self._loader)
  File "/usr/lib/python2.7/site-packages/ansible/playbook/__init__.py", line 53, in load
    pb._load_playbook_data(file_name=file_name, variable_manager=variable_manager)
  File "/usr/lib/python2.7/site-packages/ansible/playbook/__init__.py", line 98, in _load_playbook_data
    entry_obj = Play.load(entry, variable_manager=variable_manager, loader=self._loader)
  File "/usr/lib/python2.7/site-packages/ansible/playbook/play.py", line 115, in load
    return p.load_data(data, variable_manager=variable_manager, loader=loader)
  File "/usr/lib/python2.7/site-packages/ansible/playbook/base.py", line 219, in load_data
    self._attributes[name] = method(name, ds[name])
  File "/usr/lib/python2.7/site-packages/ansible/playbook/play.py", line 145, in _load_tasks
    return load_list_of_blocks(ds=ds, play=self, variable_manager=self._variable_manager, loader=self._loader)
  File "/usr/lib/python2.7/site-packages/ansible/playbook/helpers.py", line 58, in load_list_of_blocks
    loader=loader
  File "/usr/lib/python2.7/site-packages/ansible/playbook/block.py", line 79, in load
    return b.load_data(data, variable_manager=variable_manager, loader=loader)
  File "/usr/lib/python2.7/site-packages/ansible/playbook/base.py", line 219, in load_data
    self._attributes[name] = method(name, ds[name])
  File "/usr/lib/python2.7/site-packages/ansible/playbook/block.py", line 115, in _load_block
    use_handlers=self._use_handlers,
  File "/usr/lib/python2.7/site-packages/ansible/playbook/helpers.py", line 181, in load_list_of_tasks
    raise AnsibleError("included task files must contain a list of tasks", obj=data)
NameError: global name 'AnsibleError' is not defined

@ansibot ansibot added bug_report affects_2.1 This issue/PR affects Ansible v2.1 labels Oct 4, 2016
@alikins alikins added backport This PR does not target the devel branch. and removed backport This PR does not target the devel branch. labels Oct 4, 2016
@alikins
Copy link
Contributor

alikins commented Oct 4, 2016

Fixed in a942758 (#17259). That needs backport to 2.1

@bcoca bcoca modified the milestones: 2.2.0, stable-2.1 Oct 4, 2016
bcoca added a commit that referenced this issue Oct 4, 2016
@bcoca
Copy link
Member

bcoca commented Oct 4, 2016

pushed e72d1e9

@bcoca bcoca closed this as completed Oct 6, 2016
@ansibot ansibot added bug This issue/PR relates to a bug. and removed bug_report labels Mar 7, 2018
@ansible ansible locked and limited conversation to collaborators Apr 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.1 This issue/PR affects Ansible v2.1 bug This issue/PR relates to a bug.
Projects
None yet
Development

No branches or pull requests

4 participants