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

Implement ansible's resolved action #995

Merged
merged 3 commits into from Feb 28, 2022

Conversation

matburt
Copy link
Member

@matburt matburt commented Feb 11, 2022

This supercedes #816

This also includes some black formatting changes.

@matburt matburt requested a review from a team as a code owner February 11, 2022 16:43
@github-actions github-actions bot added needs_triage New item that needs to be triaged test Changes to test files labels Feb 11, 2022
chrismeyersfsu and others added 2 commits February 12, 2022 01:15
ansible-core also depends on packaging so this seems like a reasonable dependency
@matburt
Copy link
Member Author

matburt commented Feb 12, 2022

47ee0e5 keeps us from resurfacing #969

@cidrblock
Copy link
Contributor

+1, not because I completely grok it all but because it doesn't use distulils :)

@@ -46,6 +48,30 @@ def skipif_pre_ansible211(is_pre_ansible211):
pytest.skip("Valid only on Ansible 2.11+")


@pytest.fixture(scope="session")
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not crazy about what the is_pre_ansible211 test does. It doesn't seem like it'll work in the general case.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm also not sure how I feel about this implementation generally but it gets us there quick with whatever variant of Ansible is installed in the environment.

Copy link
Contributor

Choose a reason for hiding this comment

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

The is_pre_ansible211 fixture should work in the general case. The ansible package used in our tests will be ansible-core for 2.11 or higher. 2.10 is ansible-base, and 2.9 and earlier is ansible.

@@ -1,6 +1,8 @@
import shutil

from pathlib import Path
from packaging.version import Version
Copy link
Member

Choose a reason for hiding this comment

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

@simaishi Can you check and see if this is available as an RPM from the standard repos?

Copy link
Member Author

Choose a reason for hiding this comment

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

🤞🏻 it's also used by ansible-core so my working assumption was that we had solved it for the necessary dependencies.

Copy link
Contributor

Choose a reason for hiding this comment

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

ansible-core has it bundled, but we do have an access to the standalone rpm as well.

@AlanCoding
Copy link
Member

This looks most similar to the task_action key... makes sense, right? Before, we had task_action, now we have resolved_action in addition to that. But those are handled in separate parts of the code, and I haven't understood why. We seem to get both of them from the same task object... so why would they be in different places?

@AlanCoding
Copy link
Member

To give my comment greater specificity,

diff --git a/ansible_runner/display_callback/callback/awx_display.py b/ansible_runner/display_callback/callback/awx_display.py
index aa29f39..0aee596 100644
--- a/ansible_runner/display_callback/callback/awx_display.py
+++ b/ansible_runner/display_callback/callback/awx_display.py
@@ -409,6 +409,7 @@ class CallbackModule(DefaultCallbackModule):
             task=(task.name or task.action),
             task_uuid=str(task._uuid),
             task_action=task.action,
+            resolved_action=getattr(task, 'resolved_action', ''),
             task_args='',
         )
         try:
@@ -554,7 +555,6 @@ class CallbackModule(DefaultCallbackModule):
             name=task.get_name(),
             is_conditional=is_conditional,
             uuid=task_uuid,
-            resolved_action=getattr(task, 'resolved_action', '')
         )
         with self.capture_event_data('playbook_on_task_start', **event_data):
             super(CallbackModule, self).v2_playbook_on_task_start(task, is_conditional)

this would seem more clear and still passes the test

@shanemcd
Copy link
Member

recheck

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.

@Shrews Shrews added gate and removed needs_triage New item that needs to be triaged labels Feb 28, 2022
@ansible-zuul ansible-zuul bot merged commit ee8e3cd into ansible:devel Feb 28, 2022
@AlanCoding
Copy link
Member

@Shrews in the future, I want to make sure that we do integration testing with AWX before merging any change intended to be consumed by AWX. In this case, I did, and those were passing.

@Shrews
Copy link
Contributor

Shrews commented Feb 28, 2022

@AlanCoding Ok. @shanemcd had asked me about merging this today, so I assumed that was already done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Changes to test files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants