Skip to content

Suse: Introduce support for upstream repo #169

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

Closed
wants to merge 10 commits into from

Conversation

noelmcloughlin
Copy link
Contributor

@noelmcloughlin noelmcloughlin commented Sep 25, 2017

This PR is an enhancement to allow the upstream repo to be used for SLES and OpenSUSE.

The osmap.yaml was updated introducing the feature. Design is aligned with Redhat Stanza for convenience and continuity. These log files demonstrate working "feature" on OpenSuse LEAP 42 as postgresql 9.5 software is retrieved from upstream-

  1. postgres95_nogpgcheck_run1.log.txt
  2. postgres95_nogpgcheck_run2.log.txt
  3. postgres95_nogpgcheck_run3.log.txt

Limitation
GPGCHECK is disabled (for now): See https://redmine.postgresql.org/issues/2732

Followup

  1. Fix gpgcheck on Suse - Raise ISSUE.

Nice to Have
The pillar.example was improved in the following manner-

  • Required parameters are prominent. For example the value of service differs depending on whether linux distribution or upstream repo is used.
  • Unnecessary parameters (pkg, pkg_client, pkgs_extra) were removed to fix confusion.

Thanks

Copy link
Contributor

@vutny vutny left a comment

Choose a reason for hiding this comment

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

I welcome a good intension to add upstream support for SUSE, but for me the implementation looks like half-done.
Very quick and rough investigation reveals obvious things. Please take a look at my in-line comments.

Also, would you mind to organize Git history in PR(s) a little bit? You can use --amend to simply add stuff to your previous commit. And do --interactive rebase to squash intermediate commits. This will significantly improve understanding what's changed and why, especially when the PR would be eventually merged.

name: pgdg-sles-{{ release }}
humanname: PostgreSQL {{ repo.version }} $releasever - $basearch
#Suse repos are suffixed 'suse/sles-12-$basearch' by upstream community convention.
baseurl: 'https://download.postgresql.org/pub/repos/yum/{{ repo.version }}/suse/sles-12-$basearch'
Copy link
Contributor

Choose a reason for hiding this comment

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

Hard-coding SUSE release number looks not very flexible. Things may change, so maybe use $releasever? However, this may affect OpenSuse...

Copy link
Contributor Author

@noelmcloughlin noelmcloughlin Sep 26, 2017

Choose a reason for hiding this comment

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

I cannot use '$releasever' because packages target Suse family (SUSE 12+, OpenSUSE 42+), so the upstream repo convention seems to be hardcoding of "sles-12". Using '$releasever' breaks the formula for Suse family except Sles 12.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, that's true, I understand. My point was that the installation could be broken on other SUSE variants which is not currently supported by upstream: SLES 11, OpenSuse 13 or Tumbleweed.
In such cases it's better to fail fast. But that also introduces complexities.
I think this is fine for now.

baseurl: 'https://download.postgresql.org/pub/repos/yum/{{ repo.version }}/suse/sles-12-$basearch'
gpgkey: 'https://download.postgresql.org/pub/repos/yum/{{ repo.version }}/suse/sles-12-$basearch/repodata/repomd.xml'
#future: fix suse "4-Signatures public key is not available" issue and enable gpgcheck.
gpgcheck: 0
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not a SUSE expert by any mean, but I assume GPG key verification should just work as in other RedHat-based distro. Have you tried to resolve this? I would make a guess that the key public key file is just located elsewhere.

It looks not so nice to introduce "half-secure" solution by default.

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 agree its not nice - I'm looking for agreement to raise as "ISSUE" and fix afterwards.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes I done some troubleshooting. But @myoung34 has identified the problem.

Copy link
Contributor

Choose a reason for hiding this comment

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

You just need to provide correct public key URL, and I think everything would just "magically" work :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Duh, need to wear my reading glasses.

{% set lib_dir = '/var/lib/pgsql/' ~ repo.version ~ '/data' %}

pkg: postgresql{{ release }}-server
pkg_client: postgresql{{ release }}-server
Copy link
Contributor

Choose a reason for hiding this comment

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

As I see, client binaries are available from postgresql{{ release }} package.

test: test -f '{{ lib_dir }}/PG_VERSION'

# Directory containing PostgreSQL client executables
bin_dir: /usr/pgsql-{{ repo.version }}/bin
Copy link
Contributor

Choose a reason for hiding this comment

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

Why to blindly copy-paste all the stuff? It seems that SUSE packages install all (?) needed alternatives itself during post-installation phase.

Copy link
Contributor Author

@noelmcloughlin noelmcloughlin Sep 26, 2017

Choose a reason for hiding this comment

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

The PR description explains why ... "Design is aligned with Redhat Stanza for convenience and continuity". It keeps the PR simple.

It seems that SUSE packages install all (?) needed alternatives itself during post-installation phase.

The upstream repo is common to SusE/RedHat/Fedora so same comment applies. Perhaps alternatives handling can be improved but lets keep PR focussed.

Copy link
Contributor

Choose a reason for hiding this comment

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

The SUSE section does need to be full copy of RedHat just for the sake of artificial consistency.
These options bin_dir, client_bins and server_bins serve a concrete purpose: allow subsequent states and postges modules to properly discover binaries and be able to do the job.

Other distros don't have them, because they don't need to. That's why it is configurable.
The necessary thing should be already done by installed packages, so the formula must not duplicate this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This alternatives cod is legacy. Perhaps in the past the packages did not already do this.

I will investigate and raise common issue on RedHat/Suse.

Copy link
Contributor

Choose a reason for hiding this comment

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

And Suse definitely doesn't require that.

Choose a reason for hiding this comment

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

There has to be a better way to handle this than to cargo cult large blocks that are similar between os families

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for pointing me in right way here. Surely RedHat has same problem.

Agreed - I tested and all except two are already handled by upstream packages.

pkg: postgresql-server
pkg_client: postgresql
pkg_libpq_dev: postgresql
pkg_client: postgresql-server
Copy link
Contributor

Choose a reason for hiding this comment

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

Again, are you sure the client and the server package are the same in packages provided by SUSE distribution?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I'm sure.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, it was a rhetoric question :)
https://software.opensuse.org/package/postgresql

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'm sorry, okay thanks.

pillar.example Outdated
pkgs_extra:
- postgresql-contrib
- postgresql-plpython
pkgs_extra: []
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm aware that hard-coding platform-specific packages here was bad idea. But this possibly may affect later installation of the uuid_ossp extension defined below. Have you tried to run test kitchen with provided config?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, I've tested on OpenSUSE LEAP 42.

Copy link
Contributor

Choose a reason for hiding this comment

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

Better to test your changes on other platforms as well, because you change shared things, and pillar.example has been used in existent test. That's not perfect, and the change is actually meaningful, but we need to understand an impact.

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've already been testing formula on other distributions - see #171 #170 #164.

Only regression is #172 which is something you mentioned regarding pkgs_extra()

Copy link
Contributor

Choose a reason for hiding this comment

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

I assume this affects Ubuntu and the existing test based on it.

Choose a reason for hiding this comment

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

Also this is just a pillar.example, just leave the values as is to help people understand layout. We only get one pillar.example and support (unofficially) any number of distros so it doesnt need to change with every iteration of what distro was last used against it.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's exactly what I've been trying to express 👍 But having some working example that fits the most popular ones would be great.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. Will action.

humanname: PostgreSQL {{ repo.version }} $releasever - $basearch
#Suse repos are suffixed 'suse/sles-12-$basearch' by upstream community convention.
baseurl: 'https://download.postgresql.org/pub/repos/yum/{{ repo.version }}/suse/sles-12-$basearch'
gpgkey: 'https://download.postgresql.org/pub/repos/yum/{{ repo.version }}/suse/sles-12-$basearch/repodata/repomd.xml'

Choose a reason for hiding this comment

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

this isnt a gpg key, this is a yum repo metadata xml file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good spot, thanks.

Copy link
Contributor

Choose a reason for hiding this comment

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

I have found that starting from PostgreSQL 9.6 they ship valid repo key within the repo:
https://download.postgresql.org/pub/repos/zypp/9.6/suse/sles-12-x86_64/repodata/repomd.xml.key

I think we could leave 9.5 and versions below as is, since user is able to override GPG check in Pillar.

@myoung34
Copy link

I see that there's a .kitchen.yml file. can we get @aboe76 to enable it to prevent some regressions?

@vutny
Copy link
Contributor

vutny commented Dec 5, 2017

Hi @noelmcloughlin

Could you please update the status of this PR? Would you have some time or any plans to work on it further according to review comments?
Thanks for your contributions anyway!

@noelmcloughlin
Copy link
Contributor Author

Hey @vutny
To recap, the original PR proposes adding support for OpenSUSE without Hash-checking. PR reviewers preferred full feature rather than incremental improvement. However, full feature is blocked by issues mentioned in #173. The correct action here is to close the PR and I should refactor a new solution acceptable to community.

Thank you for reviewing!!!!! I will followup on #173 and your comments in this review in a new PR as soon as I make some time.

@vutny
Copy link
Contributor

vutny commented Dec 6, 2017

@noelmcloughlin Awesome, thanks. So let's keep this PR open as a reminded until you'd have another one refactored. Then we close it out in favor of that.

@noelmcloughlin
Copy link
Contributor Author

Hi @vutny I'll pick this up again as next priority, been hectic with other stuff. thx

@noelmcloughlin
Copy link
Contributor Author

Rebased as #176

@noelmcloughlin noelmcloughlin deleted the suse-upstream-repo branch January 14, 2018 22:09
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.

3 participants