brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [1/2] brooklyn-docs git commit: Document shell.env json serialization behaviour.
Date Wed, 26 Oct 2016 06:13:09 GMT
Repository: brooklyn-docs
Updated Branches:
  refs/heads/master 14d2c3605 -> adf562c36


Document shell.env json serialization behaviour.


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/commit/3b33f177
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/tree/3b33f177
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/diff/3b33f177

Branch: refs/heads/master
Commit: 3b33f177f8a04f4f638cbef2a13780573a4ecaf4
Parents: eb98ffd
Author: Svetoslav Neykov <svetoslav.neykov@cloudsoftcorp.com>
Authored: Thu Jun 23 15:39:20 2016 +0300
Committer: Svetoslav Neykov <svetoslav.neykov@cloudsoftcorp.com>
Committed: Wed Oct 26 09:10:31 2016 +0300

----------------------------------------------------------------------
 guide/yaml/custom-entities.md                        | 12 ++++++++++++
 guide/yaml/example_yaml/vanilla-bash-netcat-env.yaml | 12 ++++++++++++
 2 files changed, 24 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-docs/blob/3b33f177/guide/yaml/custom-entities.md
----------------------------------------------------------------------
diff --git a/guide/yaml/custom-entities.md b/guide/yaml/custom-entities.md
index 9698aa8..7f58b68 100644
--- a/guide/yaml/custom-entities.md
+++ b/guide/yaml/custom-entities.md
@@ -82,6 +82,18 @@ to be specified up one level, alongside the type.
 However config keys which are *not* declared on the type *must* be declared in the `brooklyn.config`
block. 
 
 
+### Passing custom variables
+
+Blueprint scripts can be parametrised through environment variables, making them reusable
in different use-cases.
+Define the variables in the `env` block and then reference them using the standard bash notation:
+
+{% highlight yaml %}
+{% readj example_yaml/vanilla-bash-netcat-env.yaml %}
+{% endhighlight %}
+
+Non-string objects in the `env` map will be serialized to JSON before passing them to the
script.
+
+
 #### Declaring New Config Keys
 
 We can define config keys to be presented to the user 

http://git-wip-us.apache.org/repos/asf/brooklyn-docs/blob/3b33f177/guide/yaml/example_yaml/vanilla-bash-netcat-env.yaml
----------------------------------------------------------------------
diff --git a/guide/yaml/example_yaml/vanilla-bash-netcat-env.yaml b/guide/yaml/example_yaml/vanilla-bash-netcat-env.yaml
new file mode 100644
index 0000000..061d31b
--- /dev/null
+++ b/guide/yaml/example_yaml/vanilla-bash-netcat-env.yaml
@@ -0,0 +1,12 @@
+name: Netcat Example with Environment Vars
+location: localhost
+services:
+- type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess
+  name: Simple Netcat Server
+  launch.command: |
+    echo $MESSAGE | nc -l $NETCAT_PORT &
+    echo $! > $PID_FILE
+    
+  env:
+    MESSAGE: hello
+    NETCAT_PORT: 4321


Mime
View raw message