bartavelle / language-puppet

A library to work with Puppet manifests, test them and eventually replace everything ruby.
BSD 3-Clause "New" or "Revised" License
51 stars 8 forks source link

Optional value should be set to Nothing when value '~' is set in Hiera #261

Closed PierreR closed 5 years ago

PierreR commented 5 years ago

If you define such a class:

class application::docker::elastic (
  Optional[String] $version
) {

}

With a key/value set to application::docker::elastic::version: ~ in hiera, language-puppet should not complain about a mandatory parameter not set :

ERROR: (docker.elastic.dev) The following mandatory parameters were not set: (version) when including class application::docker::elastic at ./manifests/site.pp:14:5
bartavelle commented 5 years ago

I do not know what ~ means!

PierreR commented 5 years ago

It means 'NULL' in yaml: https://stackoverflow.com/questions/8667766/what-does-mean-in-the-yml-configuration-file-in-symfony-2

PierreR commented 5 years ago

The Yaml parsing bit seems to work quite alright: https://github.com/bartavelle/language-puppet/commit/12aa29b4d2c7cde376931415c2582eb05a500454

bartavelle commented 5 years ago

Nice!