saltstack-formulas / apache-formula

Set up and configure the Apache HTTP server
http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html
Other
50 stars 285 forks source link

[BUG] apache.config.vhosts.standard: mapping error when "enabled: false" #302

Closed genaumann closed 3 years ago

genaumann commented 3 years ago

Your setup

Formula commit hash / release tag

Current commit hash: 3c21740ba52fa5c2b5cf39cddce6a42d13d17988

Versions reports (master & minion)

Salt Version:
          Salt: 3003

Dependency Versions:
          cffi: 1.14.2
      cherrypy: unknown
      dateutil: 2.7.3
     docker-py: Not Installed
         gitdb: 2.0.5
     gitpython: 2.1.11
        Jinja2: 2.10
       libgit2: 0.27.7
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 0.5.6
  msgpack-pure: Not Installed
  mysql-python: 1.3.10
     pycparser: 2.20
      pycrypto: 2.6.1
  pycryptodome: 3.6.1
        pygit2: 0.27.4
        Python: 3.7.3 (default, Jan 22 2021, 20:04:44)
  python-gnupg: Not Installed
        PyYAML: 3.13
         PyZMQ: 17.1.2
         smmap: 2.0.5
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.3.1

System Versions:
          dist: debian 10 buster
        locale: UTF-8
       machine: x86_64
       release: 4.19.0-16-amd64
        system: Linux
       version: Debian GNU/Linux 10 buster

Pillar / config used

apache:
  sites:
    test.example.com-80:
      ServerName: test.example.com
      enabled: false
      template_file: salt://apache/vhosts/redirect.tmpl
      port: '80'
      interface: '*'
      RedirectMatch: true
      RedirectSource: '/'
      RedirectTarget: 'https://test.example.com'
      ErrorLog: ${APACHE_LOG_DIR}/error.log
      CustomLog: ${APACHE_LOG_DIR}/access.log
      DocumentRoot: false

Bug details

Describe the bug

When a site configuration is to be deactivated (enabled: false), the state apache.config.vhosts.standard throws the following error: failed: mapping values are not allowed in this context

When I change the value to enabled: true , the state will run without any errors.

Log at salt-master:

pillar.get: Default () is of type 'str', must be a dict or list to merge. Merge will be skipped.

myii commented 3 years ago

@genaumann Thanks for this report. Bug confirmed locally using Kitchen. Tracked it down to this line:

https://github.com/saltstack-formulas/apache-formula/blob/3c21740ba52fa5c2b5cf39cddce6a42d13d17988/apache/config/vhosts/standard.sls#L70

Please remove the trailing colon which shouldn't be there. That's working at my end. I'll push through a PR in the meantime.

myii commented 3 years ago

@genaumann Fix proposed in #303, please confirm there and we'll get that merged.

saltstack-formulas-travis commented 3 years ago

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

The release is available on GitHub release

Your semantic-release bot :package::rocket: