ariatosca-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (ARIA-149) Support instrinsic functions in "dependencies" operation configuration
Date Tue, 23 May 2017 14:42:04 GMT

    [ https://issues.apache.org/jira/browse/ARIA-149?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16021272#comment-16021272
] 

ASF GitHub Bot commented on ARIA-149:
-------------------------------------

Github user ran-z commented on a diff in the pull request:

    https://github.com/apache/incubator-ariatosca/pull/138#discussion_r118011107
  
    --- Diff: aria/modeling/service_instance.py ---
    @@ -1728,34 +1732,41 @@ def operation_template(cls):
         def inputs(cls):
             return relationship.many_to_many(cls, 'parameter', prefix='inputs', dict_key='name')
     
    +    @declared_attr
    +    def configuration(cls):
    +        return relationship.many_to_many(cls, 'parameter', prefix='configuration', dict_key='name')
    +
    +    @declared_attr
    +    def arguments(cls):
    +        return relationship.many_to_many(cls, 'parameter', prefix='arguments', dict_key='name')
    +
         # endregion
     
         description = Column(Text)
         relationship_edge = Column(Boolean)
         implementation = Column(Text)
    -    configuration = Column(modeling_types.StrictDict(key_cls=basestring))
         dependencies = Column(modeling_types.StrictList(item_cls=basestring))
    +    function = Column(Text)
         executor = Column(Text)
         max_attempts = Column(Integer)
         retry_interval = Column(Integer)
     
         def configure(self):
    -        from . import models
    -        # Note: for workflows (operations attached directly to the service) "interface"
will be None
    -        if (self.implementation is None) or (self.interface is None):
    +        if (self.implementation is None) and (self.function is None):
                 return
     
    -        if self.plugin is None:
    -            arguments = execution_plugin.instantiation.configure_operation(self)
    +        if (self.plugin is None) and (self.interface is not None):
    +            # Default to execution plugin ("interface" is None for workflow operations)
    +            execution_plugin.instantiation.configure_operation(self)
             else:
                 # In the future plugins may be able to add their own "configure_operation"
hook that
    -            # can validate the configuration and otherwise return specially derived arguments
    -            arguments = self.configuration
    +            # can validate the configuration and otherwise create specially derived arguments.
For
    +            # now, we just send all configuration parameters as arguments
    +            utils.instantiate_dict(self, self.arguments, self.configuration)
     
    -        # Note: the arguments will *override* operation inputs of the same name
    -        if arguments:
    -            for k, v in arguments.iteritems():
    -                self.inputs[k] = models.Parameter.wrap(k, v)
    --- End diff --
    
    why remove this?


> Support instrinsic functions in "dependencies" operation configuration
> ----------------------------------------------------------------------
>
>                 Key: ARIA-149
>                 URL: https://issues.apache.org/jira/browse/ARIA-149
>             Project: AriaTosca
>          Issue Type: Story
>            Reporter: Tal Liron
>            Assignee: Tal Liron
>
> There are a few issues here. First, the following YAML is totally broken;
> {code}
>               dependencies:
>                 - ssh.address > { get_attribute: virtual_ip.floating_ip }
> {code}
> The problem is that in YAML, due to the location of the ":", this gets parsed as a dict
where the key is {code}ssh.address > { get_attribute{code} and the value is {code}virtual_ip.floating_ip
}{code} which is not what we want at all.
> The solution is to encase the whole value in quotes to enforce parsing as a string:
> {code}
>               dependencies:
>                 - "ssh.address > { get_attribute: virtual_ip.floating_ip }"
> {code}
> Note that the one attractive solution is to to change this ">" format to a real dict.
So:
> {code}
>               dependencies:
>                 - { ssh.address: { get_attribute: virtual_ip.floating_ip } }
> {code}
> But this will break other TOSCA parsers that expect a string here, so no go. :(



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message