Skip to content

[aap_containerized] Add container command#4030

Merged
TurboTurtle merged 1 commit into
sosreport:mainfrom
lucas-benedito:sos_aap_containerized_add_commands
Jun 19, 2025
Merged

[aap_containerized] Add container command#4030
TurboTurtle merged 1 commit into
sosreport:mainfrom
lucas-benedito:sos_aap_containerized_add_commands

Conversation

@lucas-benedito

@lucas-benedito lucas-benedito commented May 27, 2025

Copy link
Copy Markdown
Contributor

Add commands to list_instance and check_licenses.

Closes: AAP-22872, RHEL-93893

Signed-off-by: Lucas Benedito lbenedit@redhat.com


Please place an 'X' inside each '[]' to confirm you adhere to our Contributor Guidelines

  • Is the commit message split over multiple lines and hard-wrapped at 72 characters?
  • Is the subject and message clear and concise?
  • Does the subject start with [plugin_name] if submitting a plugin patch or a [section_name] if part of the core sosreport code?
  • Does the commit contain a Signed-off-by: First Lastname email@example.com?
  • Are any related Issues or existing PRs properly referenced via a Closes (Issue) or Resolved (PR) line?
  • Are all passwords or private data gathered by this PR obfuscated?

@packit-as-a-service

Copy link
Copy Markdown

Congratulations! One of the builds has completed. 🍾

You can install the built RPMs by following these steps:

  • sudo yum install -y dnf-plugins-core on RHEL 8
  • sudo dnf install -y dnf-plugins-core on Fedora
  • dnf copr enable packit/sosreport-sos-4030
  • And now you can install the packages.

Please note that the RPMs should be used only in a testing environment.

Comment thread sos/report/plugins/aap_containerized.py Outdated
Add commands to list_instance and check_licenses.

Signed-off-by: Lucas Benedito <lbenedit@redhat.com>
@lucas-benedito lucas-benedito force-pushed the sos_aap_containerized_add_commands branch from 22d00ed to ecd65c4 Compare May 28, 2025 14:28
Comment on lines +112 to +121
podman_commands = [
(f"su - {username} -c 'podman exec -it {container} bash -c"
" \"awx-manage check_license --data\"'",
"awx-manage_check_license_--data"),
(f"su - {username} -c 'podman exec -it {container} bash -c"
" \"awx-manage list_instances\"'",
"awx-manage_list_instances"),
]
for command, filename in podman_commands:
self.add_cmd_output(command, suggest_filename=filename)

@TurboTurtle TurboTurtle May 29, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does this not work using the runas and container parameters for add_cmd_output()?

E.G.

podman_commands = [
    'awx-manage check-license --data'
    ...etc...
]
for command in podman_commands:
    self.add_cmd_output(command, suggest_filename=command, runas=username, container=container)

Or, now remembering we do have some limitations there, dropping the su bit and just using runas to execute the podman command directly?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

From my tests. With the runas and container, the sos report fails to find the container.

$ sos report -o aap_containerized -k aap_containerized.username=devops -vvv
...
[plugin:aap_containerized] Skipping command 'awx-manage check_license --data' as the requested container 'automation-controller-task' does not exist.
[plugin:aap_containerized] Skipping command 'awx-manage list_instances' as the requested container 'automation-controller-task' does not exist.

The same execution with the current commit collects the data correctly from the container.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@TurboTurtle based on the output above, should I keep it with the su - commands?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hmm, guess we should look into that. I have an idea as to why that's happening but it'd take a bit to address it and I don't want that to hold this up any further.

ack, with a note on me to look into the runas and container combination.

@TurboTurtle TurboTurtle added Status/Need More Info Feedback is required to reproduce issue or to continue work Reviewed/Needs 2nd Ack Require a 2nd ack from a maintainer Kind/Collection New or updated command or file collection labels May 29, 2025
@TurboTurtle TurboTurtle added Reviewed/Ready for Merge Has been reviewed, ready for merge and removed Status/Need More Info Feedback is required to reproduce issue or to continue work Reviewed/Needs 2nd Ack Require a 2nd ack from a maintainer labels Jun 19, 2025
@TurboTurtle TurboTurtle merged commit a3a69c3 into sosreport:main Jun 19, 2025
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Kind/Collection New or updated command or file collection Reviewed/Ready for Merge Has been reviewed, ready for merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants