IBM / cloud-pak-deployer

Configuration-based installation of OpenShift and Cloud Pak for Data/Integration/Watson AIOps on various private and public cloud infrastructure providers. Deployment attempts to achieve the end-state defined in the configuration. If something fails along the way, you only need to restart the process to continue the deployment.
https://ibm.github.io/cloud-pak-deployer/
Apache License 2.0
140 stars 69 forks source link

[CP4BA] Cleaning PostgreSQL scripts #835

Open P-147 opened 2 weeks ago

P-147 commented 2 weeks ago

Hello again cpd team!

As I was working on PR #826 , I noticed a lot of possible improvements in the scripts creating the Postgres DB. Here are my submissions ; I think this should improve the global readability of the ansible scripts.

I also have a question about a part of the scripts, cf. to this other question at end of this PR description.

TL;DR

This patch fix multiple discrepancies between some identical pg SQL snippets, some incoherence/useless code and simplify the global readability of those scrips (in my opinion — Feel free to debate with me on this! 😄 )

List of Changes

This other question

I didn't submit this improvement in my PR, as I was a little bit unsure about.
Let me know what you think!

As I was going through the scripts, I noticed that the ansible task for removing the created pg tablespaces use the name of the database instead of the real name of the tablespace: e.g.: devos1 instead of devos1_tbs. https://github.com/IBM/cloud-pak-deployer/blob/08acfccba46afbc5421c0dcf1f7875eb7d1b7852/automation-roles/50-install-cloud-pak/cp4ba/cp4ba-core/tasks/remove.yml#L328-L347

The _tbs part is added under the hood in this ansible Role (l.27) : https://github.com/IBM/cloud-pak-deployer/blob/08acfccba46afbc5421c0dcf1f7875eb7d1b7852/automation-roles/50-install-cloud-pak/cp4ba/common/tasks/remove-postgresql-tablespace.yml#L20-L30

In my opinion, it would be clearer to remove the _tbs suffix from the role and directly add it on each item in the with_items: list for these reasons:

I'm waiting for your feedback! 😄