brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Azhar I Hashmi" <aihas...@us.ibm.com>
Subject Re: "using variable later in postprovisionscript or any other script"
Date Fri, 23 Jan 2015 01:39:26 GMT
Hi Stev,

I have a question related to the statement:

"* When passing formatString parameters to setup.script.vars you will get a
" Cannot coerce type class “ exception. It’s not supported currently."

Actually, I used formatString in following yaml and i did not get any
error.  However, I did not try to use these variables in my script later on
as a post.launch.command.

- type: brooklyn.entity.database.mysql.MySqlNode
  id: MySQLDB
  name: MySql DB
  location:
.......
.....

  brooklyn.config:
    datastore.creation.script.url: https://my.sql
    bssTomcatPrivateIP: $brooklyn:formatString("jdbc:%s/%s",
              component("TomcatServer").attributeWhenReady
("host.subnet.address"), "MY_DB")
    setup.script.vars:
        $brooklyn:formatString("TomcatPrivateIP:%s, TomcatPublicIP2:%s",
                                component
("TomcatServer").attributeWhenReady("host.subnet.address"),
                                component
("TomcatServer").attributeWhenReady("host.address"))
    provisioning.properties:
      minRam: 2048mb
      minCores: 2
      minDisk: 100gb

Out of curiosity, these setup.script,.var only for setup.script  value? In
other words, these setup script variables can ONLY be used in the script
that I pass in setup.script config?  If answer is NO i.e. these variables
can be used in any script like I can run a script in post.install.command
that can use these variables.

Can you please give me an example how would I use them in a script like:  $
{config.setup,scripts.var.TomcatPrivateIP}  and  $
{config.setup,scripts.var.TomcatPublicIP2} to get values? Or is there a
better way ?

Thanks
Azhar




From:	Svetoslav Neykov <svetoslav.neykov@cloudsoftcorp.com>
To:	dev@brooklyn.incubator.apache.org
Date:	01/22/2015 04:44 AM
Subject:	Re: "using variable later in postprovisionscript or any other
            script"



Hi Azhar,

I tried your blueprint and here’s what I found out:
1.
  * setup.script needs to be specified inside the location. I tried to pass
it inside the entity config, but it’s not picked up.
  * setup.script can be used only with jclouds locations. It’s doesn’t get
executed for localhost or byon.
  * When passing formatString parameters to setup.script.vars you will get
a " Cannot coerce type class “ exception. It’s not supported currently.
  * setup.script should only be used for system-wide configuration where
you don’t need dynamic parameters.
  * In your case it’s best to move all tomcat configuration from your
script into a custom server.conf template and pass it to the entity. To
access the entity config use ${config.MY_VARIABLE}.
  * If you really need to pass variables to a script then you can use one
of pre.install.command, post.install.command. The former will get executed
before any installation steps take place so if you need to execute a script
download it from a URL. The latter can use the files from files.install.
Both work with localhost and byon. Note that the values for those are bash
commands, not script URLs.
  * To pass parameters to the above use shell.env.

Mime
  • Unnamed multipart/related (inline, None, 0 bytes)
View raw message