On Tue, Feb 1, 2011 at 12:30 AM, Dan Bode <[email protected]> wrote:
> Hi all,
>
> I am trying to reduce a catalog down to only the resources with their
> dependencies.
>
> I can get all resources in the catalog (including defined resource types,
> classes, stages, and nodes) with the @catalog.resources method:
>
> I can get just the resources that will be applied with:
>
> @catalog.relationship_graph.topsort
>
> the problem is that the relationshipgraph view loses dependencies between:
> defined resource types/stages/classes.
>
> Any pointers as to where in the code this is sorted out during apply?
> Ideally, I could use this to figure out how to write a reduce method.
Daniel gave some pointers when I tried to tackle this issue. The
method is adjacent:
# load catalog and pick a resource
catalog=YAML.load_file("foo.yaml")
res=catalog.vertices.find {|v| v.type=="Class" and v.title=="Service" }
# adjacent resources
> puts catalog.adjacent(res)
File[/tmp/service.conf]
Exec[rebuild-service]
File[/tmp/service.d]
File[/tmp/service.d/00_header]
# tree from vertex appears to perform a breadth first search via walk
down that resource.
> puts catalog.tree_from_vertex(res)
File[/tmp/service.conf]Class[Service]Exec[rebuild-service]Class[Service]File[/tmp/service.d/00_header]Class[Service]File[/tmp/service.d]Class[Service]
=> nil
Thanks,
Nan
--
You received this message because you are subscribed to the Google Groups
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-dev?hl=en.