Skip to content

Changing property name results in error when redeployed #250

@alexmaslenn

Description

@alexmaslenn

Description

After a service template deployed, a changing property name and deploying again can cause an error.

Steps

Consider having the following service template service.yaml:

tosca_definitions_version: tosca_simple_yaml_1_3

node_types:

  hello_type:
    derived_from: tosca.nodes.SoftwareComponent
    properties:
      test:
        type: string

topology_template:

  node_templates:

    my-workstation:
      type: tosca.nodes.Compute
      attributes:
        private_address: localhost
        public_address: localhost

    hello:
      type: hello_type
      properties:
        test: test
      requirements:
        - host: my-workstation

After successfully executing the deployment with opera deploy service.yaml try changing property name (e.g to test2) in both node type and node template.

Current behaviour

Execution of the command opera deploy service.yaml -c returns the following error:

Traceback (most recent call last):
  File "/test/xopera/.venv/bin/opera", line 8, in <module>
    sys.exit(main())
  File "/test/xopera/.venv/lib/python3.8/site-packages/opera/cli.py", line 61, in main
    return args.func(args)
  File "/test/xopera/.venv/lib/python3.8/site-packages/opera/commands/deploy.py", line 70, in _parser_callback
    status = info(None, storage)["status"]
  File "/test/xopera/.venv/lib/python3.8/site-packages/opera/commands/info.py", line 156, in info
    topology = template.instantiate(storage)
  File "/test/xopera/.venv/lib/python3.8/site-packages/opera/template/topology.py", line 46, in instantiate
    return Instance(storage, itertools.chain.from_iterable(node.instantiate() for node in self.nodes.values()))
  File "/test/xopera/.venv/lib/python3.8/site-packages/opera/instance/topology.py", line 14, in __init__
    node.read()
  File "/test/xopera/.venv/lib/python3.8/site-packages/opera/instance/base.py", line 41, in read
    self.load(self.topology.read(self.tosca_id))
  File "/test/xopera/.venv/lib/python3.8/site-packages/opera/instance/base.py", line 50, in load
    self.attributes[k].load(v)
KeyError: 'test

Deleting .opera directory resolves the error.

Expected behaviour

No error is returned and deployment is successful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    TOSCASomething that considers TOSCA standardbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions