Created
April 24, 2015 23:44
-
-
Save ypujante/7c9c1a74e77a9aeeb3e8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The glu script for the app (parent) | |
class AppGluScript | |
{ | |
def onConfigChanged = { config -> | |
log.info("From AppGluScript.onConfigChanged => ${config}") | |
} | |
// required for parent/child relationship | |
def createChild = { args -> | |
return args.script | |
} | |
// required for parent/child relationship | |
def destroyChild = { args -> | |
} | |
} | |
////////////////////////////////////////////////////// | |
// The config for the app (child of the AppGluScript) | |
class ConfigGluScript | |
{ | |
def configure = { | |
log.info("From ConfigGluScript.configure") | |
parent.onConfigChanged(params) | |
} | |
} | |
//////////////////////////////////////////// | |
// The test model (.json.groovy) | |
fabric = "glu-dev-1" | |
name = "Test Config (with parent/child)" | |
def appScript = "http://localhost:8080/glu/repository/scripts/test-app-config/AppGluScript.groovy" | |
def configScript = "http://localhost:8080/glu/repository/scripts/test-app-config/ConfigGluScript.groovy" | |
def agent = 'agent-1' | |
// app | |
entries << [ | |
agent: agent, | |
mountPoint: "/app/i001", | |
script: appScript, | |
] | |
// config for the app | |
entries << [ | |
agent: agent, | |
mountPoint: "/app-config/i001", | |
parent: "/app/i001", // tie to the parent | |
script: configScript, | |
initParameters: [ | |
p1: 'v1', | |
p2: 34, | |
] | |
] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment