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

[charmed_postgresql] Add Charmed PostgreSQL support #3651

Merged
merged 1 commit into from
Jun 13, 2024

Conversation

acsgn
Copy link
Contributor

@acsgn acsgn commented May 31, 2024

Example output of the plugin can be seen at https://drive.google.com/drive/folders/1t1QOwzqwFTv140xvpaRpB5-kqRPOYth5?usp=sharing


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?

Copy link

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-3651
  • And now you can install the packages.

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

Copy link
Member

@arif-ali arif-ali left a comment

Choose a reason for hiding this comment

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

We probably want to make the same change with other places too

sos/report/plugins/charmed_postgresql.py Outdated Show resolved Hide resolved
sos/report/plugins/charmed_postgresql.py Fixed Show fixed Hide fixed
sos/report/plugins/charmed_postgresql.py Fixed Show fixed Hide fixed
sos/report/plugins/charmed_postgresql.py Fixed Show fixed Hide fixed
sos/report/plugins/charmed_postgresql.py Fixed Show fixed Hide fixed
sos/report/plugins/charmed_postgresql.py Fixed Show fixed Hide fixed
@arif-ali
Copy link
Member

arif-ali commented Jun 4, 2024

@acsgn can you rebase to main please as the centos-stream 8 was EOL'd and now the CI doesn't work on those. This was just merged, thanks

@arif-ali
Copy link
Member

arif-ali commented Jun 5, 2024

looks good overall

a heads up, we have a new PR (#3648) that we have been working on, that allows you to run a command as a user without using su or runuser. You could potentially rework those bits in this code, and utilise that feature once that is merged.

Furthermore, we prefer that any PR that comes through is squashed before we merge.

@acsgn acsgn force-pushed the feat/charmed_postgresql branch 2 times, most recently from 626d4c2 to 6921953 Compare June 7, 2024 04:29
@acsgn
Copy link
Contributor Author

acsgn commented Jun 7, 2024

@arif-ali I believe we should move the chdir to under the runas. Currently, runas overrides the user's specification.

sos/sos/utilities.py

Lines 234 to 239 in 91c7c54

if (chdir):
os.chdir(chdir)
if runas:
os.setgid(pwd.getpwnam(runas).pw_gid)
os.setuid(pwd.getpwnam(runas).pw_uid)
os.chdir(pwd.getpwnam(runas).pw_dir)

@arif-ali
Copy link
Member

arif-ali commented Jun 7, 2024

@arif-ali I believe we should move the chdir to under the runas. Currently, runas overrides the user's specification.

sos/sos/utilities.py

Lines 234 to 239 in 91c7c54

if (chdir):
os.chdir(chdir)
if runas:
os.setgid(pwd.getpwnam(runas).pw_gid)
os.setuid(pwd.getpwnam(runas).pw_uid)
os.chdir(pwd.getpwnam(runas).pw_dir)

good call and thanks for noticing that, I'll get that resolved in another PR

Signed-off-by: Abdullah Cosgun <abdullah.cosgun@canonical.com>
Copy link
Member

@arif-ali arif-ali left a comment

Choose a reason for hiding this comment

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

based on internal discussions and testing, this looks good now

import os
import yaml

from sos.report.plugins import Plugin, UbuntuPlugin
Copy link
Contributor

@pmoravec pmoravec Jun 13, 2024

Choose a reason for hiding this comment

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

It seems charmed-postgresql is available on many distributions, per https://snapcraft.io/charmed-postgresql, but since "Users by distribution" shows just Ubuntu, we can have just UbuntuPlugin until somebody wants otherwise.

@arif-ali arif-ali merged commit f9f52dc into sosreport:main Jun 13, 2024
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants