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

'Node' object has no attribute 'find_host' in 0.7.0 #261

Open
milesstoetzner opened this issue Feb 12, 2023 · 0 comments
Open

'Node' object has no attribute 'find_host' in 0.7.0 #261

milesstoetzner opened this issue Feb 12, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@milesstoetzner
Copy link

milesstoetzner commented Feb 12, 2023

Description

Hey,

I am having trouble accessing properties of a host using opera version 0.7.0.
The scenario works fine using opera version 0.6.9.
I think this is related to #257, however, producing the error AttributeError: 'Node' object has no attribute 'find_host'.

Greetings
Miles

Steps

Here is a minimal service template that should be deployed.
The some_property of node_software accesses the another_property of its host.

# service-template.yaml
tosca_definitions_version: tosca_simple_yaml_1_3

node_types: 
  node.software: 
    derived_from: tosca.nodes.SoftwareComponent
    properties: 
      some_property: 
        type: string
        default: { get_property: [SELF, host, another_property]}   # THIS IS THE PROBLEM

  node.compute:
    derived_from: tosca.nodes.Root
    properties: 
      another_property:
        type: string
    capabilities:
      host:
        type: tosca.capabilities.Compute


topology_template: 
  node_templates: 
    node_software: 
      type: node.software
      requirements: 
        - host: node_compute

    node_compute:
      type: node.compute
      properties: 
        another_property: some_value

Current Behaviour (Version 0.7.0)

When using opera version 0.7.0 the following happens.

opera validate service-template.yaml works:

Validating TOSCA CSAR or service template...
Done.

opera validate -e service-template.yaml throws the error:

Validating TOSCA CSAR or service template...
[Worker_0]   Deploying node_compute_0
[Worker_0]   Deployment of node_compute_0 complete
[Worker_0]   Deploying node_software_0
Traceback (most recent call last):
  File "/home/stoetzms/opera-0.7.0/.venv/bin/opera", line 8, in <module>
    sys.exit(main())
  File "/home/stoetzms/opera-0.7.0/.venv/lib/python3.10/site-packages/opera/cli.py", line 61, in main
    return args.func(args)
  File "/home/stoetzms/opera-0.7.0/.venv/lib/python3.10/site-packages/opera/commands/deploy.py", line 130, in _parser_callback
    deploy_service_template(csar_or_st_path, inputs, storage,
  File "/home/stoetzms/opera-0.7.0/.venv/lib/python3.10/site-packages/opera/commands/deploy.py", line 165, in deploy_service_template
    topology.deploy(verbose_mode, workdir, num_workers)
  File "/home/stoetzms/opera-0.7.0/.venv/lib/python3.10/site-packages/opera/instance/topology.py", line 65, in deploy
    do_deploy = executor.wait_results()
  File "/home/stoetzms/opera-0.7.0/.venv/lib/python3.10/site-packages/opera/threading/node_executor.py", line 33, in wait_results
    errors = self.process_results(results)
  File "/home/stoetzms/opera-0.7.0/.venv/lib/python3.10/site-packages/opera/threading/node_executor.py", line 57, in process_results
    future.result()
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 451, in result
    return self.__get_result()
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
    raise self._exception
  File "/usr/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/stoetzms/opera-0.7.0/.venv/lib/python3.10/site-packages/opera/instance/node.py", line 124, in deploy
    self.run_operation(OperationHost.HOST, StandardInterfaceOperation.shorthand_name(),
  File "/home/stoetzms/opera-0.7.0/.venv/lib/python3.10/site-packages/opera/instance/base.py", line 86, in run_operation
    success, outputs, attributes = self.run(operation, host, verbose, workdir, validate)
  File "/home/stoetzms/opera-0.7.0/.venv/lib/python3.10/site-packages/opera/instance/base.py", line 123, in run
    actual_host = self.get_host(operation.host or host)
  File "/home/stoetzms/opera-0.7.0/.venv/lib/python3.10/site-packages/opera/instance/node.py", line 233, in get_host
    return self.find_host()
  File "/home/stoetzms/opera-0.7.0/.venv/lib/python3.10/site-packages/opera/instance/node.py", line 257, in find_host
    host = next((
  File "/home/stoetzms/opera-0.7.0/.venv/lib/python3.10/site-packages/opera/instance/node.py", line 258, in <genexpr>
    r.target.find_host()
AttributeError: 'Node' object has no attribute 'find_host'

opera deploy service-template.yaml throws the same error as previously:

[Worker_0]   Deploying node_compute_0
[Worker_0]   Deployment of node_compute_0 complete
[Worker_0]   Deploying node_software_0
Traceback (most recent call last):
  File "/home/stoetzms/opera-0.7.0/.venv/bin/opera", line 8, in <module>
    sys.exit(main())
  File "/home/stoetzms/opera-0.7.0/.venv/lib/python3.10/site-packages/opera/cli.py", line 61, in main
    return args.func(args)
  File "/home/stoetzms/opera-0.7.0/.venv/lib/python3.10/site-packages/opera/commands/deploy.py", line 130, in _parser_callback
    deploy_service_template(csar_or_st_path, inputs, storage,
  File "/home/stoetzms/opera-0.7.0/.venv/lib/python3.10/site-packages/opera/commands/deploy.py", line 165, in deploy_service_template
    topology.deploy(verbose_mode, workdir, num_workers)
  File "/home/stoetzms/opera-0.7.0/.venv/lib/python3.10/site-packages/opera/instance/topology.py", line 65, in deploy
    do_deploy = executor.wait_results()
  File "/home/stoetzms/opera-0.7.0/.venv/lib/python3.10/site-packages/opera/threading/node_executor.py", line 33, in wait_results
    errors = self.process_results(results)
  File "/home/stoetzms/opera-0.7.0/.venv/lib/python3.10/site-packages/opera/threading/node_executor.py", line 57, in process_results
    future.result()
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 451, in result
    return self.__get_result()
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
    raise self._exception
  File "/usr/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/stoetzms/opera-0.7.0/.venv/lib/python3.10/site-packages/opera/instance/node.py", line 124, in deploy
    self.run_operation(OperationHost.HOST, StandardInterfaceOperation.shorthand_name(),
  File "/home/stoetzms/opera-0.7.0/.venv/lib/python3.10/site-packages/opera/instance/base.py", line 86, in run_operation
    success, outputs, attributes = self.run(operation, host, verbose, workdir, validate)
  File "/home/stoetzms/opera-0.7.0/.venv/lib/python3.10/site-packages/opera/instance/base.py", line 123, in run
    actual_host = self.get_host(operation.host or host)
  File "/home/stoetzms/opera-0.7.0/.venv/lib/python3.10/site-packages/opera/instance/node.py", line 233, in get_host
    return self.find_host()
  File "/home/stoetzms/opera-0.7.0/.venv/lib/python3.10/site-packages/opera/instance/node.py", line 257, in find_host
    host = next((
  File "/home/stoetzms/opera-0.7.0/.venv/lib/python3.10/site-packages/opera/instance/node.py", line 258, in <genexpr>
    r.target.find_host()
AttributeError: 'Node' object has no attribute 'find_host'

Expected Behaviour (Version 0.6.9)

I would expect that this still works in 0.7.0.
When using opera 0.6.9 everything works as expected.

opera validate service-template.yaml works:

Validating TOSCA CSAR or service template...
Done.

opera validate -e service-template.yaml works:

Validating TOSCA CSAR or service template...
[Worker_0]   Validating node_software_0
[Worker_0]   Validation of node_software_0 complete
[Worker_0]   Validating node_compute_0
[Worker_0]   Validation of node_compute_0 complete
Done.

opera deploy service-template.yaml works:

[Worker_0]   Deploying node_software_0
[Worker_0]   Deployment of node_software_0 complete
@anzoman anzoman added the bug Something isn't working label Feb 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants