saltstack-formulas / postfix-formula

http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html
Other
25 stars 130 forks source link

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

Closed mattboston closed 2 years ago

mattboston commented 3 years ago

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: devnotifications@example.com
      - nagios: devnotifications@example.com

    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') %}

saltstack-formulas-travis commented 2 years ago

:tada: This issue has been resolved in version 2.0.1 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: