RedHatQE / teflo

Teflo is a standalone orchestration software that controls the flow of a set of testing scenarios, allowing users to provision machines, deploy software, execute tests against them and manage generated artifacts and report results.
https://teflo.readthedocs.io/en/latest/
GNU General Public License v3.0
14 stars 16 forks source link

Resources with same names will cause an error #182

Closed rujutashinde closed 2 years ago

rujutashinde commented 2 years ago

In teflo version 2.2.0 If the scenario has resources with same name, e.g. below

---

name: data_folder
description:

provision:
  - name: laptop
    groups: localhost
    ip_address: 127.0.0.1
    ansible_params:
      ansible_connection: local

  - name: laptop
    groups: localhost
    ip_address: 127.0.0.10
    ansible_params:
      ansible_connection: local

it will throw error like below


`21:33:28  Traceback (most recent call last):
21:33:28    File "/var/lib/jenkins/workspace/ocp-edge-auto-tests-teflo/ocp-edge-auto/ocp-edge-venv/lib/python3.6/site-packages/teflo/teflo.py", line 665, in notify
21:33:28      self.scenario_graph.remove_resources_from_scenario(scenario)
21:33:28    File "/var/lib/jenkins/workspace/ocp-edge-auto-tests-teflo/ocp-edge-auto/ocp-edge-venv/lib/python3.6/site-packages/teflo/utils/scenario_graph.py", line 387, in remove_resources_from_scenario
21:33:28      self._reports.remove(report)
21:33:28  ValueError: list.remove(x): x not in list
21:33:28  
21:33:28  During handling of the above exception, another exception occurred:
21:33:28  
21:33:28  Traceback (most recent call last):
21:33:28    File "/var/lib/jenkins/workspace/ocp-edge-auto-tests-teflo/ocp-edge-auto/ocp-edge-venv/bin/teflo", line 8, in <module>
21:33:28      sys.exit(teflo())
21:33:28    File "/var/lib/jenkins/workspace/ocp-edge-auto-tests-teflo/ocp-edge-auto/ocp-edge-venv/lib/python3.6/site-packages/click/core.py", line 829, in __call__
21:33:28      return self.main(*args, **kwargs)
21:33:28    File "/var/lib/jenkins/workspace/ocp-edge-auto-tests-teflo/ocp-edge-auto/ocp-edge-venv/lib/python3.6/site-packages/click/core.py", line 782, in main
21:33:28      rv = self.invoke(ctx)
21:33:28    File "/var/lib/jenkins/workspace/ocp-edge-auto-tests-teflo/ocp-edge-auto/ocp-edge-venv/lib/python3.6/site-packages/click/core.py", line 1259, in invoke
21:33:28      return _process_result(sub_ctx.command.invoke(sub_ctx))
21:33:28    File "/var/lib/jenkins/workspace/ocp-edge-auto-tests-teflo/ocp-edge-auto/ocp-edge-venv/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
21:33:28      return ctx.invoke(self.callback, **ctx.params)
21:33:28    File "/var/lib/jenkins/workspace/ocp-edge-auto-tests-teflo/ocp-edge-auto/ocp-edge-venv/lib/python3.6/site-packages/click/core.py", line 610, in invoke
21:33:28      return callback(*args, **kwargs)
21:33:28    File "/var/lib/jenkins/workspace/ocp-edge-auto-tests-teflo/ocp-edge-auto/ocp-edge-venv/lib/python3.6/site-packages/click/decorators.py", line 21, in new_func
21:33:28      return f(get_current_context(), *args, **kwargs)
21:33:28    File "/var/lib/jenkins/workspace/ocp-edge-auto-tests-teflo/ocp-edge-auto/ocp-edge-venv/lib/python3.6/site-packages/teflo/cli.py", line 297, in run
21:33:28      cbn.run(tasklist=task)
21:33:28    File "/var/lib/jenkins/workspace/ocp-edge-auto-tests-teflo/ocp-edge-auto/ocp-edge-venv/lib/python3.6/site-packages/teflo/teflo.py", line 426, in run
21:33:28      self.run_all_helper(tasklist, final_passed_tasks, final_failed_tasks, status)
21:33:28    File "/var/lib/jenkins/workspace/ocp-edge-auto-tests-teflo/ocp-edge-auto/ocp-edge-venv/lib/python3.6/site-packages/teflo/teflo.py", line 393, in run_all_helper
21:33:28      self.run_helper(sc=sc, tasklist=tasklist_run)
21:33:28    File "/var/lib/jenkins/workspace/ocp-edge-auto-tests-teflo/ocp-edge-auto/ocp-edge-venv/lib/python3.6/site-packages/teflo/teflo.py", line 517, in run_helper
21:33:28      self.notify('on_start', status, passed_tasks, failed_tasks, scenario=sc)
21:33:28    File "/var/lib/jenkins/workspace/ocp-edge-auto-tests-teflo/ocp-edge-auto/ocp-edge-venv/lib/python3.6/site-packages/teflo/teflo.py", line 672, in notify
21:33:28      self.scenario_graph.remove_resources_from_scenario(scenario)
21:33:28    File "/var/lib/jenkins/workspace/ocp-edge-auto-tests-teflo/ocp-edge-auto/ocp-edge-venv/lib/python3.6/site-packages/teflo/utils/scenario_graph.py", line 379, in remove_resources_from_scenario
21:33:28      self._assets.remove(asset)
21:33:28  ValueError: list.remove(x): x not in list`

This is causing due to the fix #173

The workaround is to not use resources with same name, OR use teflo 2.1 release.

The fix for this will be available in the next release in January 2022

anupama27 commented 2 years ago

Hi, I am using teflo 2.2 framework and still the same issue persists,please find the below log .

teflo run -t validate -s teflo/scenario.yml -d /var/lib/jenkins/workspace/rhgs-3.5-rhel-8-anramesh/.teflo -w . --log-level debug 2022-01-10 04:46:21,113 DEBUG [teflo.helpers.check_for_var_file:1346] Looking for .yml files as variable file under vars folder in the current workspace 2022-01-10 04:46:22,167 INFO [teflo.teflo._print_header:750]

2022-01-10 04:46:22,168 INFO [teflo.teflo._print_header:751] TEFLO RUN (START)
2022-01-10 04:46:22,168 INFO [teflo.teflo._print_header:752] ------------------------------------------------------------------------------- 2022-01-10 04:46:22,168 INFO [teflo.teflo._print_header:753] Data Folder : /var/lib/jenkins/workspace/rhgs-3.5-rhel-8-anramesh/.teflo/isvmc943yt 2022-01-10 04:46:22,169 INFO [teflo.teflo._print_header:754] Workspace : . 2022-01-10 04:46:22,169 INFO [teflo.teflo._print_header:755] Log Level : debug 2022-01-10 04:46:22,169 INFO [teflo.teflo._print_header:756] Tasks : ['validate'] 2022-01-10 04:46:22,170 INFO [teflo.teflo._print_header:757] Iterate Method : by_level 2022-01-10 04:46:22,170 INFO [teflo.teflo._print_header:759] Scenario : RHGS3.5_config 2022-01-10 04:46:22,171 INFO [teflo.teflo._print_header:759] Scenario : RHGS_3.5_exec 2022-01-10 04:46:22,171 INFO [teflo.teflo._print_header:759] Scenario : Red Hat Gluster Storage 3.5 on RHEL 2022-01-10 04:46:22,171 INFO [teflo.teflo._print_header:760] -------------------------------------------------------------------------------

2022-01-10 04:46:22,172 INFO [teflo.teflo.run_all_validate_helper:356] Validating against all scenarios! 2022-01-10 04:46:22,172 INFO [teflo.teflo.run_all_validate_helper:357] .................................................. 2022-01-10 04:46:22,172 INFO [teflo.teflo.run_all_validate_helper:361] .................................................. 2022-01-10 04:46:22,173 INFO [teflo.teflo.run_all_validate_helper:363] 'RHGS3.5_config' is validated from the scenario file: orchestrate.yml 2022-01-10 04:46:22,173 INFO [teflo.teflo.run_all_validate_helper:364] .................................................. 2022-01-10 04:46:22,174 INFO [teflo.teflo.run_helper:510] .................................................. 2022-01-10 04:46:22,174 INFO [teflo.teflo.run_helper:512] 'RHGS3.5_config' is running from the scenario file: orchestrate.yml 2022-01-10 04:46:22,175 INFO [teflo.teflo.run_helper:513] .................................................. 2022-01-10 04:46:22,175 INFO [teflo.teflo.notify:618] Sending out any notifications that are registered. 2022-01-10 04:46:22,177 INFO [teflo.teflo._run_pipeline:696] .................................................. 2022-01-10 04:46:22,177 INFO [teflo.teflo._run_pipeline:698] Starting tasks on pipeline: notify 2022-01-10 04:46:22,178 WARNING [teflo.teflo._run_pipeline:701] ... no tasks to be executed ... 2022-01-10 04:46:22,179 ERROR [teflo.teflo.notify:670] list.remove(x): x not in list 2022-01-10 04:46:22,180 ERROR [teflo.teflo.notify:671] One or more notifications failed. Refer to the scenario.log Traceback (most recent call last): File "/var/lib/jenkins/workspace/rhgs-3.5-rhel-8-anramesh/envs/scenario/lib/python3.6/site-packages/teflo/teflo.py", line 665, in notify self.scenario_graph.remove_resources_from_scenario(scenario) File "/var/lib/jenkins/workspace/rhgs-3.5-rhel-8-anramesh/envs/scenario/lib/python3.6/site-packages/teflo/utils/scenario_graph.py", line 383, in remove_resources_from_scenario self._actions.remove(action) ValueError: list.remove(x): x not in list

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/var/lib/jenkins/workspace/rhgs-3.5-rhel-8-anramesh/envs/scenario/bin/teflo", line 8, in sys.exit(teflo()) File "/var/lib/jenkins/workspace/rhgs-3.5-rhel-8-anramesh/envs/scenario/lib/python3.6/site-packages/click/core.py", line 1128, in call return self.main(args, kwargs) File "/var/lib/jenkins/workspace/rhgs-3.5-rhel-8-anramesh/envs/scenario/lib/python3.6/site-packages/click/core.py", line 1053, in main rv = self.invoke(ctx) File "/var/lib/jenkins/workspace/rhgs-3.5-rhel-8-anramesh/envs/scenario/lib/python3.6/site-packages/click/core.py", line 1659, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/var/lib/jenkins/workspace/rhgs-3.5-rhel-8-anramesh/envs/scenario/lib/python3.6/site-packages/click/core.py", line 1395, in invoke return ctx.invoke(self.callback, ctx.params) File "/var/lib/jenkins/workspace/rhgs-3.5-rhel-8-anramesh/envs/scenario/lib/python3.6/site-packages/click/core.py", line 754, in invoke return __callback(args, *kwargs) File "/var/lib/jenkins/workspace/rhgs-3.5-rhel-8-anramesh/envs/scenario/lib/python3.6/site-packages/click/decorators.py", line 26, in new_func return f(get_current_context(), args, **kwargs) File "/var/lib/jenkins/workspace/rhgs-3.5-rhel-8-anramesh/envs/scenario/lib/python3.6/site-packages/teflo/cli.py", line 297, in run cbn.run(tasklist=task) File "/var/lib/jenkins/workspace/rhgs-3.5-rhel-8-anramesh/envs/scenario/lib/python3.6/site-packages/teflo/teflo.py", line 426, in run self.run_all_helper(tasklist, final_passed_tasks, final_failed_tasks, status) File "/var/lib/jenkins/workspace/rhgs-3.5-rhel-8-anramesh/envs/scenario/lib/python3.6/site-packages/teflo/teflo.py", line 383, in run_all_helper self.run_all_validate_helper(final_passed_tasks, final_failed_tasks, status) File "/var/lib/jenkins/workspace/rhgs-3.5-rhel-8-anramesh/envs/scenario/lib/python3.6/site-packages/teflo/teflo.py", line 365, in run_all_validate_helper self.run_helper(sc=sc, tasklist=["validate"]) File "/var/lib/jenkins/workspace/rhgs-3.5-rhel-8-anramesh/envs/scenario/lib/python3.6/site-packages/teflo/teflo.py", line 517, in run_helper self.notify('on_start', status, passed_tasks, failed_tasks, scenario=sc) File "/var/lib/jenkins/workspace/rhgs-3.5-rhel-8-anramesh/envs/scenario/lib/python3.6/site-packages/teflo/teflo.py", line 672, in notify self.scenario_graph.remove_resources_from_scenario(scenario) File "/var/lib/jenkins/workspace/rhgs-3.5-rhel-8-anramesh/envs/scenario/lib/python3.6/site-packages/teflo/utils/scenario_graph.py", line 383, in remove_resources_from_scenario self._actions.remove(action) ValueError: list.remove(x): x not in list

rujutashinde commented 2 years ago

@anupama27 we dont have a fix in for this issue yet. We will keep the bug posted with the updated info The workaround is to not use resources with same name in the scenario descriptor file. from the log it looks like two or more of the orchestrate blocks may have the same name

@JunqiZhang0 please update the ticket here as well as you make progress with this issue.

JunqiZhang0 commented 2 years ago

Hi, @anupama27 , I'm looking at it now, should be fixed soon