ariatosca-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maxim Orlov <ma...@cloudify.co>
Subject Re: Inputs and Node object context for python and shell scripts
Date Tue, 25 Jul 2017 12:33:58 GMT
Indeed runtime_properties became attributes in ARIA . As for the behavior,
attributes behave just as a dict would (behind the scenes attributes
translate to a proper Attribute TOSCA model).
No need to define the attributes on the node-type level, if an attribute
with that name exists in on the model, the value of that attribute would be
overridden, if you are creating a whole new attribute, a proper Attribute
model would be created for you.

as for:

ctx.node.attributes['map']['key'] = 'value'

“map” is a name of an attribute which holds a dict, “key” is a key in that
dict.
​

On Tue, Jul 25, 2017 at 3:07 PM, D Jayachandran <d.jayachandran@ericsson.com
> wrote:

> Hi Max,
>
> I see the runtime_properties have been replaced with "attributes" and
> there has been multiple changes with respect to attribute handling.
>
> What do you refer by "map" in your below example, Is that a keyword ?
> "ctx.node.attributes['map']['key'] = value"
>
> Also with runtime_properties plugins were able to update the database with
> new key=value. Can we achieve the same with attributes ?
> Do we need to define the attributes in the node-types to be able to update
> them by the plugins ?
>
> Regards,
> DJ
>
> -----Original Message-----
> From: D Jayachandran [mailto:d.jayachandran@ericsson.com]
> Sent: Tuesday, July 25, 2017 11:23 AM
> To: dev@ariatosca.incubator.apache.org
> Subject: RE: Inputs and Node object context for python and shell scripts
>
> Hi Max,
>
> Yes I can access the context ctx with a python plugin and shell script as
> you have mentioned.
> But with python script .py files under implementation, am not sure if the
> ctx and inputs are passed as "globals". I will re-confirm this.
> The inputs which I was referring here were the lifecycle operation inputs.
>
>
> Regards,
> DJ
>
> -----Original Message-----
> From: Maxim Orlov [mailto:maxim@gigaspaces.com]
> Sent: Tuesday, July 25, 2017 12:14 AM
> To: dev@ariatosca.incubator.apache.org
> Subject: Re: Inputs and Node object context for python and shell scripts
>
> I'm not entirely sure to which inputs you are referring to, but any ctx
> attribute or method accessible from a python script is accessible form any
> shell script. For example:
>
>    - "ctx.node.attributes['map']['key']" (in python) is "ctx node
>    attributes map.key" (under bash)
>    - "ctx.node.attributes['map']['key'] = value" (in python) is "ctx node
>    attributes map.key value" (under bash)
>    - "ctx.logger.info('some message')" (in python) is "ctx logger info
>    'some message'" (under bash)
>
>
> On Mon, Jul 24, 2017 at 8:47 PM, Tal Liron <tal@gigaspaces.com> wrote:
>
> > I'm pretty sure you can access the inputs via the ctx call. Can anyone
> > confirm how to do this?
> >
> > We really need to document ctx usage...
> >
> > On Mon, Jul 24, 2017 at 5:57 AM, D Jayachandran <
> > d.jayachandran@ericsson.com
> > > wrote:
> >
> > > Hi,
> > >
> > > With current ARIA implementation, the python and shell scripts are
> > > being executed by the "execution plugin".
> > >
> > > The context object and inputs are not passed to passed to python
> scripts.
> > > We would like this to be passed to the python scripts.
> > > For shell scripts atleast the inputs needs to be passed. The context
> > > object can be accessed via client.py with the SOCKET URL.
> > > Kindly let us know if this can be added as a JIRA issue ?
> > >
> > >
> > > Regards,
> > > DJ
> > >
> > >
> > >
> > >
> >
>

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