Skip to content

failed: Jinja variable 'dict object' has no attribute #16656

Closed

Description

@pedro-teixeira

After a apt-get upgrade I'm having problems with pillar variables and I can't see any error on my side.

Pillar

postfix:
  relay:
    host: "[smtp.example.org]:587"
    user: [email protected]
    api_key: example

Salt

/etc/postfix/main.cf:
  file.managed:
    - source: salt://postfix/files/main.cf
    - template: jinja
    - user: root
    - group: root
    - mode: 644
    - makedirs: true
    - defaults:
        postfix: {{ pillar.postfix }}

/etc/postfix/sasl_passwd:
  file.managed:
    - source: salt://postfix/files/sasl_passwd
    - template: jinja
    - user: root
    - group: root
    - mode: 644
    - makedirs: true
    - defaults:
        postfix: {{ pillar.postfix }}

Result

----------
    Rendering SLS "dev:postfix.config" failed: Jinja variable 'dict object' has no attribute 'postfix'; line 34

---
[...]
   - user: root
   - group: root
   - mode: 644
   - makedirs: true
   - defaults:
       postfix: {{ pillar.postfix }}    <======================

---

Versions

salt-call 2014.1.11 (Hydrogen)
Ubuntu 14.04.1 LTS

Activity

  1. zheli commented on Oct 15, 2014

    @zheli

    +1

  2. added
    bug
    severity-low
    Regression
    on Oct 15, 2014
  3. added this to the Approved milestone on Oct 15, 2014
  4. cachedout commented on Oct 15, 2014

    @cachedout
    Contributor

    Thanks for the report. We'll take a look.

  5. neilferreira commented on Oct 16, 2014

    @neilferreira

    +1

  6. shaunorman commented on Oct 16, 2014

    @shaunorman

    +ONE

  7. sevenseacat commented on Oct 16, 2014

    @sevenseacat

    +1

  8. shadowmint commented on Oct 16, 2014

    @shadowmint

    +1

  9. joelwhitehouse commented on Oct 16, 2014

    @joelwhitehouse

    This issue is also affecting Ubuntu 12.04 LTS with salt-call 2014.1.11 (Hydrogen) running in masterless mode.

  10. pedro-teixeira commented on Oct 16, 2014

    @pedro-teixeira
    Author

    That's exactly my case. Do you know what version caused this problem so maybe we can rollback until the problem is not fixed?

  11. zheli commented on Oct 16, 2014

    @zheli

    I went for git version v2014.1.5 and it works fine.

  12. added
    severity-medium
    and removed
    severity-low
    on Oct 16, 2014
  13. cachedout commented on Oct 16, 2014

    @cachedout
    Contributor

    This appears fixed in 2014.1.12 in my testing. Could somebody please confirm? Thanks!

  14. added
    fixed-pls-verify
    on Oct 16, 2014
  15. thatch45 commented on Oct 17, 2014

    @thatch45
    Contributor

    @whiteinge you may know something we don't, I did not realize we had attribute lookups on the pillar dict in 2014.1. I will dive in.

  16. whiteinge commented on Oct 17, 2014

    @whiteinge
    Contributor

    I haven't caught up on this issue yet but Jinja default behavior will do
    dictionary lookups using dot-notation. That doesn't work with the Salt dict
    because the keys have dots in the name. Thus my addition to the Jinja
    renderer -- which should also affect Pillar. I don't know if that is
    related to this or not.

  17. rallytime commented on Nov 18, 2014

    @rallytime
    Contributor

    I know we had a regression with 2014.1.11, but I believe this issue has been fixed with both 2014.1.13 and 2014.7.0. Is anyone still seeing this problem on either of those releases?

  18. dlax commented on Nov 19, 2014

    @dlax
    Contributor

    @rallytime I also had the problem with 2014.1.11 and went back to .7 in the meantime. I just tried with .13, and the issue does seem to be fixed.

  19. pedro-teixeira commented on Nov 19, 2014

    @pedro-teixeira
    Author

    Version 2014.1.13 is working fine for me with masterless on Ubuntu.

  20. rallytime commented on Nov 19, 2014

    @rallytime
    Contributor

    Excellent! I'm going to go ahead a close this issue then. If anyone is still seeing problems here, leave a comment and we'll happily re-open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Regressionbugfixed-pls-verifyseverity-medium

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions