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

Fix handling of ProviderException #181

Merged
merged 3 commits into from
Jan 20, 2023

Conversation

lpramuk
Copy link
Contributor

@lpramuk lpramuk commented Jan 18, 2023

Fixes #172
Fixes #146

Fixes typos and stylecheck
Updates setup.cfg

(no squash please)

@lpramuk lpramuk self-assigned this Jan 18, 2023
@lpramuk lpramuk changed the title Handle ProviderException properly Draft: Handle ProviderException properly Jan 18, 2023
@lpramuk lpramuk marked this pull request as draft January 18, 2023 09:30
@lpramuk lpramuk changed the title Draft: Handle ProviderException properly Handle ProviderException properly Jan 18, 2023
@lpramuk lpramuk marked this pull request as ready for review January 18, 2023 09:47
lpramuk referenced this pull request Jan 18, 2023
* support passing additional env vars to host

* Update README with the environment argument example
fix some typos

* Update args_file parsing to behave correctly with eventual cli args.
Update README
@lpramuk lpramuk force-pushed the handle_provider_error branch from bc45e0a to 86ebaf3 Compare January 18, 2023 13:32
@lpramuk lpramuk force-pushed the handle_provider_error branch from 86ebaf3 to c0ce337 Compare January 18, 2023 15:10
@lpramuk lpramuk changed the title Handle ProviderException properly Fix handling of ProviderException Jan 18, 2023
@lpramuk
Copy link
Contributor Author

lpramuk commented Jan 18, 2023

Non-existing workflow name

$ broker checkout --workflow blahblah
[INFO 230118 16:23:44] Using provider AnsibleTower to checkout
[INFO 230118 16:23:44] Using token authentication
[ERROR 230118 16:23:46] ProviderError: AnsibleTower encountered the following error: Workflow not found by name: blahblah
$ echo $?
7

No template found

$ broker checkout --workflow deploy-base-rhel --deploy_rhel_version 11
[INFO 230118 16:25:23] Using provider AnsibleTower to checkout
[INFO 230118 16:25:23] Using token authentication
[INFO 230118 16:25:27] Waiting for job: 
    API: https://infra-ansible-tower-01/api/v2/workflow_jobs/387213/
    UI: https://infra-ansible-tower-01/#/jobs/workflow/387213/output
[ERROR 230118 16:26:01] ProviderError: AnsibleTower encountered the following error: {'job': 'satlab-tower-deploy-version-choice', 'task': 'Take Deploy Workflow inputs and output correct set-stats for the remainder of workflow', 'reason': 'No template found for passed arguments'}
$ echo $?
7

Partial success for multiple instances (by deleting 2 VMs)

$ broker checkout --workflow deploy-base-rhel -c 10 
...
[ERROR 230118 16:55:53] ProviderError: AnsibleTower encountered the following error: {'job': 'postdeploy-base-rhel-jt', 'task': 'Output deployed hosts', 'reason': "The task includes an option with an undefined variable. The error was: 'vminfo' is undefined\n\nThe error appears to be in '/runner/project/roles/workflow-output-deploy-results/tasks/main.yml': line 11, column 5, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n  block:\n  - name: Add VM FQDNs to display\n    ^ here\n"}
[INFO 230118 16:56:28] Host: dhcp-2-221.vms
[INFO 230118 16:56:28] Host: dhcp-3-26.vms
[INFO 230118 16:56:29] Host: dhcp-2-71.vms
[ERROR 230118 16:56:29] ProviderError: AnsibleTower encountered the following error: {'reason': 'Unable to determine failure cause for deploy-base-rhel ar /api/v2/workflow_jobs/387220/'}
[INFO 230118 16:56:30] Host: dhcp-2-28.vms
[INFO 230118 16:56:30] Host: dhcp-3-189.vms
[INFO 230118 16:56:30] Host: dhcp-3-56.vms
[INFO 230118 16:56:31] Host: dhcp-2-234.vms
[INFO 230118 16:56:32] Host: dhcp-2-171.vms
$ echo $?
7

@lpramuk lpramuk force-pushed the handle_provider_error branch from c0ce337 to 7d639dd Compare January 18, 2023 19:22
@lpramuk lpramuk force-pushed the handle_provider_error branch from 7d639dd to ffdbc2c Compare January 18, 2023 19:34
@lpramuk
Copy link
Contributor Author

lpramuk commented Jan 19, 2023

$ pytest tests/functional/test_satlab.py 
=========================================== test session starts ============================================
platform linux -- Python 3.11.1, pytest-7.2.1, pluggy-1.0.0 -- /home/lpramuk/.virtualenvs/b/bin/python
cachedir: .pytest_cache
rootdir: /home/lpramuk/git/SatelliteQE/broker, configfile: pytest.ini
collected 11 items

tests/functional/test_satlab.py::test_checkout_scenarios[args_file0] PASSED                          [  9%]
tests/functional/test_satlab.py::test_checkout_scenarios[args_file1] PASSED                          [ 18%]
tests/functional/test_satlab.py::test_checkout_scenarios[args_file2] PASSED                          [ 27%]
tests/functional/test_satlab.py::test_checkout_scenarios[args_file3] PASSED                          [ 36%]
tests/functional/test_satlab.py::test_execute_scenarios[args_file0] PASSED                           [ 45%]
tests/functional/test_satlab.py::test_execute_scenarios[args_file1] PASSED                           [ 54%]
tests/functional/test_satlab.py::test_inventory_sync PASSED                                          [ 63%]
tests/functional/test_satlab.py::test_workflows_list PASSED                                          [ 72%]
tests/functional/test_satlab.py::test_workflow_query PASSED                                          [ 81%]
tests/functional/test_satlab.py::test_tower_host PASSED                                              [ 90%]
tests/functional/test_satlab.py::test_tower_host_mp PASSED                                           [100%]

=============================== 11 passed, 12 warnings in 3670.27s (1:01:10) ===============================

Copy link
Member

@JacobCallahan JacobCallahan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK, thanks for the thorough PR!

@JacobCallahan JacobCallahan merged commit 4da7d57 into SatelliteQE:master Jan 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants