reversing the processing sequence of hiera data

31 views
Skip to first unread message

Frank Ihringer

unread,
Jun 16, 2020, 11:12:19 AM6/16/20
to Puppet Users
hello
I'm just taking my first steps with puppet and aws (puppetlabs/aws module). Setting up resources (controlled by hiera)  works fine (using .each loop). But if I want to delete the resources afterwards (with absent) I get dependency errors (which is obvious, because the resources are processed in the same order). I have to do it resource by resource from the end of the list. Is there a simple way to reverse the processing order (last hiera aws object first) ???

I'm hoping someone here can give me an advice ...

(btw: I'm working with puppet 6)

Best regards 

Frank

Henrik Lindberg

unread,
Jun 22, 2020, 9:41:56 AM6/22/20
to puppet...@googlegroups.com
On 2020-06-16 13:56, 'Frank Ihringer' via Puppet Users wrote:
> hello
> I/'/m just taking my first steps with puppet and aws (puppetlabs/aws
> module). Setting up resources (controlled by hiera)  works fine (using
> .each loop). But if I want to delete the resources afterwards (with
> absent) I get dependency errors (which is obvious, because the resources
> are processed in the same order). I have to do it resource by resource
> from the end of the list. Is there a simple way to reverse the
> processing order (last hiera aws object first) ???
>
> I'm hoping someone here can give me an advice ...

There is a `reverse_each()` function in puppet. Is that what you are
looking for ?

- henrik
>
> (btw: I'm working with puppet 6)
>
> Best regards
>
> Frank
>
> --
> You received this message because you are subscribed to the Google
> Groups "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to puppet-users...@googlegroups.com
> <mailto:puppet-users...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/d14f3b8f-a8fe-40eb-b187-653b1dac9040o%40googlegroups.com
> <https://groups.google.com/d/msgid/puppet-users/d14f3b8f-a8fe-40eb-b187-653b1dac9040o%40googlegroups.com?utm_medium=email&utm_source=footer>.


--

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

Frank Ihringer

unread,
Jul 14, 2020, 3:49:51 PM7/14/20
to Puppet Users
Hi Henrik (yeah, I took my time, but I was otherwise stressed)

good idea and I have tested the 'reverse_each' allready, but it seems that everything is reversed (including the sub levels) and therefore the hiera data does not make sense anymore after reverting. It would only make sense if it could be limited to the top level of the hierarchy. I have solved it now in such a way that I have manually reversed the order of the aws objects (which is unfortunately error-prone, since every time a change must be made here too)


Best regards

Frank

Henrik Lindberg

unread,
Jul 15, 2020, 12:47:40 PM7/15/20
to puppet...@googlegroups.com
On 2020-07-14 20:49, 'Frank Ihringer' via Puppet Users wrote:
> Hi Henrik (yeah, I took my time, but I was otherwise stressed)
>
> good idea and I have tested the 'reverse_each' allready, but it seems
> that everything is reversed (including the sub levels) and therefore the
> hiera data does not make sense anymore after reverting. It would only
> make sense if it could be limited to the top level of the hierarchy. I
> have solved it now in such a way that I have manually reversed the order
> of the aws objects (which is unfortunately error-prone, since every time
> a change must be made here too)
>
>

The reverse_each function only iterates over the top level (and in
reverse) so impossible that it inverts everything that is nested.

- henrik


> Best regards
>
> Frank
>
> Am Montag, 22. Juni 2020 15:41:56 UTC+2 schrieb Henrik Lindberg:
>
> On 2020-06-16 13:56, 'Frank Ihringer' via Puppet Users wrote:
> > hello
> > I/'/m just taking my first steps with puppet and aws (puppetlabs/aws
> > module). Setting up resources (controlled by hiera)  works fine
> (using
> > .each loop). But if I want to delete the resources afterwards (with
> > absent) I get dependency errors (which is obvious, because the
> resources
> > are processed in the same order). I have to do it resource by
> resource
> > from the end of the list. Is there a simple way to reverse the
> > processing order (last hiera aws object first) ???
> >
> > I'm hoping someone here can give me an advice ...
>
> There is a `reverse_each()` function in puppet. Is that what you are
> looking for ?
>
> - henrik
> >
> > (btw: I'm working with puppet 6)
> >
> > Best regards
> >
> > Frank
> >
>
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to puppet-users...@googlegroups.com
> <mailto:puppet-users...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/875b6586-c8ba-46ca-a5c4-0390f37ac45eo%40googlegroups.com
> <https://groups.google.com/d/msgid/puppet-users/875b6586-c8ba-46ca-a5c4-0390f37ac45eo%40googlegroups.com?utm_medium=email&utm_source=footer>.
Reply all
Reply to author
Forward
0 new messages