Never mind, figured it out from the code.  Here's the simplified template:

tosca_definitions_version: tosca_simple_yaml_1_0


imports:
  - aria-1.0

dsl_definitions:
  openstack_config: &openstack_config
    username: dewayne

data_types:
  config:
    properties:
      username:
        type: string
        default: 'NOT SET'

relationship_types:
  subnet_connected_to_router:
    derived_from: ConnectsTo
    interfaces:
      Configure:
        add_target:
          implementation: connect.sh
          inputs:
              openstack_config:
                type: config
                required: true
                default: {}

node_types:
  router:
    derived_from: tosca.nodes.Root

  subnet:
    derived_from: tosca.nodes.Root
    requirements:
      - router:
          capability: tosca.capabilities.Node
          node: router
          relationship: subnet_connected_to_router

topology_template:

  node_templates:

    router:
      type: router

    subnet:
      type: subnet
      requirements:
        - router:
            node: router
            relationship:
              type: subnet_connected_to_router
              interfaces:
                Configure:
                  add_target:
                    inputs:
                      openstack_config: *openstack_config


There is a script in the same directory referred to "connect.sh":

#!/bin/sh

ctx logger info "HERE $openstack_config"


When "install" is run, the output of the log statement is "NOT SET" (the
default).  Even though I have overridden it (should be "dewayne").



On Fri, Aug 25, 2017 at 3:06 PM, DeWayne Filppi <[email protected]> wrote:

> For the simplified example I need to provide a shell script or python
> script that dumps the inputs passed to the operation impl.  Not sure how
> that's done in ARIA.  IOW, I don't know how to refer to inputs, and don't
> see any example.
>
> On Fri, Aug 25, 2017 at 2:17 PM, Tal Liron <[email protected]> wrote:
>
>> That you supply where? Override where? What is the error? Sorry DeWayne,
>> very hard for me to follow your explanation. We really need a complete
>> simple example here and the exact errors that you get.
>>
>> On Fri, Aug 25, 2017 at 4:06 PM, DeWayne Filppi <[email protected]>
>> wrote:
>>
>> > Yes, in my case the relationship bewteen the subnet and router
>> (add_target)
>> > is executed properly.   The problem is that the "openstack_config" input
>> > that I supply is not passed as an input.  When I run 'aria service show
>> > -f', it is clear that my override is ignore and default (all empty
>> strings)
>> > is used.
>> >
>> > On Fri, Aug 25, 2017 at 2:02 PM, Tal Liron <[email protected]> wrote:
>> >
>> > > Is my attempt not what you meant? Was your error different?
>> > >
>> > > On Fri, Aug 25, 2017 at 4:01 PM, DeWayne Filppi <[email protected]>
>> > > wrote:
>> > >
>> > > > OK.  You want something not tied to Openstack, probably with just
>> two
>> > > > nodes.  Will do.
>> > > >
>> > > > On Fri, Aug 25, 2017 at 1:55 PM, Tal Liron <[email protected]> wrote:
>> > > >
>> > > > > DeWayne, this is still not very minimal, and I don't understand
>> what
>> > > > "dies"
>> > > > > means. Could you please provide the error?
>> > > > >
>> > > > > Here's my stab at a minimal example, please let me know if it's
>> what
>> > > you
>> > > > > got:
>> > > > >
>> > > > > tosca_definitions_version: tosca_simple_yaml_1_0
>> > > > >
>> > > > > relationship_types:
>> > > > >
>> > > > >   MyRelationship:
>> > > > >     interfaces:
>> > > > >       Configure:
>> > > > >         add_target:
>> > > > >           inputs:
>> > > > >             my_input:
>> > > > >               type: string
>> > > > >
>> > > > > node_types:
>> > > > >
>> > > > >   MyNode:
>> > > > >     requirements:
>> > > > >       - my_requirement:
>> > > > >           capability: tosca.capabilities.Container
>> > > > >           relationship: MyRelationship
>> > > > >
>> > > > > topology_template:
>> > > > >
>> > > > >   node_templates:
>> > > > >     my_node:
>> > > > >       type: MyNode
>> > > > >       requirements:
>> > > > >         - my_requirement:
>> > > > >             relationship:
>> > > > >               interfaces:
>> > > > >                 Configure:
>> > > > >                   add_target:
>> > > > >                     inputs:
>> > > > >                       my_input: test
>> > > > >
>> > > > > The above gave me this exception:
>> > > > >
>> > > > > AttributeError: 'NoneType' object has no attribute '_name'
>> > > > >   File "/home/emblemparade/ariatosca/aria/parser/consumption/
>> > > > consumer.py",
>> > > > > line 73, in consume
>> > > > >     consumer.consume()
>> > > > >   File "/home/emblemparade/ariatosca/aria/parser/consumption/
>> > > > modeling.py",
>> > > > > line 36, in consume
>> > > > >     self.context.presentation.presenter._get_model(self.context)
>> > > > >   File "/home/emblemparade/ariatosca/aria/utils/caching.py", line
>> > 84,
>> > > in
>> > > > > __call__
>> > > > >     return_value = self.func(*args, **kwargs)
>> > > > >   File
>> > > > > "/home/emblemparade/ariatosca/extensions/aria_extension_
>> > > > > tosca/simple_v1_0/presenter.py",
>> > > > > line 82, in _get_model
>> > > > >     return create_service_template_model(context)
>> > > > >   File
>> > > > > "/home/emblemparade/ariatosca/extensions/aria_extension_
>> > > > > tosca/simple_v1_0/modeling/__init__.py",
>> > > > > line 123, in create_service_template_model
>> > > > >     fix_node_template_model(context, model, node_template)
>> > > > >   File
>> > > > > "/home/emblemparade/ariatosca/extensions/aria_extension_
>> > > > > tosca/simple_v1_0/modeling/__init__.py",
>> > > > > line 209, in fix_node_template_model
>> > > > >     requirement))
>> > > > >   File
>> > > > > "/home/emblemparade/ariatosca/extensions/aria_extension_
>> > > > > tosca/simple_v1_0/modeling/__init__.py",
>> > > > > line 293, in create_requirement_template_model
>> > > > >     create_relationship_template_model(context, service_template,
>> > > > > relationship)
>> > > > >   File
>> > > > > "/home/emblemparade/ariatosca/extensions/aria_extension_
>> > > > > tosca/simple_v1_0/modeling/__init__.py",
>> > > > > line 318, in create_relationship_template_model
>> > > > >     relationship.interfaces)
>> > > > >   File
>> > > > > "/home/emblemparade/ariatosca/extensions/aria_extension_
>> > > > > tosca/simple_v1_0/modeling/__init__.py",
>> > > > > line 621, in create_interface_template_models
>> > > > >     interface = create_interface_template_model(context,
>> > > > service_template,
>> > > > > interface)
>> > > > >   File
>> > > > > "/home/emblemparade/ariatosca/extensions/aria_extension_
>> > > > > tosca/simple_v1_0/modeling/__init__.py",
>> > > > > line 354, in create_interface_template_model
>> > > > >     interface_type =
>> > > > > service_template.interface_types.get_descendant(
>> > interface_type._name)
>> > > > > Validation issues:
>> > > > >   0: 'NoneType' object has no attribute '_name'
>> > > > >      AttributeError: 'NoneType' object has no attribute '_name'
>> > > > >
>> > > > >
>> > > > > On Fri, Aug 25, 2017 at 3:28 PM, DeWayne Filppi <
>> [email protected]
>> > >
>> > > > > wrote:
>> > > > >
>> > > > > > tosca_definitions_version: tosca_simple_yaml_1_0
>> > > > > >
>> > > > > > imports:
>> > > > > >   -
>> > > > > > https://raw.githubusercontent.com/cloudify-cosmo/aria-
>> > > > > > extension-cloudify/master/plugins/openstack/plugin.yaml
>> > > > > >   - aria-1.0
>> > > > > >
>> > > > > > dsl_definitions:
>> > > > > >   openstack_config: &openstack_config
>> > > > > >     username:
>> > > > > >     password:
>> > > > > >     tenant_name:
>> > > > > >     auth_url:
>> > > > > >
>> > > > > > topology_template:
>> > > > > >
>> > > > > >   node_templates:
>> > > > > >
>> > > > > >     router:
>> > > > > >       type: aria.openstack.nodes.Router
>> > > > > >       properties:
>> > > > > >         external_network: gateway_net
>> > > > > >         create_if_missing: true
>> > > > > >         resource_id: aria_helloworld_rtr
>> > > > > >       interfaces:
>> > > > > >         Standard:
>> > > > > >           create:
>> > > > > >             inputs:
>> > > > > >               openstack_config: *openstack_config
>> > > > > >
>> > > > > >     network:
>> > > > > >       type: aria.openstack.nodes.Network
>> > > > > >       properties:
>> > > > > >         resource_id: aria_helloworld_network
>> > > > > >         create_if_missing: true
>> > > > > >       interfaces:
>> > > > > >         Standard:
>> > > > > >           create:
>> > > > > >             inputs:
>> > > > > >               openstack_config: *openstack_config
>> > > > > >
>> > > > > >     subnet:
>> > > > > >       type: aria.openstack.nodes.Subnet
>> > > > > >       properties:
>> > > > > >         resource_id: aria_helloworld_subnet
>> > > > > >         create_if_missing: true
>> > > > > >       interfaces:
>> > > > > >         Standard:
>> > > > > >           create:
>> > > > > >             inputs:
>> > > > > >               openstack_config: *openstack_config
>> > > > > >       requirements:
>> > > > > >         - router:
>> > > > > >             node: router
>> > > > > >             relationship:
>> > > > > >               type: aria.openstack.subnet_connected_to_router
>> > > > > >               interfaces:
>> > > > > >                 Configure:
>> > > > > >                   add_target:
>> > > > > >                     inputs:
>> > > > > >                       openstack_config: *openstack_config
>> > > > > >         - network: network
>> > > > > >
>> > > > > > Dies in add_target of subnet_connected_to_router because default
>> > > > (empty)
>> > > > > > openstack_config input being used rather than the override.  I
>> > didn't
>> > > > put
>> > > > > > the "implementation" line in because doing so has no effect.
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > > On Fri, Aug 25, 2017 at 1:03 PM, Tal Liron <[email protected]>
>> > wrote:
>> > > > > >
>> > > > > > > Could you create a minimal YAML file that demonstrates this
>> > problem
>> > > > so
>> > > > > we
>> > > > > > > can reproduce it? It could be a bug.
>> > > > > > >
>> > > > > > > On Fri, Aug 25, 2017 at 2:48 PM, DeWayne Filppi <
>> > > [email protected]
>> > > > >
>> > > > > > > wrote:
>> > > > > > >
>> > > > > > > > I don't know if this is a clue or not, but I modified the
>> > > > > > > > relationship:  aria.openstack.subnet_connected_to_router,
>> in
>> > the
>> > > > > aria
>> > > > > > > > openstack plugin.yaml to require the 'openstack_config'
>> input
>> > for
>> > > > the
>> > > > > > > > Configure.add_target operation (and got rid of the default).
>> > > > > > Afterwards,
>> > > > > > > > any attempt to validate this:
>> > > > > > > >
>> > > > > > > >     subnet:
>> > > > > > > >       type: aria.openstack.nodes.Subnet
>> > > > > > > >       properties:
>> > > > > > > >         resource_id: aria_helloworld_subnet
>> > > > > > > >         create_if_missing: true
>> > > > > > > >       interfaces:
>> > > > > > > >         Standard:
>> > > > > > > >           create:
>> > > > > > > >             inputs:
>> > > > > > > >               openstack_config: { get_input:
>> openstack_config }
>> > > > > > > >       requirements:
>> > > > > > > >         - router:
>> > > > > > > >             node: router
>> > > > > > > >             relationship:
>> > > > > > > >               type: aria.openstack.subnet_connecte
>> d_to_router
>> > > > > > > >               interfaces:
>> > > > > > > >                 Configure:
>> > > > > > > >                   add_target:
>> > > > > > > >                     inputs:
>> > > > > > > >                       openstack_config: { get_input:
>> > > > > openstack_config }
>> > > > > > > >
>> > > > > > > > Fails with the error : Validation issues:
>> > > > > > > >   4: interface definition "Configure" does not assign a
>> value
>> > to
>> > > a
>> > > > > > > required
>> > > > > > > > operation input "add_target.openstack_config" in
>> "relationship"
>> > > > > > > >
>> > > > > > > > Which is further confirmation that the input isn't seen, and
>> > > > normally
>> > > > > > the
>> > > > > > > > default gets used (empty strings).  I don't see examples
>> > anywhere
>> > > > > that
>> > > > > > > show
>> > > > > > > > how to properly override the interface inside a relationship
>> > > > inside a
>> > > > > > > > requirement.
>> > > > > > > >
>> > > > > > > >
>> > > > > > > > On Fri, Aug 25, 2017 at 10:57 AM, Tal Liron <
>> [email protected]>
>> > > > wrote:
>> > > > > > > >
>> > > > > > > > > "implementation" is a required field in the TOSCA spec, so
>> > you
>> > > > must
>> > > > > > > > specify
>> > > > > > > > > it even if it is the same.
>> > > > > > > > >
>> > > > > > > > > On Fri, Aug 25, 2017 at 12:47 PM, DeWayne Filppi <
>> > > > > > [email protected]>
>> > > > > > > > > wrote:
>> > > > > > > > >
>> > > > > > > > > > It appears that this issue *was* fixed by repeating the
>> > > > > > > implementation
>> > > > > > > > > key
>> > > > > > > > > > in the add_target block.  Intuitively, I would expect
>> that
>> > > > > fields I
>> > > > > > > > > didn't
>> > > > > > > > > > override would be untouched, but apparently not.
>> > > > > > > > > >
>> > > > > > > > > > On Thu, Aug 24, 2017 at 4:59 PM, Tal Liron <
>> > [email protected]>
>> > > > > > wrote:
>> > > > > > > > > >
>> > > > > > > > > > > Did you read the wiki? ARIA will send those specially
>> > > > formatted
>> > > > > > > > > > > dependencies as arguments to the @operation function.
>> > > > > > > > > > >
>> > > > > > > > > > > It would help to see your complete example, as I don't
>> > know
>> > > > > what
>> > > > > > > > you're
>> > > > > > > > > > > doing and not doing anymore. Could you throw it into a
>> > > GitHub
>> > > > > > repo
>> > > > > > > > > > perhaps?
>> > > > > > > > > > >
>> > > > > > > > > > > On Thu, Aug 24, 2017 at 6:53 PM, DeWayne Filppi <
>> > > > > > > [email protected]
>> > > > > > > > >
>> > > > > > > > > > > wrote:
>> > > > > > > > > > >
>> > > > > > > > > > > > 'dependencies' is a child of implementation in the
>> > spec.
>> > > >  I
>> > > > > > > don't
>> > > > > > > > > > think
>> > > > > > > > > > > > it's going to do anything for me anyway.  I just
>> want
>> > to
>> > > > pass
>> > > > > > > > > > > > openstack_config to the add_target operation as
>> inputs.
>> > > > > > > > > > > >
>> > > > > > > > > > > > On Thu, Aug 24, 2017 at 4:28 PM, Tal Liron <
>> > > > [email protected]>
>> > > > > > > > wrote:
>> > > > > > > > > > > >
>> > > > > > > > > > > > > What is the error?
>> > > > > > > > > > > > >
>> > > > > > > > > > > > > On Thu, Aug 24, 2017 at 6:22 PM, DeWayne Filppi <
>> > > > > > > > > [email protected]
>> > > > > > > > > > >
>> > > > > > > > > > > > > wrote:
>> > > > > > > > > > > > >
>> > > > > > > > > > > > > > actually "dependencies" fails validation.
>> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > On Thu, Aug 24, 2017 at 4:08 PM, Tal Liron <
>> > > > > > [email protected]>
>> > > > > > > > > > wrote:
>> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > > Oops, sorry, this is the syntax:
>> > > > > > > > > > > > > > >
>> > > > > > > > > > > > > > > interfaces:
>> > > > > > > > > > > > > > >   Configure:
>> > > > > > > > > > > > > > >     add_target:
>> > > > > > > > > > > > > > >       primary: my_script.sh
>> > > > > > > > > > > > > > >       dependencies:
>> > > > > > > > > > > > > > >         - "openstack_config > { get_input:
>> > > > > > openstack_config
>> > > > > > > > }"
>> > > > > > > > > > > > > > >
>> > > > > > > > > > > > > > > On Thu, Aug 24, 2017 at 6:00 PM, Tal Liron <
>> > > > > > > [email protected]>
>> > > > > > > > > > > wrote:
>> > > > > > > > > > > > > > >
>> > > > > > > > > > > > > > > > A few syntax problems:
>> > > > > > > > > > > > > > > >
>> > > > > > > > > > > > > > > > 1. It looks like you don't have any
>> operation
>> > > > > > > > implementation,
>> > > > > > > > > > > which
>> > > > > > > > > > > > > is
>> > > > > > > > > > > > > > a
>> > > > > > > > > > > > > > > > required field. (What do you expect the
>> inputs
>> > to
>> > > > be
>> > > > > > sent
>> > > > > > > > > to?)
>> > > > > > > > > > > > > > > > 2. Also, you are not naming the input. It
>> > should
>> > > be
>> > > > > > > > "inputs:
>> > > > > > > > > {
>> > > > > > > > > > > > > > > > my_input_name: { get_input:
>> openstack_config }
>> > }"
>> > > > > > > > > > > > > > > > 3. But #2 won't work because you can't just
>> add
>> > > > > inputs
>> > > > > > in
>> > > > > > > > > this
>> > > > > > > > > > > > case,
>> > > > > > > > > > > > > > > > because they are not declared at the
>> interface
>> > > > type.
>> > > > > > > > > > > > > > > >
>> > > > > > > > > > > > > > > > Assuming you do have an implementation, you
>> > could
>> > > > you
>> > > > > > try
>> > > > > > > > > > passing
>> > > > > > > > > > > > it
>> > > > > > > > > > > > > > > using
>> > > > > > > > > > > > > > > > execution configuration:
>> > > > > > > > > > > > > > > >
>> > > > > > > > > > > > > > > > https://cwiki.apache.org/
>> > > > > confluence/display/ARIATOSCA/
>> > > > > > > > > > > > > > > > Execution+Configuration
>> > > > > > > > > > > > > > > >
>> > > > > > > > > > > > > > > > Try something like this:
>> > > > > > > > > > > > > > > >
>> > > > > > > > > > > > > > > > interfaces:
>> > > > > > > > > > > > > > > >   Configure:
>> > > > > > > > > > > > > > > >     add_target:
>> > > > > > > > > > > > > > > >       primary: my_script.sh
>> > > > > > > > > > > > > > > >       dependencies:
>> > > > > > > > > > > > > > > >         - openstack_config: { get_input:
>> > > > > > > openstack_config }
>> > > > > > > > > > > > > > > >
>> > > > > > > > > > > > > > > > On Thu, Aug 24, 2017 at 5:49 PM, DeWayne
>> > Filppi <
>> > > > > > > > > > > > [email protected]
>> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > > > wrote:
>> > > > > > > > > > > > > > > >
>> > > > > > > > > > > > > > > >> In the ARIA usage of the plugin, I need to
>> > pass
>> > > > > > > > > > openstack_config
>> > > > > > > > > > > > > > > >> explicitly
>> > > > > > > > > > > > > > > >> to every operation.  Since the
>> relationships
>> > are
>> > > > > > > implicit,
>> > > > > > > > > how
>> > > > > > > > > > > do
>> > > > > > > > > > > > I
>> > > > > > > > > > > > > > > >> accomplish this?  Currently I get errors
>> when
>> > > > trying
>> > > > > > to
>> > > > > > > > > > connect
>> > > > > > > > > > > a
>> > > > > > > > > > > > > > subnet
>> > > > > > > > > > > > > > > >> to
>> > > > > > > > > > > > > > > >> a router.   I've tried overriding the
>> > > relationship
>> > > > > > like
>> > > > > > > > so:
>> > > > > > > > > > > > > > > >>
>> > > > > > > > > > > > > > > >>     subnet:
>> > > > > > > > > > > > > > > >>       type: aria.openstack.nodes.Subnet
>> > > > > > > > > > > > > > > >>       properties:
>> > > > > > > > > > > > > > > >>         resource_id: aria_helloworld_subnet
>> > > > > > > > > > > > > > > >>         create_if_missing: true
>> > > > > > > > > > > > > > > >>       interfaces:
>> > > > > > > > > > > > > > > >>         Standard:
>> > > > > > > > > > > > > > > >>           create:
>> > > > > > > > > > > > > > > >>             inputs:
>> > > > > > > > > > > > > > > >>               openstack_config: {
>> get_input:
>> > > > > > > > > openstack_config
>> > > > > > > > > > }
>> > > > > > > > > > > > > > > >>       requirements:
>> > > > > > > > > > > > > > > >>         - router:
>> > > > > > > > > > > > > > > >>             node: router
>> > > > > > > > > > > > > > > >>             relationship:
>> > > > > > > > > > > > > > > >>               type: aria.openstack.subnet_
>> > > > > > > > > connected_to_router
>> > > > > > > > > > > > > > > >>               interfaces:
>> > > > > > > > > > > > > > > >>                 Configure:
>> > > > > > > > > > > > > > > >>                   add_target:
>> > > > > > > > > > > > > > > >>                     inputs: { get_input:
>> > > > > > > openstack_config
>> > > > > > > > }
>> > > > > > > > > > > > > > > >>         - network: network
>> > > > > > > > > > > > > > > >>
>> > > > > > > > > > > > > > > >> Note the router requirement.  Does this
>> syntax
>> > > > look
>> > > > > > > > correct?
>> > > > > > > > > > > > > Spoiler:
>> > > > > > > > > > > > > > > >> openstack_config never makes it to the
>> plugin.
>> > > > > > > > > > > > > > > >>
>> > > > > > > > > > > > > > > >> DeWayne
>> > > > > > > > > > > > > > > >>
>> > > > > > > > > > > > > > > >
>> > > > > > > > > > > > > > > >
>> > > > > > > > > > > > > > >
>> > > > > > > > > > > > > >
>> > > > > > > > > > > > >
>> > > > > > > > > > > >
>> > > > > > > > > > >
>> > > > > > > > > >
>> > > > > > > > >
>> > > > > > > >
>> > > > > > >
>> > > > > >
>> > > > >
>> > > >
>> > >
>> >
>>
>
>

Reply via email to