Repository: chef/automate
Pull request #8514 (2024-07-27 03:59:16)

pipeline fix
### :nut_and_bolt: Description: What code changed, and why?

<!-- /!\ Please ensure that you are NOT disclosing any customer information without their consent /!\ -->

### :chains: Related Resources

### :+1: Definition of Done

### :athletic_shoe: How to Build and Test the Change

### :white_check_mark: Checklist

**All PRs** must tick these:

- [ ] I have read the [CONTRIBUTING document](https://github.com/chef/automate/blob/master/CONTRIBUTING.md).
- [ ] All commits signed-off for the [Developer Certification of Origin](https://github.com/chef/chef/blob/master/CONTRIBUTING.md#developer-certification-of-origin-dco).

With occasional exceptions, all PRs **from Progress employees** must tick these:

- [ ] Is the code clear? *(complicated code or lots of comments--subdivide and use well-named methods, meaningful variable names, etc.)*
- [ ] Consistency checked? *(user notifications, user prompts, visual patterns, code patterns, variable names)*
- [ ] Repeated code blocks eliminated? *(adapt and reuse existing components, blocks, functions, etc.)*
- [ ] Spelling, grammar, typos checked? *(at a minimum use `make spell` in any component directory)*
- [ ] Code well-formatted? *(indents, line breaks, etc. improve rather than hinder readability)*

All PRs **from Progress employees** should tick these if appropriate:

- [ ] Tests added/updated? (all new code needs new tests)
- [ ] Docs added/updated? (all customer-facing changes)

*Please add a note next to any checkbox above if you are NOT ticking it.*

### :camera: Screenshots, if applicable


netlify[bot]: ### <span aria-hidden="true">👷</span> Deploy Preview for *chef-automate* processing.


|  Name | Link |
|:-:|------------------------|
|<span aria-hidden="true">🔨</span> Latest commit | 8dcfc314a98628330268e9ec5d1be8e47750a259 |
|<span aria-hidden="true">🔍</span> Latest deploy log | https://app.netlify.com/sites/chef-automate/deploys/66a470967863640008203964 |
sonarqube-for-infrastructure-prod[bot]: ## [![Quality Gate passed](https://raw.githubusercontent.com/SonarSource/sonarqube-static-resources/master/v104/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonar.progress.com/dashboard?id=chef_automate_AYeOVEbqJ4YHsO5MtKWC&pullRequest=8514) **Quality Gate passed**  
Issues  
[![](https://raw.githubusercontent.com/SonarSource/sonarqube-static-resources/master/v104/common/passed-16px.png '')](https://sonar.progress.com/project/issues?id=chef_automate_AYeOVEbqJ4YHsO5MtKWC&pullRequest=8514&resolved=false) [0 New issues](https://sonar.progress.com/project/issues?id=chef_automate_AYeOVEbqJ4YHsO5MtKWC&pullRequest=8514&resolved=false)  
[![](https://raw.githubusercontent.com/SonarSource/sonarqube-static-resources/master/v104/common/fixed-16px.png '')](https://sonar.progress.com/project/issues?id=chef_automate_AYeOVEbqJ4YHsO5MtKWC&fixedInPullRequest=8514) [0 Fixed issues](https://sonar.progress.com/project/issues?id=chef_automate_AYeOVEbqJ4YHsO5MtKWC&fixedInPullRequest=8514)  
[![](https://raw.githubusercontent.com/SonarSource/sonarqube-static-resources/master/v104/common/accepted-16px.png '')](https://sonar.progress.com/project/issues?id=chef_automate_AYeOVEbqJ4YHsO5MtKWC&pullRequest=8514&issueStatuses=ACCEPTED) [0 Accepted issues](https://sonar.progress.com/project/issues?id=chef_automate_AYeOVEbqJ4YHsO5MtKWC&pullRequest=8514&issueStatuses=ACCEPTED)

Measures  
[![](https://raw.githubusercontent.com/SonarSource/sonarqube-static-resources/master/v104/common/passed-16px.png '')](https://sonar.progress.com/security_hotspots?id=chef_automate_AYeOVEbqJ4YHsO5MtKWC&pullRequest=8514) [0 Security Hotspots](https://sonar.progress.com/security_hotspots?id=chef_automate_AYeOVEbqJ4YHsO5MtKWC&pullRequest=8514)  
![](https://raw.githubusercontent.com/SonarSource/sonarqube-static-resources/master/v104/common/no-data-16px.png '') No data about Coverage  
![](https://raw.githubusercontent.com/SonarSource/sonarqube-static-resources/master/v104/common/no-data-16px.png '') No data about Duplication  
  
[See analysis details on SonarQube](https://sonar.progress.com/dashboard?id=chef_automate_AYeOVEbqJ4YHsO5MtKWC&pullRequest=8514)


sonarqube-for-infrastructure-prod[bot]: ## [![Quality Gate passed](https://raw.githubusercontent.com/SonarSource/sonarqube-static-resources/master/v104/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonar.progress.com/dashboard?id=chef_automate_AYeOVEbqJ4YHsO5MtKWC&pullRequest=8514) **Quality Gate passed**  
Issues  
[![](https://raw.githubusercontent.com/SonarSource/sonarqube-static-resources/master/v104/common/passed-16px.png '')](https://sonar.progress.com/project/issues?id=chef_automate_AYeOVEbqJ4YHsO5MtKWC&pullRequest=8514&resolved=false) [0 New issues](https://sonar.progress.com/project/issues?id=chef_automate_AYeOVEbqJ4YHsO5MtKWC&pullRequest=8514&resolved=false)  
[![](https://raw.githubusercontent.com/SonarSource/sonarqube-static-resources/master/v104/common/fixed-16px.png '')](https://sonar.progress.com/project/issues?id=chef_automate_AYeOVEbqJ4YHsO5MtKWC&fixedInPullRequest=8514) [1 Fixed issue](https://sonar.progress.com/project/issues?id=chef_automate_AYeOVEbqJ4YHsO5MtKWC&fixedInPullRequest=8514)  
[![](https://raw.githubusercontent.com/SonarSource/sonarqube-static-resources/master/v104/common/accepted-16px.png '')](https://sonar.progress.com/project/issues?id=chef_automate_AYeOVEbqJ4YHsO5MtKWC&pullRequest=8514&issueStatuses=ACCEPTED) [0 Accepted issues](https://sonar.progress.com/project/issues?id=chef_automate_AYeOVEbqJ4YHsO5MtKWC&pullRequest=8514&issueStatuses=ACCEPTED)

Measures  
[![](https://raw.githubusercontent.com/SonarSource/sonarqube-static-resources/master/v104/common/passed-16px.png '')](https://sonar.progress.com/security_hotspots?id=chef_automate_AYeOVEbqJ4YHsO5MtKWC&pullRequest=8514) [0 Security Hotspots](https://sonar.progress.com/security_hotspots?id=chef_automate_AYeOVEbqJ4YHsO5MtKWC&pullRequest=8514)  
![](https://raw.githubusercontent.com/SonarSource/sonarqube-static-resources/master/v104/common/no-data-16px.png '') No data about Coverage  
![](https://raw.githubusercontent.com/SonarSource/sonarqube-static-resources/master/v104/common/no-data-16px.png '') No data about Duplication  
  
[See analysis details on SonarQube](https://sonar.progress.com/dashboard?id=chef_automate_AYeOVEbqJ4YHsO5MtKWC&pullRequest=8514)



Patch:
diff --git a/components/automate-backend-deployment/README.md b/components/automate-backend-deployment/README.md
index 9f52eb920..e2e452a4b 100644
--- a/components/automate-backend-deployment/README.md
+++ b/components/automate-backend-deployment/README.md
@@ -6,3 +6,4 @@ This provides the `automate-backend-deployment` package.
 This package will build a package using terraform/a2ha-terraform, inspecs, test, certs and Makefile.
 
 This is the heart of the a2ha because this component will set up a workspace for a2ha and all the a2ha command will get available after installing this package.
+
diff --git a/components/automate-cli/cmd/chef-automate/certRotateFromTemplate.go b/components/automate-cli/cmd/chef-automate/certRotateFromTemplate.go
index b0a6f24c3..cb60020d8 100644
--- a/components/automate-cli/cmd/chef-automate/certRotateFromTemplate.go
+++ b/components/automate-cli/cmd/chef-automate/certRotateFromTemplate.go
@@ -119,8 +119,6 @@ func (c *certRotateFlow) handleTemplateCertificateRotation(templateCerts *Certif
 				return err
 			}
 			filterIps = append(filterIps, csIp)
-		} else {
-
 		}
 
 	}
diff --git a/terraform/a2ha-terraform/modules/postgresqlconfigsync/inputs.tf b/terraform/a2ha-terraform/modules/postgresqlconfigsync/inputs.tf
index 2048b8193..cb5c40945 100644
--- a/terraform/a2ha-terraform/modules/postgresqlconfigsync/inputs.tf
+++ b/terraform/a2ha-terraform/modules/postgresqlconfigsync/inputs.tf
@@ -1,3 +1,13 @@
+variable "pgleaderchk_listen_port" {
+  default = 6432
+}
+
+variable "pgleaderchk_pkg_ident" {
+}
+
+variable "pgleaderchk_svc_load_args" {
+}
+
 variable "postgresql_certs_by_ip" {
   type    = map(map(string))
   default = {}
@@ -11,22 +21,13 @@ variable "postgresql_listen_port" {
   default = 5432
 }
 
-variable "pgleaderchk_listen_port" {
-  default = 6432
-}
-
-variable "pgleaderchk_pkg_ident" {
-}
-
-variable "pgleaderchk_svc_load_args" {
-}
-
 variable "postgresql_pkg_ident" {
 }
 
 
 variable "postgresql_svc_load_args" {
 }
+
 variable "private_ips" {
   default = []
 }
@@ -65,4 +66,4 @@ variable "sudo_cmd" {
 
 variable "tmp_path" {
   default = "/hab/var/automate-ha"
-}
+}
\ No newline at end of file


Test patch:
diff --git a/components/automate-cli/cmd/chef-automate/certRotate_test.go b/components/automate-cli/cmd/chef-automate/certRotate_test.go
index 707aa7fd1..086afee2e 100644
--- a/components/automate-cli/cmd/chef-automate/certRotate_test.go
+++ b/components/automate-cli/cmd/chef-automate/certRotate_test.go
@@ -6,6 +6,7 @@ import (
 	"os"
 	"path/filepath"
 	"sort"
+	"strings"
 	"testing"
 	"time"
 
@@ -3113,7 +3114,19 @@ func TestCertRotateFromTemplate(t *testing.T) {
 
 	for _, testCase := range testCases {
 		t.Run(testCase.description, func(t *testing.T) {
-			c := certRotateFlow{fileUtils: &fileutils.FileSystemUtils{},
+			c := certRotateFlow{fileUtils: &fileutils.MockFileSystemUtils{
+				ReadFileFunc: func(filepath string) ([]byte, error) {
+					if strings.Contains(filepath, "a2ha_manifest.auto.tfvars") {
+						return []byte(`elasticsidecar_pkg_ident = "chef/automate-ha-elasticsidecar/0.1.0/20240725174312"
+	proxy_pkg_ident = "chef/automate-ha-haproxy/2.2.14/20240725171322"
+	opensearch_pkg_ident = "chef/automate-ha-opensearch/1.3.14/20240725173732"
+	pgleaderchk_pkg_ident = "chef/automate-ha-pgleaderchk/0.1.0/20240725172920"
+	postgresql_pkg_ident = "chef/automate-ha-postgresql/13.14.0/20240725171322"`), nil
+					}
+					fu := fileutils.FileSystemUtils{}
+					return fu.ReadFile(filepath)
+				},
+			},
 				sshUtil: testCase.MockSSHUtil,
 				writer:  getMockWriterImpl(), log: log}
 			output := c.certRotateFromTemplate(testCase.certFileName, testCase.sshutil, testCase.inf, testCase.currentCertsInfo, testCase.statusSummary, false, 0, &certRotateFlags{})