This Puppet module contains a handful of parser functions that allow reflection of Puppet environment internals from the DSL.
environments() # => ["production", ...]
# Get all classes in the node's environment
environment_classes() # => ["puppet_enterprise", "apache" ...]
# Get all classes in a specific environment
environment_classes("foo") # => ["puppet_enterprise", ...]
# Get all modules in the node's environment
environment_modules() # => ["nginx", "ntp", ...]
# Get all modules in a specified environment
environment_modules("foo") # => ["nginx", ...]
This module is a work in progress. Feel free to contribute suggestions (in GH issues) or PRs.