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

Template variable stuff broken #1610

Closed
tonk opened this issue Nov 13, 2012 · 3 comments · Fixed by #1612
Closed

Template variable stuff broken #1610

tonk opened this issue Nov 13, 2012 · 3 comments · Fixed by #1612

Comments

@tonk
Copy link
Contributor

tonk commented Nov 13, 2012

Yesterday everything was working fine, but after a git pull; make install my run borked big time.

I got:

At revision 233.
Traceback (most recent call last):
  File "/usr/bin/ansible-playbook", line 172, in <module>
    sys.exit(main(sys.argv[1:]))
  File "/usr/bin/ansible-playbook", line 118, in main
    subset=options.subset,
  File "/usr/lib/python2.6/site-packages/ansible/playbook/__init__.py", line 119, in __init__
    (self.playbook, self.play_basedirs) = self._load_playbook_from_file(playbook)
  File "/usr/lib/python2.6/site-packages/ansible/playbook/__init__.py", line 169, in     _load_playbook_from_file
    p['vars'].update(incvars)
AttributeError: 'list' object has no attribute 'update'

Investigating this pointed me to my issue playbook, containing

# vim:ff=unix ts=4 sw=4 ai expandtab
# $Id: init.yml 209 2012-11-11 13:26:06Z tonk $

---
- hosts: all
  tasks:
      - name: deploy issue file
        template: src=issue.in dest=/etc/issue owner=root mode=0444

And the template containing

  ------------------------------------------------------------------------------
                               -- W A R N I N G --
                  UNAUTHORIZED ACCESS STRICTLY PROHIBITED!!
  ------------------------------------------------------------------------------
           System Name : {{ "%-25s"|format(ansible_hostname) }} Location : {{ location }}
           Managed by  : {{ "%-25s"|format(name)             }} Room     : {{ room }}
  ------------------------------------------------------------------------------
{% if issueremarks is defined %}
{{ issueremarks.center(80) }}
  ------------------------------------------------------------------------------
{% endif %}

When I roll back to the code of yesterday, things work again.

It does look as if an undefined variable is used things break. But that's what the is defined is for, so there seems to be a bug in the template stuff of last night.

Could you look into that, please?

@dhozac
Copy link
Contributor

dhozac commented Nov 13, 2012

What made you think that it is related to your template? The traceback you posted is only related to a playbook include and a play having vars as a list. PR #1612 should fix that.

@tonk
Copy link
Contributor Author

tonk commented Nov 13, 2012

Is there a way to get a better (and more usefull) traceback, or to isolate the problem?

@mpdehaan
Copy link
Contributor

not sure what "more useful" would mean.

@ansible ansible locked and limited conversation to collaborators Apr 24, 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