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

[v2] NameError: global name 'vars_copy' is not defined #13213

Closed
mgedmin opened this issue Nov 19, 2015 · 5 comments · Fixed by #13214
Closed

[v2] NameError: global name 'vars_copy' is not defined #13213

mgedmin opened this issue Nov 19, 2015 · 5 comments · Fixed by #13214

Comments

@mgedmin
Copy link
Contributor

mgedmin commented Nov 19, 2015

Ansible Version

ansible 2.0.0 (devel 3d1255d190) last updated 2015/11/19 08:14:50 (GMT +300)
  lib/ansible/modules/core: (detached HEAD b1c0249045) last updated 2015/11/18 11:45:09 (GMT +300)
  lib/ansible/modules/extras: (detached HEAD 7da1f8d4ca) last updated 2015/11/18 11:45:09 (GMT +300)

Summary

My test playbook fails with this traceback:

TASK [common : generate locales] ***********************************************
task path: /home/mg/src/deployments/provisioning/roles/common/tasks/locales.yml:7
An exception occurred during task execution. The full traceback is:
Traceback (most recent call last):
  File "/home/mg/src/ansible/lib/ansible/executor/process/worker.py", line 135, in run
    shared_loader_obj,
  File "/home/mg/src/ansible/lib/ansible/executor/task_executor.py", line 87, in run
    items = self._get_loop_items()
  File "/home/mg/src/ansible/lib/ansible/executor/task_executor.py", line 191, in _get_loop_items
    templar=templar).run(terms=loop_terms, variables=vars_copy)
NameError: global name 'vars_copy' is not defined

fatal: [precise]: FAILED! => {"failed": true, "stdout": ""}

The task in question looks like this:

- name: generate locales
  locale_gen: name={{ item }} state=present
  with_items:
    - en_US.UTF-8
    - lt_LT.UTF-8
  tags: locales
@mgedmin
Copy link
Contributor Author

mgedmin commented Nov 19, 2015

This bug was introduced in 3d1255d.

@amenonsen
Copy link
Contributor

3d1255d is the commit responsible.

("Fixes #13113, breaks #13213" :-)

@mgedmin
Copy link
Contributor Author

mgedmin commented Nov 19, 2015

$ pyflakes lib/ansible/executor/task_executor.py
lib/ansible/executor/task_executor.py:191: undefined name 'vars_copy'
lib/ansible/executor/task_executor.py:611: local variable 'res' is assigned to but never used

@palmerabollo
Copy link
Contributor

Thanks for the fix. This issue is important as it breaks any playbook using loops. Would it be possible to release a new beta4 including this fix?

@palmerabollo
Copy link
Contributor

RC1 is ready. Thanks!

@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
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants