Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attach playbook to Compute node without defining a new type #237

Closed
abitrolly opened this issue Jan 24, 2022 · 12 comments · Fixed by #249
Closed

Attach playbook to Compute node without defining a new type #237

abitrolly opened this issue Jan 24, 2022 · 12 comments · Fixed by #249
Labels
bug Something isn't working TOSCA Something that considers TOSCA standard

Comments

@abitrolly
Copy link

abitrolly commented Jan 24, 2022

Is it possible to execute playbook when tosca.nodes.Compute node template is deployed, without defining a new type?

Using modified example from https://docs.oasis-open.org/tosca/TOSCA-Simple-Profile-YAML/v1.3/os/TOSCA-Simple-Profile-YAML-v1.3-os.html#_Toc26969423

tosca_definitions_version: tosca_simple_yaml_1_3

topology_template:
  node_templates:
    db_server:
      type: tosca.nodes.Compute
      interfaces:
        Standard:
          configure: scripts/my_own_configure.sh

opera validate errors out with this.

Validating service template...
mysql.yml:11:11: [InterfaceDefinitionForTemplate] Invalid keys: configure
@anzoman
Copy link
Contributor

anzoman commented Jan 27, 2022

Hi and thanks for asking this. So, as I can see from TOSCA's documentation a lot of examples are not complete and quite some of them use older TOSCA versions (e.g., 1.0).

I think that your example above is missing operations keyword for TOSCA interface you defined.

slika

You can probably try this:

tosca_definitions_version: tosca_simple_yaml_1_3

topology_template:
  node_templates:
    db_server:
      type: tosca.nodes.Compute
      interfaces:
        Standard:
          operations:
            configure: scripts/my_own_configure.sh

And also note that xOpera currently supports only Ansible for running interface operations and we have a plan for adding other executors (e.g., bash, python) in the future.

@anzoman anzoman added the TOSCA Something that considers TOSCA standard label Jan 27, 2022
@abitrolly
Copy link
Author

@anzoman are you sure that the example about interface definition can be applied here? Above this example, standard refers to sub-classing behavior, which I believe I am doing.

image

If this example is invalid, why nobody from consortia is interested in updating the invalid spec?

@abitrolly
Copy link
Author

Perhaps @lauwers can answer the last question.

@lauwers
Copy link

lauwers commented Jan 30, 2022

Hi Anatoli, the TOSCA TC is hard at work on TOSCA v2.0. We realize that some of the examples in the v1.3 specification have errors, but getting corrections approved through the OASIS standardization process is fairly cumbersome and we decided our efforts would be better spent by focusing on the quality of the v2.0 spec. As part of this process, we plan on managing all examples in the TOSCA git repo at https://github.com/oasis-open/tosca-community-contributions so they can be run through various parsers and validators. We have just started this effort. As you can imagine there is a fair bit of work involved and we welcome and encourage anyone to contribute and participate if possible, ideally by joining the TOSCA TC.
Thanks, Chris

@abitrolly
Copy link
Author

@lauwers thanks for the proposal. TOSCA TC list holds addresses from major IT company domains. It looks like both OASIS and TC members are all sponsored by one entity or another, and the thought of doing this job sacrificing my time for free feels very miserable. So unless there is some serious funding involved, I have to refuse.

@abitrolly
Copy link
Author

@anzoman this doesn't work.

tosca_definitions_version: tosca_simple_yaml_1_3

topology_template:
  node_templates:
    db_server:
      type: tosca.nodes.Compute
      interfaces:
        Standard:
          operations:
            configure: scripts/my_own_configure.sh

First is fails with this.

opera.error.ParseError: [Path] Path scripts/my_own_configure.sh does not exist.
[[Command exited with 1]]

And then the file is created, with this.

opera.error.ParseError: [NodeTemplate] Undeclared operations: configure.
[[Command exited with 1]]

@lauwers
Copy link

lauwers commented Feb 3, 2022 via email

@abitrolly
Copy link
Author

Thanks. So it is a bug in xOpera then.

@anzoman
Copy link
Contributor

anzoman commented Feb 9, 2022

Hi @abitrolly, I believe that you're looking at section 2.3 Overriding behavior of predefined node types and AFAIK you get the error because your db_server derives from tosca.nodes.Compute node type, which does not have any predefined interfaces that you could override and use them to run some operation.

The TOSCA Compute node represents one or more real or virtual processors of software applications or services along with other essential local resources. Collectively, the resources the compute node represents can logically be viewed as a (real or virtual) “server”.

If you want to run your scripts/my_own_configure.sh script you should probably derive from some other TOSCA type (e.g., tosca.nodes.Root, tosca.nodes.SoftwareComponent or create your DB server node such as tosca.nodes.DBMS.MySQL).

@abitrolly
Copy link
Author

abitrolly commented Feb 9, 2022

tosca.nodes.Compute derives from tosca.nodes.Root https://docs.oasis-open.org/tosca/TOSCA-Simple-Profile-YAML/v1.3/csprd01/TOSCA-Simple-Profile-YAML-v1.3-csprd01.html#DEFN_TYPE_NODES_ROOT which includes tosca.interfaces.node.lifecycle.Standard.

@lauwers
Copy link

lauwers commented Feb 9, 2022 via email

@anzoman
Copy link
Contributor

anzoman commented Feb 9, 2022

Oh, after some testing I see now that opera has a minor bug for this. I have located it already and will supply the PR that will fix this ASAP.

@anzoman anzoman added the bug Something isn't working label Feb 9, 2022
anzoman added a commit that referenced this issue Feb 11, 2022
In #237 we discovered that opera's parser doesn't take into account
interfaces from derived parental nodes if those were defined by
referencing some interface type (e.g., Standard or Configure). This
commit will fix this, so it will be possible to use all interfaces from
derived nodes.

The second fix includes optimizing checks for operation names for
pre-defined Standard and Configure interface types. Users are warned if
the those operations have wrong names within node types or node
templates.
anzoman added a commit that referenced this issue Feb 14, 2022
In #237 we discovered that opera's parser doesn't take into account
interfaces from derived parental nodes if those were defined by
referencing some interface type (e.g., Standard or Configure). This
commit will fix this, so it will be possible to use all interfaces from
derived nodes.

The second fix includes optimizing checks for operation names for
pre-defined Standard and Configure interface types. Users are warned if
the those operations have wrong names within node types or node
templates.

The third thing is that we also needed to update our TOSCA operation
class to print out execution output only when primary implementation
artifact is present.
anzoman added a commit that referenced this issue Feb 14, 2022
In #237 we discovered that opera's parser doesn't take into account
interfaces from derived parental nodes if those were defined by
referencing some interface type (e.g., Standard or Configure). This
commit will fix this, so it will be possible to use all interfaces from
derived nodes.

The second fix includes optimizing checks for operation names for
pre-defined Standard and Configure interface types. Users are warned if
the those operations have wrong names within node types or node
templates.

The third thing is that we also needed to update our TOSCA operation
class to print out execution output only when primary implementation
artifact is present.
anzoman added a commit that referenced this issue Feb 15, 2022
In #237 we discovered that opera's parser doesn't take into account
interfaces from derived parental nodes if those were defined by
referencing some interface type (e.g., Standard or Configure). This
commit will fix this, so it will be possible to use all interfaces from
derived nodes.

The second fix includes optimizing checks for operation names for
pre-defined Standard and Configure interface types. Users are warned if
the those operations have wrong names within node types or node
templates.

The third thing is that we also needed to update our TOSCA operation
class to print out execution output only when primary implementation
artifact is present.
alexmaslenn pushed a commit that referenced this issue Feb 15, 2022
In #237 we discovered that opera's parser doesn't take into account
interfaces from derived parental nodes if those were defined by
referencing some interface type (e.g., Standard or Configure). This
commit will fix this, so it will be possible to use all interfaces from
derived nodes.

The second fix includes optimizing checks for operation names for
pre-defined Standard and Configure interface types. Users are warned if
the those operations have wrong names within node types or node
templates.

The third thing is that we also needed to update our TOSCA operation
class to print out execution output only when primary implementation
artifact is present.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working TOSCA Something that considers TOSCA standard
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants