Created
August 2, 2016 15:57
-
-
Save mikezaccardo/867efdd13fc07d35b0a28650d38fa731 to your computer and use it in GitHub Desktop.
Example of `attributeWhenReady` in YAML Blueprint
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
name: "Attribute When Ready Example" | |
location: <add-location-here> | |
services: | |
- type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess | |
id: item-A | |
name: A | |
launch.command: | | |
echo $(date) | |
echo "A: sleeping for 10 seconds" | |
sleep 10 | |
echo hello | nc -l 4321 & | |
echo $! > $PID_FILE | |
echo "A: launch.command executed" | |
env: { CHECK_MARKER: "checkRunning", STOP_MARKER: "stop" } | |
checkRunning.command: echo $CHECK_MARKER >> DATE && test -f "$PID_FILE" && ps -p `cat $PID_FILE` >/dev/null | |
stop.command: echo $STOP_MARKER >> DATE && test -f "$PID_FILE" && { kill -9 `cat $PID_FILE`; rm /tmp/vanilla.pid; } | |
- type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess | |
id: item-B | |
name: B | |
brooklyn.config: | |
launch.latch: $brooklyn:component("item-A").attributeWhenReady("service.isUp") | |
launch.command: | | |
echo $(date) | |
echo hello | nc -l 4322 & | |
echo $! > $PID_FILE | |
echo "B: launch.command executed" | |
env: { CHECK_MARKER: "checkRunning", STOP_MARKER: "stop" } | |
checkRunning.command: echo $CHECK_MARKER >> DATE && test -f "$PID_FILE" && ps -p `cat $PID_FILE` >/dev/null | |
stop.command: echo $STOP_MARKER >> DATE && test -f "$PID_FILE" && { kill -9 `cat $PID_FILE`; rm /tmp/vanilla.pid; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment