Skip to content

Instantly share code, notes, and snippets.

@s0enke

s0enke/gist:7821956

Last active Dec 30, 2015
Embed
What would you like to do?
as puppet is declarative and the catalogue is a graph, we can just include the realization of virtual resources anywhere in code. even at the stage where the virtual resource gets declared
# this leads to the realization of both declared resources:
# soenke♥kellerautomat:~/projects/playground (master)$ puppet apply manifests/init.pp
# virtual resource 2
# /Stage[main]/Some_module/Virtual_resource_declarer2[virtual resource 2]/Virtual_resource[virtual resource 2]/Notify[virtual resource 2]/message: defined 'message' as 'virtual resource 2'
# virtual resource 1
# /Stage[main]/Some_module/Virtual_resource_declarer1[virtual resource 1]/Virtual_resource[virtual resource 1]/Notify[virtual resource 1]/message: defined 'message' as 'virtual resource 1'
# Finished catalog run in 0.61 seconds
node default {
include some_module
}
class some_module {
virtual_resource_declarer1 { 'virtual resource 1' : }
virtual_resource_declarer2 { 'virtual resource 2' : }
}
define virtual_resource_declarer1() {
include realizor
@virtual_resource { $name : }
}
define virtual_resource_declarer2() {
include realizor
@virtual_resource { $name : }
}
class realizor {
Virtual_Resource <| |>
}
define virtual_resource() {
notify { $name : }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment