How to identify if a optional attribute of resource is present in node configuration on puppet client run

15 views
Skip to first unread message

smartway

unread,
Sep 29, 2014, 1:44:37 AM9/29/14
to puppe...@googlegroups.com

A optional attribute of a resource defaults to a value which is not supported
on one of the platforms.
I want add a platform check to block the attribute, if the attribute is given by user throw a error.
Type file for this resource is present in other module which i cannot modify.
Is there a way to know if the attribute in present in manifest file and add a check for same in
my module.



Henrik Lindberg

unread,
Sep 29, 2014, 11:01:01 AM9/29/14
to puppe...@googlegroups.com
On 2014-29-09 7:44, smartway wrote:
>
> A optional attribute of a resource defaults to a value which is not
> supported
> on one of the platforms.

If it defaults to an illegal value via the Resource Defaults mechanism,
it will be difficult to look it up.

> I want add a platform check to block the attribute, if the attribute is
> given by user throw a error.
> Type file for this resource is present in other module which i cannot
> modify.
> Is there a way to know if the attribute in present in manifest file and
> add a check for same in
> my module.
>
The order of evaluation makes this difficult. You can perhaps use a
collect expression with an override to set value to something else.
Making it fail in this case is more difficult, something crazy like
evaluating faulty overrides may work - e.g.

thetype <| theparam == unwanted_value |> {
bad_use_of_the_param => 'stop'
}

(untried, it may fail even if the query does not return any resources).

- henrik

>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Puppet Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to puppet-dev+...@googlegroups.com
> <mailto:puppet-dev+...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-dev/c1bba88b-1e0c-4b4b-bdf6-a75a0f2124fb%40googlegroups.com
> <https://groups.google.com/d/msgid/puppet-dev/c1bba88b-1e0c-4b4b-bdf6-a75a0f2124fb%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.


--

Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/

Reply all
Reply to author
Forward
0 new messages