Jira (HI-599) Hiera cannot interpolate non-string values
Title: Message Title Thomas Hallgren commented on HI-599 Re: Hiera cannot interpolate non-string values Perhaps we should have something identical to the strict_alias proposed in PUP-8593?. Given that an interpolation without any function is identical to scope, we could make strict imply a strict lookup in scope. E.g. docker::selinux_enabled: "%{strict('facts.selinux.enabled')}" would give the desired result. Add Comment This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-bugs/JIRA.244421.1522942982000.3157.1580237280323%40Atlassian.JIRA.
Jira (HI-599) Hiera cannot interpolate non-string values
Title: Message Title Henrik Lindberg commented on HI-599 Re: Hiera cannot interpolate non-string values The solution is to write a simple hiera backend function (in the puppet language) that returns the value. Alternatively if the String form can be parsed (for example for Integer, Boolean and Float values), the existing type casting feature in lookup_options works - i.e. transforming the string value back to the original data type. This in wait of the possible alias feature mentioned above (possibly) being introduced. Add Comment This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at https://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (HI-599) Hiera cannot interpolate non-string values
Title: Message Title Henning Andersen commented on HI-599 Re: Hiera cannot interpolate non-string values Any news on this? Add Comment This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at https://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (HI-599) Hiera cannot interpolate non-string values
Title: Message Title Rune Juhl Jacobsen commented on HI-599 Re: Hiera cannot interpolate non-string values Henrik Lindberg Absolutely, I completely understand the reluctance to do something like this – I just thought I'd mention it, since it's what popped into my head as soon as I saw this issue I'd love to (have the time to) try implementing it as a proof of concept new Hiera backend... Add Comment This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at https://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (HI-599) Hiera cannot interpolate non-string values
Title: Message Title Henrik Lindberg commented on HI-599 Re: Hiera cannot interpolate non-string values Rune Juhl Jacobsen Modifying YAML to be non standard is not a happy path. Going there, you would need to invent a new hiera format. Note that if you write a lookup_key kind of hiera backend function you handle interpolations yourself, and you can either call the built in standard "hiera 3 like" interpolation or do it some other way. That means you can process results with your own interpolation mechanism. Add Comment This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at https://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (HI-599) Hiera cannot interpolate non-string values
Title: Message Title Rune Juhl Jacobsen commented on HI-599 Re: Hiera cannot interpolate non-string values Since you're already using YAML, maybe it would make sense to make use of the existing syntax for YAML anchors? Instead of making the Hiera-specific syntax more convoluted by adding an optional argument for type coercion, as suggested in comment #1, this would keep the syntax (relatively) simple. According to the YAML 1.2 spec there shouldn't be any problem with anchors containing any of the valid characters for Puppet identifiers, i.e. an anchor like *::some::weird_identifier::here is perfectly fine. With that it would be possible to use any types in facts without having to explicitly state the type. I imagine it's possible to hook into the YAML deserialization to make this possible. Of course, this means that Puppet YAML breaks the YAML spec by abusing anchors, but I imagine that not many people use YAML anchors, and even less people use YAML anchors with :: in them, making this less of an issue. Add Comment This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at https://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (HI-599) Hiera cannot interpolate non-string values
Title: Message Title Trevor Vaughan commented on HI-599 Re: Hiera cannot interpolate non-string values Henrik Lindberg I think that scope should work the same way as alias. It makes sense. I can see that some people might rely on that but that seems like a bug and should be treated as such. In theory, your Hiera data is getting passed into your classes and everything should be strongly typed at this point (hopefully). Add Comment This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at https://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (HI-599) Hiera cannot interpolate non-string values
Title: Message Title Henrik Lindberg commented on HI-599 Re: Hiera cannot interpolate non-string values I could argue that scope should work the same way as alias - it is not backwards compatible though to make such a change as some may rely on it interpolating the variable as a string. I am very reluctant to introduce new interpolation functions (especially when they are not actual string interpolations) and I am also very reluctant to introduce any syntax into the data values used in hiera data. What we could do is to solve this with lookup_options - we have a ticket for a real alias expressed in lookup_options. Would not be terribly hard to also support a variable/dig reference (mutually exclusive with use of alias). Add Comment This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at https://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (HI-599) Hiera cannot interpolate non-string values
Title: Message Title Trevor Vaughan commented on HI-599 Re: Hiera cannot interpolate non-string values Henrik Lindberg Unfortunately, using scope still results in a String instead of a Boolean value. Add Comment This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at https://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (HI-599) Hiera cannot interpolate non-string values
Title: Message Title Henrik Lindberg commented on HI-599 Re: Hiera cannot interpolate non-string values In a custom backend you can do whatever you want. The lookup_key kind does not automatically perform hira interpolation of the returned values. For a data_hash you would return a hash where the variable reference is already resolved using for example the {[dig}} function to drill down into the value. Add Comment This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at https://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (HI-599) Hiera cannot interpolate non-string values
Title: Message Title Henrik Lindberg commented on HI-599 Re: Hiera cannot interpolate non-string values Right, alias does not actually work because that is a lookup in hiera, not a variable reference. The documentation shows that there also is a scope interpolation function (See https://puppet.com/docs/puppet/5.0/hiera_interpolation.html#using-interpolation-functions). Have you tried: docker::selinux_enabled: "%{scope(facts.selinux.enabled)}" That seems to be what you are after? Not sure if it retains the data type of the variable though. Add Comment This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at https://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (HI-599) Hiera cannot interpolate non-string values
Title: Message Title Trevor Vaughan commented on HI-599 Re: Hiera cannot interpolate non-string values Henrik Lindberg Yes, unfortunately, that doesn't work with facts. Since the use of typed facts is now the norm, Hiera should be able to have a way to ensure that the data type of facts is preserved. Add Comment This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at https://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (HI-599) Hiera cannot interpolate non-string values
Title: Message Title Henrik Lindberg assigned an issue to Carl Caum Hiera / HI-599 Hiera cannot interpolate non-string values Change By: Henrik Lindberg Assignee: Carl Caum Add Comment This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at https://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (HI-599) Hiera cannot interpolate non-string values
Title: Message Title Henrik Lindberg commented on HI-599 Re: Hiera cannot interpolate non-string values There is the alias/lookup hiera interpolation function which when used retains the data type of the aliased value - for that to work the string with the interpolation cannot contain anything besides that alias lookup. Add Comment This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at https://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (HI-599) Hiera cannot interpolate non-string values
Title: Message Title Craig Gomes updated an issue Hiera / HI-599 Hiera cannot interpolate non-string values Change By: Craig Gomes Team: Platform Core Add Comment This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at https://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (HI-599) Hiera cannot interpolate non-string values
Title: Message Title Craig Gomes updated an issue Hiera / HI-599 Hiera cannot interpolate non-string values Change By: Craig Gomes Sub-team: Language Add Comment This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at https://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (HI-599) Hiera cannot interpolate non-string values
Title: Message Title Trevor Vaughan commented on HI-599 Re: Hiera cannot interpolate non-string values It would be ideal if, instead of overriding particular lookups at the configuration layer, that this could be exposed at interpolation time so that it is less confusing for users. For instance, something like the following would be nice: "%{typed('facts.selinux.enabled', 'Boolean')}" Add Comment This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at https://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (HI-599) Hiera cannot interpolate non-string values
Title: Message Title Carl Caum created an issue Hiera / HI-599 Hiera cannot interpolate non-string values Issue Type: Bug Assignee: Unassigned Created: 2018/04/05 8:43 AM Priority: Normal Reporter: Carl Caum It is not possible for Hiera to interpolate non-string values from Facter. For example, the `selinux.enabled` fact has a Boolean value. However, in Hiera you cannot do something like: docker::selinux_enabled: %{facts.selinux.enabled} Instead, the user has to quote the facter fact code so it can be interpolated, like this: docker::selinux_enabled: "%{facts.selinux.enabled}" which inadvertently casts any non-string values to a string. Example of a user experiencing this problem: https://github.com/puppetlabs/puppetlabs-docker/issues/212