From 910a6852b9f5527015f3803d3d592aaa204daddd Mon Sep 17 00:00:00 2001 From: Chris Choi Date: Thu, 7 Sep 2023 10:47:06 -0400 Subject: [PATCH 1/6] fix: support new HA pgpool parameter HA_PGPOOL_HEARTBEAT_PORT (DEPENBDAT-2929) --- .../library/merge_viya_deployment_files.py | 26 ++++++++++++++++++- .../merge-viya-deployment-files.yml | 23 ++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/playbooks/merge-playbook/library/merge_viya_deployment_files.py b/playbooks/merge-playbook/library/merge_viya_deployment_files.py index 0ace44e..d91f94e 100644 --- a/playbooks/merge-playbook/library/merge_viya_deployment_files.py +++ b/playbooks/merge-playbook/library/merge_viya_deployment_files.py @@ -60,7 +60,7 @@ PCP_PORT_LINE = " - PCP_PORT" PGPOOL_PORT_LINE_BEFORE = "PGPOOL_PORT:" POOL_NUMBER_LINE = " POOL_NUMBER: '0'\n" - +PGPOOL_HEARTBEAT_LINE = " HA_PGPOOL_HEARTBEAT_PORT: ''\n" ############################################################ # Get Local Environment ############################################################ @@ -524,6 +524,23 @@ def add_perms_override_property_invocation_variable (vars_file): line = PERMS_OVERRIDE_LINE + line out_file.write(line) + +############################################################ +# Add a new HA_PGPOOL_HEARTBEAT_PORT property to cpspgpoolc and pgpoolc in the vars.yml +############################################################ +def add_pgpool_heartbeat_property_invocation_variable (vars_file): + with open(vars_file, "r") as in_file: + buf = in_file.readlines() + + with open(vars_file, "w") as out_file: + for line in buf: + temp_line = line.lstrip() + # LOG.info("temp_line " + temp_line ) + if temp_line.startswith("POOL_NUMBER:"): + line = PGPOOL_HEARTBEAT_LINE + line + # LOG.info("line " + line ) + out_file.write(line) + ############################################################ # Main ############################################################ @@ -534,6 +551,7 @@ def main(): "current_files_dir": {"required": True, "type": "str"}, "add_ha_properties": {"required": True, "type": "bool"}, "add_perms_override": {"required": True, "type": "bool"}, + "add_pgpool_heartbeat": {"required": True, "type": "bool"}, "log_file_name": {"required": True, "type": "str"}, "tenant_id_string": {"required": False, "type": "str"}, "merge_default_host": {"required": False, "type": "str"}, @@ -545,6 +563,7 @@ def main(): current_files_dir = module.params['current_files_dir'] add_ha_properties = module.params['add_ha_properties'] add_perms_override = module.params['add_perms_override'] + add_pgpool_heartbeat = module.params['add_pgpool_heartbeat'] if not current_inventory_file.startswith(os.sep): # force working with absolution path location @@ -644,6 +663,11 @@ def main(): add_perms_override_property_invocation_variable(new_vars_yml) LOG.info("The new postgres perms_override property was added to the newer vars.yml file.") + # add pgpool_heartbeat properties + if add_pgpool_heartbeat: + add_pgpool_heartbeat_property_invocation_variable(new_vars_yml) + LOG.info("The new postgres pgpool_heartbeat property was added to the newer vars.yml file.") + # Get the tenant_id_list and do merge the tenant_vars.yml files tenant_string = module.params['tenant_id_string'] try: diff --git a/playbooks/merge-playbook/merge-viya-deployment-files.yml b/playbooks/merge-playbook/merge-viya-deployment-files.yml index 47f2cf0..69d7e51 100644 --- a/playbooks/merge-playbook/merge-viya-deployment-files.yml +++ b/playbooks/merge-playbook/merge-viya-deployment-files.yml @@ -296,10 +296,32 @@ check_mode: yes failed_when: false + - name: Check whether the HA_PGPOOL_HEARTBEAT_PORT property exists in the pre merged vars.yml + lineinfile: + path: "{{ merged_vars_yml }}" + regexp: 'HA_PGPOOL_HEARTBEAT_PORT:' + state: absent + register: pgpool_heartbeat_property_exists + check_mode: yes + failed_when: false + + - name: Check whether the HA_PGPOOL_HEARTBEAT_PORT property exists in the current vars.yml + lineinfile: + path: "{{ current_vars_yml }}" + regexp: 'HA_PGPOOL_HEARTBEAT_PORT:' + state: absent + register: curr_pgpool_heartbeat_property_exists + check_mode: yes + failed_when: false + - set_fact: add_perms_override: true when: perms_override_property_exists.changed == True and curr_perms_override_property_exists.changed == False + - set_fact: + add_pgpool_heartbeat: true + when: pgpool_heartbeat_property_exists.changed == True and curr_pgpool_heartbeat_property_exists.changed == False and ha_properties_exist.changed == True + - name: Uncomment out the vars.yml properties in the merged folder if they are activated in the current vars.yml replace: path: "{{ merged_vars_yml }}" @@ -400,6 +422,7 @@ current_files_dir: "{{ current_files_dir }}" add_ha_properties: "{{ ha_properties_exist.changed }}" add_perms_override: "{{ add_perms_override is defined | default(false) }}" + add_pgpool_heartbeat: "{{ add_pgpool_heartbeat is defined | default(false) }}" log_file_name: "{{ merged_folder }}/merge_viya_deployment_files.log" tenant_id_string: "{{ tenant_id_string if tenantID_list is defined | default(false) else omit }}" merge_default_host: "{{ merge_default_host if merge_default_host is defined | default(false) else omit }}" From c579fcfe33532ff83244666cdbf8517a347b5ad5 Mon Sep 17 00:00:00 2001 From: Chris Choi Date: Thu, 7 Sep 2023 18:03:28 -0400 Subject: [PATCH 2/6] fix: remove the commented log statements and add a blank line between the constants and comment block (DEPENBDAT-2929) --- .../merge-playbook/library/merge_viya_deployment_files.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/playbooks/merge-playbook/library/merge_viya_deployment_files.py b/playbooks/merge-playbook/library/merge_viya_deployment_files.py index d91f94e..fb3e8c9 100644 --- a/playbooks/merge-playbook/library/merge_viya_deployment_files.py +++ b/playbooks/merge-playbook/library/merge_viya_deployment_files.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -# Copyright (c) 2019-2020, SAS Institute Inc., Cary, NC, USA. All Rights Reserved. +# Copyright (c) 2019-2023, SAS Institute Inc., Cary, NC, USA. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 # @@ -61,6 +61,7 @@ PGPOOL_PORT_LINE_BEFORE = "PGPOOL_PORT:" POOL_NUMBER_LINE = " POOL_NUMBER: '0'\n" PGPOOL_HEARTBEAT_LINE = " HA_PGPOOL_HEARTBEAT_PORT: ''\n" + ############################################################ # Get Local Environment ############################################################ @@ -535,10 +536,8 @@ def add_pgpool_heartbeat_property_invocation_variable (vars_file): with open(vars_file, "w") as out_file: for line in buf: temp_line = line.lstrip() - # LOG.info("temp_line " + temp_line ) if temp_line.startswith("POOL_NUMBER:"): line = PGPOOL_HEARTBEAT_LINE + line - # LOG.info("line " + line ) out_file.write(line) ############################################################ From b8a1e1d001088f150f5e51f2fcb22753d3d2524e Mon Sep 17 00:00:00 2001 From: Kevin Lingle Date: Tue, 12 Sep 2023 11:33:21 -0400 Subject: [PATCH 3/6] updates related to contributing to the project. --- CONTRIBUTING.md | 19 ++++++++++++++ ContributorAgreement.txt | 56 ++++++++++++++++++++++++++++++++++++++++ README.md | 5 ++++ 3 files changed, 80 insertions(+) create mode 100644 CONTRIBUTING.md create mode 100644 ContributorAgreement.txt diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..97809c9 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,19 @@ +# How to Contribute + +We'd love to accept your patches and contributions to this project. There are +just a few small guidelines you need to follow. + +## Contributor License Agreement + +Contributions to this project must be accompanied by a signed +[Contributor Agreement](ContributorAgreement.txt). +You (or your employer) retain the copyright to your contribution, +this simply gives us permission to use and redistribute your contributions as +part of the project. + +## Code reviews + +All submissions, including submissions by project members, require review. We +use GitHub pull requests for this purpose. Consult +[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more +information on using pull requests. diff --git a/ContributorAgreement.txt b/ContributorAgreement.txt new file mode 100644 index 0000000..b9aafab --- /dev/null +++ b/ContributorAgreement.txt @@ -0,0 +1,56 @@ +Contributor Agreement + +Version 1.1 + +Contributions to this software are accepted only when they are +properly accompanied by a Contributor Agreement. The Contributor +Agreement for this software is the Developer's Certificate of Origin +1.1 (DCO) as provided with and required for accepting contributions +to the Linux kernel. + +In each contribution proposed to be included in this software, the +developer must include a "sign-off" that denotes consent to the +terms of the Developer's Certificate of Origin. The sign-off is +a line of text in the description that accompanies the change, +certifying that you have the right to provide the contribution +to be included. For changes provided in source code control (for +example, via a Git pull request) the sign-off must be included in +the commit message in source code control. For changes provided +in email or issue tracking, the sign-off must be included in the +email or the issue, and the sign-off will be incorporated into the +permanent commit message if the contribution is accepted into the +official source code. + +If you can certify the below: + + Developer's Certificate of Origin 1.1 + + By making a contribution to this project, I certify that: + + (a) The contribution was created in whole or in part by me and I + have the right to submit it under the open source license + indicated in the file; or + + (b) The contribution is based upon previous work that, to the best + of my knowledge, is covered under an appropriate open source + license and I have the right under that license to submit that + work with modifications, whether created in whole or in part + by me, under the same open source license (unless I am + permitted to submit under a different license), as indicated + in the file; or + + (c) The contribution was provided directly to me by some other + person who certified (a), (b) or (c) and I have not modified + it. + + (d) I understand and agree that this project and the contribution + are public and that a record of the contribution (including all + personal information I submit with it, including my sign-off) is + maintained indefinitely and may be redistributed consistent with + this project or the open source license(s) involved. + +then you just add a line saying + + Signed-off-by: Random J Developer + +using your real name (sorry, no pseudonyms or anonymous contributions.) diff --git a/README.md b/README.md index 3927af7..235f8fc 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,11 @@ The following issues are known and may impact the expected usage or performance * SAS Viya 3.5 supports Linux on Power on a limited availability basis. The SAS Viya ARK tools do not support Linux on Power in the Viya35-ark-1.0 release. * Viya ARK Pre-Install Playbook SSL check play may fail to complete if multiple sets of SSL configuration files exist. The playbook will not fail, but subsequent tasks related to SSL Certificate check will be skipped. Workaround the issue by ensuring only one configuration file specifying ``SSLCertificateFile`` exist under ``/etc/[httpd|apache2]`` root directory. +## Contributing +We welcome your contributions! Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to submit contributions to this project. + +This project is in maintenance mode. If you have an enhancement request you will need to submit a contribution for consideration. + ## License This project is licensed under the [Apache 2.0 License](LICENSE). \ No newline at end of file From bf3ef55e0b55b918191465846525ca53db5867d5 Mon Sep 17 00:00:00 2001 From: Kevin Lingle Date: Tue, 12 Sep 2023 11:45:43 -0400 Subject: [PATCH 4/6] review comment --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 235f8fc..59b03e2 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ The following issues are known and may impact the expected usage or performance ## Contributing We welcome your contributions! Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to submit contributions to this project. -This project is in maintenance mode. If you have an enhancement request you will need to submit a contribution for consideration. +This project is in maintenance mode. If you have an enhancement request you will need to submit a contribution for consideration. ## License From 450e45fd64e3419317c9d954863644adcd62831c Mon Sep 17 00:00:00 2001 From: Venkata Jangala Date: Wed, 1 Nov 2023 10:05:19 -0400 Subject: [PATCH 5/6] fix: Merge-playbook incorrectly updates vars.yml when adding on CPS (DEPENBDAT-3068) --- .../merge-viya-deployment-files.yml | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/playbooks/merge-playbook/merge-viya-deployment-files.yml b/playbooks/merge-playbook/merge-viya-deployment-files.yml index 69d7e51..ca7734e 100644 --- a/playbooks/merge-playbook/merge-viya-deployment-files.yml +++ b/playbooks/merge-playbook/merge-viya-deployment-files.yml @@ -661,7 +661,30 @@ SANMOUNT: '{{ "{{ SAS_CONFIG_ROOT }}/data/sasdatasvrc" }}' SERVICE_NAME: cpspostgres when: cps_invocation|length > 0 and cpspostgres_props_exist.changed == False and ha_properties_exist.changed == True and merge_default_host is defined and perms_override_property_exists.changed == True - + + # case 3-2-3 For 19w43 to 23w44 adding cps + - name: Move CommonPlanningService Invocation variables to INVOCATION_VARIABLES + blockinfile: + path: "{{ merged_vars_yml }}" + insertafter: "{{ merge_default_host }}:" + block: |3 + cpsdatasvrc: + - NODE_NUMBER: '0' + PG_PORT: '5442' + SANMOUNT: '{{ "{{ SAS_CONFIG_ROOT }}/data/sasdatasvrc" }}' + SERVICE_NAME: cpspostgres + cpspgpoolc: + - HA_PGPOOL_VIRTUAL_IP: '' + HA_PGPOOL_WATCHDOG_PORT: '' + HA_PGPOOL_HEARTBEAT_PORT: '' + PERMS_OVERRIDE: 'false' + POOL_NUMBER: '0' + PCP_PORT: '5440' + PGPOOL_PORT: '5441' + SANMOUNT: '{{ "{{ SAS_CONFIG_ROOT }}/data/sasdatasvrc" }}' + SERVICE_NAME: cpspostgres + when: cps_invocation|length > 0 and cpspostgres_props_exist.changed == False and merge_default_host is defined and curr_pgpool_heartbeat_property_exists.changed == False and ha_properties_exist.changed == True + - name: Check whether the NODE_TYPE property exists in the merged vars.yml lineinfile: path: "{{ merged_vars_yml }}" From f9de7ae2e021a2bee1de246686798633a3c4b4f6 Mon Sep 17 00:00:00 2001 From: Kevin Lingle <36995745+kevinlinglesas@users.noreply.github.com> Date: Wed, 1 Nov 2023 11:42:12 -0400 Subject: [PATCH 6/6] chore: updated copyright --- playbooks/merge-playbook/merge-viya-deployment-files.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/playbooks/merge-playbook/merge-viya-deployment-files.yml b/playbooks/merge-playbook/merge-viya-deployment-files.yml index ca7734e..c12523a 100644 --- a/playbooks/merge-playbook/merge-viya-deployment-files.yml +++ b/playbooks/merge-playbook/merge-viya-deployment-files.yml @@ -34,7 +34,7 @@ # Optional: The default_host can be designated for newly created host groups. Run: # -e "merge_default_host=deployTarget" # -# Copyright (c) 2019-2020, SAS Institute Inc., Cary, NC, USA. All Rights Reserved. +# Copyright (c) 2019-2023, SAS Institute Inc., Cary, NC, USA. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 # ####################################################################