merovingian
merovingian

Reputation: 45

failed: Jinja variable 'salt.utils.context.NamespacedDictWrapper object' has no attribute 'env'

Just inherited a salt implementation and I'm running into an error that I just can't seem to figure out. I have 5 minions that are all running perfectly, but when I added the 6th I get the following error:

Rendering SLS 'production:clientxyz.init' failed: Jinja variable 'salt.utils.context.NamespacedDictWrapper object' has no attribute 'env'

this looks to be specific to that 6th minion as all the others successfully run. I can execute a test.ping against the minion so the communication appears to be working.

Here are some details about the current deployment:

salt minion

           Salt: 3000.3

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 2.4.2
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
         Jinja2: 2.8
        libgit2: Not Installed
       M2Crypto: Not Installed
           Mako: 1.0.3
   msgpack-pure: Not Installed
 msgpack-python: 0.6.2
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.12 (default, Apr 15 2020, 17:07:12)
   python-gnupg: 0.3.8
         PyYAML: 3.11
          PyZMQ: 15.2.0
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.5.3
            ZMQ: 4.1.4

System Versions:
           dist: Ubuntu 16.04 xenial
         locale: UTF-8
        machine: x86_64
        release: 4.4.0-1109-aws
         system: Linux
        version: Ubuntu 16.04 xenial

salt master

Salt Version:
           Salt: 3000.2

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 2.6.1
      docker-py: Not Installed
          gitdb: 2.0.3
      gitpython: 2.1.8
         Jinja2: 2.10
        libgit2: 0.26.0
       M2Crypto: Not Installed
           Mako: 1.0.7
   msgpack-pure: Not Installed
 msgpack-python: 0.5.6
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: 0.26.2
         Python: 2.7.17 (default, Apr 15 2020, 17:20:14)
   python-gnupg: 0.4.1
         PyYAML: 3.12
          PyZMQ: 16.0.2
          smmap: 2.0.3
        timelib: Not Installed
        Tornado: 4.5.3
            ZMQ: 4.2.5

System Versions:
           dist: Ubuntu 18.04 bionic
         locale: UTF-8
        machine: x86_64
        release: 5.3.0-1023-aws
         system: Linux
        version: Ubuntu 18.04 bionic

clientxyz.init

clientxyz_group:
  group.present:
    - name: clientxyz
    - system: True

clientxyz_user:
  user.present:
    - name: clientxyz
    - groups:
      - clientxyz
  require:
    - group: clientxyz_group

{% if pillar['env'] == 'prod' %}
/opt/prod/clientxyz/.env_file.prod:
  file:
    - managed
    - template: jinja
    - source: salt://env_templates/production/files/.env_file.prod
 {% endif %}

top.sls

  '*':
    - data
    - file_hash
    - global_vars
  
# Production
  ‘ClientXYZ:
    - clientxyz
    - production_shared
  ‘ClientABC’:
    - clientabc
    - production_shared

clientxyz.sls

#!yaml|gpg
fb_files:
  /var/log/syslog: clientxyz
env: prod
namespace: Production
subscriptions:

DB_HOST: <database hostname>
DB_PORT: 5432
DB_USER: clientxyz_user
DB_NAME: clientxyz_database
DB_PWD: |
  -----BEGIN PGP MESSAGE-----

  ENCRYPTED PASSWORD REMOVED
  -----END PGP MESSAGE-----

I'm not sure what else to include in this, idk if this is a version issue between the master and minion, or if that 'env' error is referring to the piller['env'] reference in the clientxyz.init. Sort of at a loss here, any help would be greatly appreciated!

Upvotes: 0

Views: 3345

Answers (1)

merovingian
merovingian

Reputation: 45

This turned out to be an issue with gitlab and deploy keys. The minion was running a cached version of the repo and it wasn't updated with the latest pillars.

Upvotes: 0

Related Questions