Return-Path: X-Original-To: apmail-brooklyn-dev-archive@minotaur.apache.org Delivered-To: apmail-brooklyn-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EC94A107E9 for ; Fri, 23 Jan 2015 08:43:04 +0000 (UTC) Received: (qmail 91967 invoked by uid 500); 23 Jan 2015 08:43:05 -0000 Delivered-To: apmail-brooklyn-dev-archive@brooklyn.apache.org Received: (qmail 91948 invoked by uid 500); 23 Jan 2015 08:43:05 -0000 Mailing-List: contact dev-help@brooklyn.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@brooklyn.incubator.apache.org Delivered-To: mailing list dev@brooklyn.incubator.apache.org Received: (qmail 91924 invoked by uid 99); 23 Jan 2015 08:43:04 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Jan 2015 08:43:04 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of alex.heneveld@cloudsoftcorp.com designates 74.125.82.43 as permitted sender) Received: from [74.125.82.43] (HELO mail-wg0-f43.google.com) (74.125.82.43) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Jan 2015 08:42:37 +0000 Received: by mail-wg0-f43.google.com with SMTP id y19so6178871wgg.2 for ; Fri, 23 Jan 2015 00:41:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloudsoftcorp.com; s=google; h=from:message-id:date:user-agent:mime-version:to:subject:references :in-reply-to:content-type; bh=K9j/iHPlhiAjHrETS4xMfPkXVar/55UPu8NG0nFiIfA=; b=BGChRVFtufCCeH43vToKJyYQvSqLvRlvwNujrBY4tE1IHjsASRb89DXViBW8DgP3a4 bc5HG4MJagh62pzZvMqZSR3Yx5pLCYlvVG4ObzzaZd06gFg7V0eJBCG0c1r/iqivwyJz xzmYoNNleXMdXE02Moq/sXblgOJ/32y1jLc44= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:user-agent:mime-version:to :subject:references:in-reply-to:content-type; bh=K9j/iHPlhiAjHrETS4xMfPkXVar/55UPu8NG0nFiIfA=; b=M1/89Lvp2GU5gHxiygZt4qqtVuMrwvuOHkKq3QmNefbYKMCQEA2V6bqxtnbWxRv2oF 5d5UUxeqX8r+iPAVi1lC8+eZSy9avjPi97m2q1GHsG0/gjOtQ/3PIjENj0I3gOqHP2pL neaD+hw7jNkXA+EMVFNoucpV4bo+vm26E8j1wThumf1jK0O1DVnlPzDSZ9uZI7tNmctT 95cg9w6kMaFHuCuWEzuR2OYliSJREKwY8BnWVojUEUFlNEKJUDr8JgB4kXR7Pkqj8sem FhIuEN/bq9KHOrNrSc4RCmy6FlSbr7Ls8G1B5zQ55z4XDn2r7HFOJ9ZdKi/s8/kOoH3E Q+yA== X-Gm-Message-State: ALoCoQlZZEsXuLa80YU9bPu9gcxraZsrEI0u8scf/RDwdJeaFJjvkFK2D4wpvOkJD0Gv2dtOKiDj X-Received: by 10.180.94.163 with SMTP id dd3mr1429799wib.82.1422002511432; Fri, 23 Jan 2015 00:41:51 -0800 (PST) Received: from almacretin.local (host86-138-188-39.range86-138.btcentralplus.com. [86.138.188.39]) by mx.google.com with ESMTPSA id u9sm1221785wjy.37.2015.01.23.00.41.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 Jan 2015 00:41:50 -0800 (PST) From: Alex Heneveld X-Google-Original-From: Alex Heneveld Message-ID: <54C2094D.3090706@CloudsoftCorp.com> Date: Fri, 23 Jan 2015 08:41:49 +0000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:24.0) Gecko/20100101 Thunderbird/24.1.1 MIME-Version: 1.0 To: dev@brooklyn.incubator.apache.org Subject: Re: "using variable later in postprovisionscript or any other script" References: <54C03EDC.2090807@CloudsoftCorp.com> <6C546423-0904-4A10-8574-1BFFA5D451A4@cloudsoftcorp.com> <54C187B5.2090106@CloudsoftCorp.com> In-Reply-To: Content-Type: multipart/alternative; boundary="------------050808010505060808030700" X-Virus-Checked: Checked by ClamAV on apache.org --------------050808010505060808030700 Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 7bit Hi Azhar, The ${config.myVarA} syntax is for Freemarker templates. It looks a lot like scripts -- both use the ${...} syntax -- but they are treated differently. Because Freemarker is evaluated in Brooklyn then sent to the box we have access to all config etc there. OTOH scripts are simply uploaded and evaluated and the only injection mechanism used is the `shell.env` map (because we don't want to send all config there). So in your shell you have to continue to use the ${myvar1} style. Best Alex On 22/01/2015 23:51, Azhar I Hashmi wrote: > > Thanks Alex, > > If i can refer to *${config.myvarA}* in my script then why would I > define *myvar1 *in*env.shell *other then what you described > *type-define *vs*non-type-defined *keys and their *scope. *Also*, > myvar1 or env.myvarA *are set as environment variables only for*that > session* during installation or can I access them later by logging > into the box? I tried to see the value of these variables as > predefined environment variables but I could not find them in *env* or > *printenv *on linux machine. > > So I can use alias like this*env.myvar1 *? Do not need > **prefix*config.* or *env.shell.* right in the script ? > > Thanks > Azhar > > > > Inactive hide details for Alex Heneveld ---01/22/2015 05:29:30 > PM---Azhar- What you propose I think could work. But I think itAlex > Heneveld ---01/22/2015 05:29:30 PM---Azhar- What you propose I think > could work. But I think it would also work and > > From: Alex Heneveld > To: dev@brooklyn.incubator.apache.org > Date: 01/22/2015 05:29 PM > Subject: Re: "using variable later in postprovisionscript or any other > script" > > ------------------------------------------------------------------------ > > > > > Azhar- > > What you propose I think could work. But I think it would also work and > be cleaner to split out your config, e.g. > > brooklyn.config: > myvarA: > $brooklyn:component("machine").attributeWhenReady("host.address") > shell.env: > myvar1: $brooklyn:config("myvarA") > > and then in templates refer to ${config.myvarA}. > > Only subtlety is that "myvarA" *must* be in `brooklyn.config` because it > is not a type-defined config key. `shell.env` could be put under > `brooklyn.config` or at the top level because it *is* a config key known > at the type. (It has a flag/alias "env" so you could also just call it > `env`.) > > HTH + thanks for the nice comments on the new docs! > > --A > > > On 22/01/2015 22:59, Azhar I Hashmi wrote: > > > > Thanks a lot Svet! > > > > Actually, I figured that there is files.runtime that I can use exactly > > as you described and also came to know env.shell after our call and I > > love the new documentation related to Entity's config, sensor etc..... > > > > Couple of questions: > > Instead of hard coding the path like this: I saw in the doc that there > > is a config to get to that path i.e. "*expandedinstall.dir". *Do you > > think I can use config variable to get that value? > > > > files.install: > > > > > "http://central.maven.org/maven2/org/apache/tomcat/tomcat-dbcp/7.0.30/tomcat-dbcp-7.0.30.jar": > > > apache-tomcat-7.0.56/lib/tomcat-dbcp-7.0.30.jar > > > > Can I do this for example: > > > > files.install: > > > > > "http://central.maven.org/maven2/org/apache/tomcat/tomcat-dbcp/7.0.30/tomcat-dbcp-7.0.30.jar": > > > *${expandedinstal.dir}*/lib/tomcat-dbcp-7.0.30.jar > > (OR) > > > > > "http://central.maven.org/maven2/org/apache/tomcat/tomcat-dbcp/7.0.30/tomcat-dbcp-7.0.30.jar": > > > *${config.expandedinstal.dir}*/lib/tomcat-dbcp-7.0.30.jar > > > > Also: > > > > > > According to the definition it takes a java map. So in your example: > > > > shell.env: > > myvar: > > $brooklyn:component("machine").attributeWhenReady("host.address") > > - type: brooklyn.entity.machine.MachineEntity > > id: machine > > I can have multiple vars like this: > > > > shell.env: > > *myvar1: > > $brooklyn:component("machine").attributeWhenReady("host.address")* > > * myvar2: > > $brooklyn:component("TOMCAT_ID").attributeWhenReady("host.address")* > > * myvar3: > > > $brooklyn:component("MY_SQLID").attributeWhenReady("host.subnet.address")* > > - type: brooklyn.entity.machine.MachineEntity > > > > > > Also, in my */tmp/script.sh* > > > > Can I do this *${config.shell.env.myvar1} , > > ${config.shell.env.myvar2},* and *${config.shell.env.myvar3}* to get > > their values that are set by brooklyn? Is my understanding correct? If > > not please correct me. > > > > > > Thanks a lot! > > > > Azhar --------------050808010505060808030700--