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

Ensure objects are not referenced multiple times within a spec #5

Closed
zcmarine opened this issue Mar 27, 2018 · 2 comments
Closed

Ensure objects are not referenced multiple times within a spec #5

zcmarine opened this issue Mar 27, 2018 · 2 comments
Assignees

Comments

@zcmarine
Copy link
Contributor

zcmarine commented Mar 27, 2018

Summary
If a user referenced an object multiple times in a spec (e.g. schema ownership) then pgbedrock will just make the change at each spot (e.g. change ownership to role1 and then later change ownership to role2). While this isn't strictly wrong, it makes it too easy to make a mistake. Before running any of our analyzers we should verify that no object appears multiple times in the following cases:

  • schema is not under owns for multiple roles or is in the has_personal_schema for a role and in the owns for another role
  • verify that a role isn't defined multiple times
  • within one role, no object occurs in both the read and write sections. This isn't really wrong since pgbedrock grants read as well if you desire write, but it'd be good to clarify this behavior to users by ensuring they can only put things in the expected way; if they could put things in write and either put things in read or not then they may assume that that means that read can not occur when write is granted.

I don't think there are any other areas at present where an object occurring multiple times would cause unexpected behavior, though it'd be worth doing a bit more deliberating on this to see if I've missed anything.

Key Actions

  • In the spec_inspector.py referenced in the Provide multi-database support issue verify that each schema only shows up in one owns or has_personal_schema spot and never more than one spot.
  • In that same spec_inspector.py, verify that no object occurs in both the read and write sections.
  • Run the above verification before any submodule's analyzer functionality happens
  • Make sure there aren't other areas where duplicate object references could cause unexpected behavior. If table and sequence ownership has been provided (via the Support table and sequence ownership issue), then those would definitely be something we'd want to verify have no duplicates as well.
@johnshiver johnshiver self-assigned this Apr 12, 2018
@johnshiver
Copy link
Contributor

This is complete! 958d08b

@zcmarine
Copy link
Contributor Author

Well done! 👏👏

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

No branches or pull requests

2 participants