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

fix(repo): reorder dependencies to prevent errors #309

Merged
merged 2 commits into from
Feb 26, 2021

Conversation

javierbertoli
Copy link
Member

PR progress checklist (to be filled in by reviewers)

  • Changes to documentation are appropriate (or tick if not required)
  • Changes to tests are appropriate (or tick if not required)
  • Reviews completed

What type of PR is this?

Primary type

  • [build] Changes related to the build system
  • [chore] Changes to the build process or auxiliary tools and libraries such as documentation generation
  • [ci] Changes to the continuous integration configuration
  • [feat] A new feature
  • [fix] A bug fix
  • [perf] A code change that improves performance
  • [refactor] A code change that neither fixes a bug nor adds a feature
  • [revert] A change used to revert a previous commit
  • [style] Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc.)

Secondary type

  • [docs] Documentation changes
  • [test] Adding missing or correcting existing tests

Does this PR introduce a BREAKING CHANGE?

No.

Related issues and/or pull requests

Describe the changes you're proposing

When installing a postgresql-client using upstream's repo, the formula fails to install the repo because a require_in dependency expects the postgresql-server package. This PR moves the dependency to the server/init.sls state.

Pillar / config required to test the proposed changes

The issue can be reproduced using this pillar

postgres:
  use_upstream_repo: true
  version: 11

and this command

salt-call --local state.apply postgres.client

Debug log showing how the proposed changes work

Documentation checklist

  • Updated the README (e.g. Available states).
  • Updated pillar.example.

Testing checklist

  • Included in Kitchen (i.e. under state_top).
  • Covered by new/existing tests (e.g. InSpec, Serverspec, etc.).
  • Updated the relevant test pillar.

Additional context

@sticky-note
Copy link
Member

This is the exact contrary of this #300
which was introduced because when use_upstream_repo: True on FreeBSD the require: postgresql-repo fails to find the right due probably to this line

{%- if 'pkg_repo' in postgres -%}

Not sure of what I am saying, I had the exact same problem today but this PR need to be double checked

@@ -20,6 +20,8 @@ postgresql-server:
- pkgs: {{ pkgs | json }}
{%- if postgres.use_upstream_repo == true %}
Copy link
Contributor

Choose a reason for hiding this comment

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

This statement probably needs additional expression, the same as in upstream.sls:

Suggested change
{%- if postgres.use_upstream_repo == true %}
{%- if 'pkg_repo' in postgres and postgres.use_upstream_repo == true %}

Because if "upstream" is flag is on, but there are no repo definition for particular distro, the requisite will fail.

Copy link
Member Author

Choose a reason for hiding this comment

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

@sticky-note, I added the changes @vutny suggests and also added the same check in a few other places where postgres.use_upstream_repo was being checked but pkg_repo was not.

I think the changes in this PR should be OK for all the platforms, but I don't have a FreeBSD around to try it. Can you try it and give us your feedback?

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.

Thanks @javierbertoli , I just have minor comment about MacOS case.

postgres/client/init.sls Outdated Show resolved Hide resolved
postgres/server/init.sls Outdated Show resolved Hide resolved
postgres/dev/init.sls Outdated Show resolved Hide resolved
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.

Looks good to me, thank you @javierbertoli !

@sticky-note
Copy link
Member

sticky-note commented Feb 26, 2021

Ok, it seems to have no issue in this manner. Thanks @javierbertoli

@sticky-note sticky-note merged commit ec5d66f into saltstack-formulas:master Feb 26, 2021
@javierbertoli
Copy link
Member Author

Thanks to you both!

@saltstack-formulas-travis

🎉 This PR is included in version 0.41.6 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

4 participants