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

[BUG] Jinja variable 'default_database_type' is undefined local #118

Closed
mattboston opened this issue Feb 1, 2021 · 1 comment
Closed

Comments

@mattboston
Copy link

Your setup

Formula commit hash / release tag

postfix-formula: 42afb34 refs/tags/v1.2.2

Versions reports (master & minion)

Salt Version:
           Salt: 3000.6
 
Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: Not Installed
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
         Jinja2: 2.7.2
        libgit2: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   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.5 (default, Apr  2 2020, 13:16:51)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 15.3.0
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.5.3
            ZMQ: 4.1.4
 
System Versions:
           dist: centos 7.9.2009 Core
         locale: UTF-8
        machine: x86_64
        release: 3.10.0-1127.el7.x86_64
         system: Linux
        version: CentOS Linux 7.9.2009 Core

Pillar / config used

# vim: ft=yaml
---
postfix:
  manage_master_config: true

  enable_service: true
  reload_service: true

  config:
    smtpd_banner: $myhostname ESMTP $mail_name
    smtp_tls_CApath: /etc/ssl/certs
    biff: 'no'
    append_dot_mydomain: 'no'
    readme_directory: 'no'
    myhostname: localhost
    mydestination: localhost, localhost.localdomain
    relayhost: ''
    mynetworks: 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
    mailbox_size_limit: 0
    recipient_delimiter: +
    inet_interfaces: all
    inet_protocols: all

  mapping:

    smtp_sasl_password_maps:
      - email-smtp.us-east-1.amazonaws.com: AWS_USER:AWS_PASS

    sender_canonical_maps:
      - root: [email protected]
      - nagios: [email protected]

    relay_recipient_maps:
      - example.com: OK

Bug details

Describe the bug

I'm getting the following error when postfix.config is called

[root@minion1 etc]# salt-call state.apply roles.postfix -l info
[INFO    ] Loading fresh modules for state activity
[INFO    ] Fetching file from saltenv 'base', ** done ** 'postfix/config.sls'
[ERROR   ] Rendering exception occurred
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/salt/utils/templates.py", line 169, in render_tmpl
    output = render_str(tmplstr, context, tmplpath)
  File "/usr/lib/python2.7/site-packages/salt/utils/templates.py", line 404, in render_jinja_tmpl
    buf=tmplstr)
SaltRenderError: Jinja variable 'default_database_type' is undefined
[CRITICAL] Rendering SLS 'base:postfix.config' failed: Jinja variable 'default_database_type' is undefined
local:
    Data failed to compile:
----------
    Rendering SLS 'base:postfix.config' failed: Jinja variable 'default_database_type' is undefined

Steps to reproduce the bug

It looks like the config.sls needs code similar to line 44 in init.sls
{%- set default_database_type = salt['pillar.get']('postfix:config:default_database_type', 'hash') %}

@mattboston mattboston added the bug label Feb 1, 2021
mattboston added a commit to mattboston/postfix-formula that referenced this issue Feb 1, 2021
Fix for bug saltstack-formulas#118 where calling postfix.config throws an error: Jinja variable 'default_database_type' is undefined
alxwr added a commit to alxwr/postfix-formula that referenced this issue Apr 19, 2021
javierbertoli added a commit that referenced this issue Jan 25, 2022
fix(config): set default_database_type; fixes #118 (supersedes  #121)
saltstack-formulas-travis pushed a commit that referenced this issue Jan 25, 2022
## [2.0.1](v2.0.0...v2.0.1) (2022-01-25)

### Bug Fixes

* **config:** set default_database_type; fixes [#118](#118) ([3bd3d1c](3bd3d1c))

### Code Refactoring

* **config:** add `default_database_type` as default value ([6da70d2](6da70d2))

### Continuous Integration

* **3003.1:** update inc. AlmaLinux, Rocky & `rst-lint` [skip ci] ([3284d38](3284d38))
* **gemfile+lock:** use `ssf` customised `inspec` repo [skip ci] ([cfed974](cfed974))
* **kitchen:** move `provisioner` block & update `run_command` [skip ci] ([31a3836](31a3836))
* **kitchen+ci:** update with `3004` pre-salted images/boxes [skip ci] ([dec042a](dec042a))
* **kitchen+ci:** update with latest `3003.2` pre-salted images [skip ci] ([9688f36](9688f36))
* **kitchen+ci:** update with latest CVE pre-salted images [skip ci] ([76134b4](76134b4))
* add `arch-master` to matrix and update `.travis.yml` [skip ci] ([c631eca](c631eca))
* add Debian 11 Bullseye & update `yamllint` configuration [skip ci] ([c11c07d](c11c07d))
* **kitchen+gitlab:** adjust matrix to add `3003` [skip ci] ([04564a7](04564a7))
* **kitchen+gitlab:** remove Ubuntu 16.04 & Fedora 32 (EOL) [skip ci] ([d56006f](d56006f))

### Tests

* standardise use of `share` suite & `_mapdata` state [skip ci] ([4c394a7](4c394a7))
@saltstack-formulas-travis

🎉 This issue has been resolved in version 2.0.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

No branches or pull requests

2 participants