Skip to content

Conversation

@pmoravec
Copy link
Contributor

@pmoravec pmoravec commented Dec 1, 2025

Let collect same command outputs from containerized deployments, likewise we do collect from RPM based deployments in all other aap_* plugins today.

Closes: #4168
Relevant-to: RHEL-129225


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 protected]?
  • 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

Congratulations! One of the builds has completed. 🍾

You can install the built RPMs by following these steps:

  • sudo dnf install -y 'dnf*-command(copr)'
  • dnf copr enable packit/sosreport-sos-4168
  • And now you can install the packages.

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

@snagoor
Copy link
Contributor

snagoor commented Dec 1, 2025

@pmoravec at first glance this looks perfect. I will test it on multi-host and single host deployment as well.

@snagoor
Copy link
Contributor

snagoor commented Dec 3, 2025

Hello @pmoravec this works as expected. Only change is to mask the PASSWORD and SECRET collected with aap-gateway-manage print_settings command. Similar to https://github.com/sosreport/sos/blob/main/sos/report/plugins/aap_gateway.py#L60-L72

pmoravec added a commit to pmoravec/sos that referenced this pull request Dec 3, 2025
Let collect same command outputs from containerized deployments,
likewise we do collect from RPM based deployments in all other aap_*
plugins today.

Closes: sosreport#4168

Signed-off-by: Pavel Moravec <[email protected]>
@pmoravec pmoravec force-pushed the sos-pmoravec-aap_containerised-cmds-enhance branch from 5b0d868 to ae7bb92 Compare December 3, 2025 08:41
@pmoravec
Copy link
Contributor Author

pmoravec commented Dec 3, 2025

Good point. Obfuscation added, tested locally it works:

sos_commands/aap_containerized/automation-gateway/aap-gateway-manage_print_settings:

DATABASES                                = {'default': {'PASSWORD': '**********', 'ENGINE': 'django.db.backends.postgresql', 'NAME': 'gateway', ..}}
..
EMAIL_HOST_PASSWORD                      = '**********'
..
SECRET_KEY                               = b'**********'

Comment on lines +164 to +167
self.add_cmd_output(f"su - {username} -c 'podman exec -it"
f" {pod} bash -c \"{cmd}\"'",
Copy link
Member

Choose a reason for hiding this comment

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

We have probably discussed this in the past, but just for completeness sake, does runas not function here to avoid the embedded su calls?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I dont recall the original reason, but when I tried to use runas=username now, I am getting hung processes like:

aap       152503  0.0  0.0   3068  1664 pts/1    S    19:44   0:00 timeout 300s podman exec -it automation-controller-task bash -c awx-manage check_license --data
aap       152505  0.0  0.3 2023996 53964 pts/1   Sl   19:44   0:00 podman exec -it automation-controller-task bash -c awx-manage check_license --data
~~~

hung for minutes (while manual execution of the same takes a fraction of second).

Copy link
Member

@TurboTurtle TurboTurtle left a comment

Choose a reason for hiding this comment

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

LGTM up to the comment about runas vs su. I'm fine if it goes in as written if there are outstanding issues preventing the use of runas, which I believe there may be.

@TurboTurtle TurboTurtle added Kind/Enhancement Status/Need More Info Feedback is required to reproduce issue or to continue work labels Dec 4, 2025
@pmoravec
Copy link
Contributor Author

pmoravec commented Dec 4, 2025

Worth commenting the need of su - approach as a comment in the code?

@TurboTurtle
Copy link
Member

Couldn't hurt to add a comment or TODO on investigating how to get this working without the embedded su -.

Let collect same command outputs from containerized deployments,
likewise we do collect from RPM based deployments in all other aap_*
plugins today.

Closes: sosreport#4168

Signed-off-by: Pavel Moravec <[email protected]>
@pmoravec pmoravec force-pushed the sos-pmoravec-aap_containerised-cmds-enhance branch from ae7bb92 to 07cc430 Compare December 4, 2025 21:51
@pmoravec
Copy link
Contributor Author

pmoravec commented Dec 4, 2025

I spent some time trying to identify the cause but without a luck. So I added just the explanation to the code.

@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 labels Dec 5, 2025
@TurboTurtle TurboTurtle merged commit f234eb9 into sosreport:main Dec 5, 2025
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Kind/Enhancement 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