nedap/pypuppetdb — pull request #26 by juliushaertl (2014-01-29 09:40:22+00:00)
Title: Add Relationship to Resource

This commit allows to filter a Catalog for a specific Resource by
type and title and returns a Resource containing all linked Resources.

Here is a quick example:

>>> catalog = db.catalog('hostname')
>>> resource = catalog.get_resource('Service','ntp')
>>> for rel in resource.relationships:
>>> print(rel)
Class[Ntp] - contains - Service[ntp]
File[/etc/ntp.conf] - notifies - Service[ntp]
File[/etc/ntp.conf] - required-by - Service[ntp]

This could be useful when adding a kind of "catalog viewer" to puppetboard to inspect the catalog of a node.