Jira (PUP-10350) Abort puppet run if empty values retrieved

9 views
Skip to first unread message

Josh Cooper (Jira)

unread,
Mar 4, 2020, 10:19:03 AM3/4/20
to puppe...@googlegroups.com
Josh Cooper moved an issue
 
Puppet / New Feature PUP-10350
Abort puppet run if empty values retrieved
Change By: Josh Cooper
Component/s: puppet-runtime
Component/s: Hiera & Lookup
Key: PA PUP - 3164 10350
Project: Puppet Agent
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

Josh Cooper (Jira)

unread,
Mar 4, 2020, 1:26:03 PM3/4/20
to puppe...@googlegroups.com
Josh Cooper commented on New Feature PUP-10350
 
Re: Abort puppet run if empty values retrieved

I imagine someone is relying on lookup being able to return an empty string, which is different than nil. I think we'd need to pass an argument to the lookup call to reject empty strings. Thoughts Henrik Lindberg?

Henrik Lindberg (Jira)

unread,
Mar 4, 2020, 1:46:03 PM3/4/20
to puppe...@googlegroups.com

In hiera 5 there is a difference between nil and empty string - both are valid as values in yaml - if that is what you are asking.

As long as the backend signals "not found" as it should I think it should be possible to return both "undef" and empty string. This because you may want to be able to override some other bound value with "nothing". 

A user can do a type cast to String[1] to ensure they do not get undef or empty string. (but may be difficult in practice - not sure if it returns Sensitive or not).

Alexander Sinchinov (Jira)

unread,
Mar 6, 2020, 3:28:03 AM3/6/20
to puppe...@googlegroups.com

Henrik Lindberg, thanks for prompt reply. The doc topic https://puppet.com/docs/puppet/5.5/function.html#asserttype says how to use type converions in manifest code. It is quite complicated to modify all my manifests in such manner.

Is it possible to declare a type conversion as global lookup_options parameter?

Henrik Lindberg (Jira)

unread,
Mar 6, 2020, 4:59:03 AM3/6/20
to puppe...@googlegroups.com

The lookup_options allows you to use a pattern to match keys - the options then applies to all keys that match that pattern. It gets a bit difficult if you also want to set other options but not the same way for all matched keys - for example options for deep merging.

Reply all
Reply to author
Forward
0 new messages