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

Grant all tables in schema fixup #1096

Merged

Conversation

georgehansper
Copy link
Contributor

This pull request addresses the issues in:

In summary, the problem was that the code was working for adding a single privilege or ALL PRIVILEGES a single table but failed to invoke the necessary changes if there was one or more tables already present that had the required single privilege or all privileges.

I have included the code from #1056 verbatim, and adapted it for the case of ALL PRIVILEGES

The code in pull request 1056 is a bit more readable than the original code, I feel.

I have also updated the associated tests in grant_spec.rb to detect the original problem.

@puppet-community-rangefinder
Copy link

postgresql::server::grant is a type

The enclosing module is declared in 51 of 576 indexed public Puppetfiles.

that may have no external impact to Forge modules.


These results were generated with Rangefinder, a tool that helps predict the downstream impact of breaking changes to elements used in Puppet modules. You can run this on the command line to get a full report.

Exact matches are those that we can positively identify via namespace and the declaring modules' metadata. Non-namespaced items, such as Puppet 3.x functions, will always be reported as near matches only.

@sheenaajay
Copy link
Contributor

Thanks for submitting the PR @georgehansper.

@@ -263,7 +277,7 @@ class { 'postgresql::server': }
EOS

if Gem::Version.new(postgresql_version) >= Gem::Version.new('9.0')
idempotent_apply(pp)
apply_manifest(pp, expect_changes: true)
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please add the idempotent_apply function back since we need to test the idempotency also which applies the manifest twice.

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 have update the tests to use the idempotent_apply() function.

idempotent_apply() is done in 2 stages, because the 1st one sets up the table permissions, and the 2nd one (which uses postgresql::server::grant) 'fixes' the permissions.

When this was a single idempotent_apply() the testbench complained because postgresql::server::grant was making changes every time (as it was supposed to).

Let me know if you want further changes made to the tests.

@georgehansper
Copy link
Contributor Author

Thanks @sheenaajay for merging this PR

cegeka-jenkins pushed a commit to cegeka/puppet-postgresql that referenced this pull request Feb 3, 2022
…in_schema_fixup

Grant all tables in schema fixup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants