voxpupuli / puppet-nginx

Puppet Module to manage NGINX on various UNIXes
https://forge.puppet.com/puppet/nginx
MIT License
470 stars 879 forks source link

`nginx::string_mappings` in last tag v6.0.0 #1604

Open flepoutre opened 1 month ago

flepoutre commented 1 month ago

Hello, In the last tag v6.0.0, I have the impression that we are obliged to declare a mappings.

For example I can't use this (hiera example) :

nginx::string_mappings:
  uuid:
    ensure: present
    string: '$host'
    default: "''"
    mappings: {}

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Method call, max(): Wrong number of arguments need at least one

Could we make this possible again ?

Thanks.

TheMeier commented 3 weeks ago

This is likely because of this change: https://github.com/voxpupuli/puppet-nginx/pull/1575

This code breaks https://github.com/jay7x/puppet-nginx/blob/master/templates/conf.d/map.epp#L26 if mappings is empty.

I don't know what if the empty hash is a valid use case or not.

flepoutre commented 3 weeks ago

Hello, we have a few cases where the hash is empty on prod env ... It would be nice to make this possible. Thanks.