ansible-community / ansible-nomad

:watch: Ansible role for Nomad
https://galaxy.ansible.com/brianshumate/nomad
BSD 2-Clause "Simplified" License
297 stars 165 forks source link

Correctly handle list items under nomad_plugins, fixes #127 #128

Open bradleydwyer opened 3 years ago

Rendanic commented 3 years ago

This fix is at a wrong place.

The following block creates the config for allow_caps

plugin "{{ key }}" {
{{ plugin_config(value) }}
}

My quick and dirty fix: {{ plugin_config(value) | replace('\'', '\"') }}

The major problem is, that jinja2 cannot create HCL at this point.

bradleydwyer commented 3 years ago

@Rendanic The primary issue that I was trying to fix was the casing rather than quoting. It was this casing issue that led me to put the change where I did, as that is where the lowercase operation takes place.

I'm not overly familiar with this project and I don't really mind where any potential fix is placed, just wanted to mention there is the second casing issue in addition to the quoting issue (as I mostly lent on using the example to describe the problem, rather than explaining the two different issues explicitly so it would have been easy to miss).

That said, I haven't actually tried your fix yet and it could be that it does avoid the lowercase operation. If so just ignore this comment.

lanefu commented 2 years ago

would like some final vetting from someone if possible

Rendanic commented 2 years ago

I created a PR (#152) with my fix.