Search code examples
puppetboxen

what does this Puppet code do: Homebrew::Formula <| |> -> Package <| |>


can someone please explain what this Puppet code means?

Homebrew::Formula <| |> -> Package <| |>

it can be found in the boxen/our-boxen github repo. i'm totally noob to Puppet (and Boxen). i've been reading another SO question and what seems to be the relevant Puppet docs, but Puppet has a lot of domain-specific concepts and operations, and i've yet to wrap my head around this one.

thanks in advance.


Solution

  • The Resource::Type<| |> syntax is indeed meant for the collection of virtual resources, e.g. you have one

    @homebrew::formula { "mytitle": param => value, ... }
    

    in the manifest at some point (maybe others with different resource titles) and all classes that want to make sure those are realized into actual resources, do a collection using either

    Homebrew::Formula<| title == 'mytitle' |>
    

    or

    realize(homebrew[mytitle])
    

    Note that Homebrew::Formula <| |> will realize all virtual resource.

    A little known fact is that the same syntax can be used to do overrides, e.g.

    Homebrew::Formula<| title == 'mytitle' |> { param => other_value }
    

    even if the original resource was not virtual.

    It is likely that the quoted statement is used as an override to state that all homebrew::formula resources should be evaluated before any package resource.