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

Changing property name results in error when redeployed #250

Open
alexmaslenn opened this issue Feb 14, 2022 · 1 comment
Open

Changing property name results in error when redeployed #250

alexmaslenn opened this issue Feb 14, 2022 · 1 comment
Labels
bug Something isn't working TOSCA Something that considers TOSCA standard

Comments

@alexmaslenn
Copy link
Contributor

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.

@alexmaslenn alexmaslenn added bug Something isn't working TOSCA Something that considers TOSCA standard labels Feb 14, 2022
@anzoman
Copy link
Contributor

anzoman commented Feb 15, 2022

@alexmaslenn thanks for finding this!

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

No branches or pull requests

2 participants