[Puppet Users] How can I dynamically realize this?

Roberto Bouza
Thu, 10 Mar 2011 23:56:29 -0000

I have an array like this:

$items = [ "a", "-b" ]

That should generate something like this (let''s say for the Cron
resource:

Cron <| (tag == "a" or title == "a") and (tag !=
"b" or title != "b") |
>

The reason is because we are grouping sets of virtual resources with
tags to be realized (as a whole) but sometimes we don''t want an item
of that group to get realized.

Like:

@cron { "a":
  tag => "a",
}

@cron { "b":
  tag => "a",
}

@cron { "c":
  tag => "a",
}

All this is generated dynamically... I can write a function to
generate the string like:

$to_realize = (tag == "a" or title == "a") and (tag !=
"b" or title !"b")

but if I do

Cron <| $to_realize |>

It fails... brutally.

Any ideas?

Thank you.