Tweaks for backupninja-backup pipe regarding input messages

	- add confirmation to first input message
	- only check for psql package if maas is defined

Related: PROD-32408

Change-Id: I5d7e089d9b595240251f46214b376247c922d3d0
diff --git a/backupninja-backup-pipeline.groovy b/backupninja-backup-pipeline.groovy
index 58254f3..0ec6409 100644
--- a/backupninja-backup-pipeline.groovy
+++ b/backupninja-backup-pipeline.groovy
@@ -40,23 +40,31 @@
                 return
             }
 
-            def postgresqlMajorVersion = salt.getPillar(pepperEnv, 'I@salt:master', '_param:postgresql_major_version').get('return')[0].values()[0]
-            if (! postgresqlMajorVersion) {
-                input message: "Can't get _param:postgresql_major_version parameter, which is required to determine postgresql-client version. Is it defined in pillar? Confirm to proceed anyway."
-            } else {
-                def postgresqlClientPackage = "postgresql-client-${postgresqlMajorVersion}"
-                try {
-                    if (!salt.isPackageInstalled(['saltId': pepperEnv, 'target': backupNode, 'packageName': postgresqlClientPackage, 'output': false])) {
+            def maasNodes = salt.getMinions(pepperEnv, 'I@maas:server')
+            if (!maasNodes.isEmpty()) {
+                def postgresqlMajorVersion = salt.getPillar(pepperEnv, 'I@salt:master', '_param:postgresql_major_version').get('return')[0].values()[0]
+                if (! postgresqlMajorVersion) {
+                        common.errorMsg("Can't get _param:postgresql_major_version parameter, which is required to determine postgresql-client version. Is it defined in pillar?")
                         if (askConfirmation) {
-                            input message: "Do you want to install ${postgresqlClientPackage} package on targeted nodes: ${backupNode}? It's required to make backup. Click to confirm"
+                            input message: "Confirm to proceed anyway."
                         }
-                        // update also common fake package
-                        salt.runSaltProcessStep(pepperEnv, backupNode, 'pkg.install', ["postgresql-client,${postgresqlClientPackage}"])
-                    }
-                } catch (Exception e) {
-                    common.errorMsg("Unable to determine status of ${postgresqlClientPackage} packages on target nodes: ${backupNode}.")
-                    if (askConfirmation) {
-                        input message: "Do you want to continue? Click to confirm"
+                } else {
+                    def postgresqlClientPackage = "postgresql-client-${postgresqlMajorVersion}"
+                    try {
+                        if (!salt.isPackageInstalled(['saltId': pepperEnv, 'target': backupNode, 'packageName': postgresqlClientPackage, 'output': false])) {
+                            if (askConfirmation) {
+                                input message: "Do you want to install ${postgresqlClientPackages} package on targeted nodes: ${backupNode}? It's required to make backup. Click to confirm."
+                            } else {
+                                common.infoMsg("Package ${postgresqlClientPackages} will be installed. It's required to make backup.")
+                            }
+                            // update also common fake package
+                            salt.runSaltProcessStep(pepperEnv, backupNode, 'pkg.install', ["postgresql-client,${postgresqlClientPackage}"])
+                        }
+                    } catch (Exception e) {
+                        common.errorMsg("Unable to determine status of ${postgresqlClientPackages} packages on target nodes: ${backupNode}.")
+                        if (askConfirmation) {
+                            input message: "Do you want to continue? Click to confirm"
+                        }
                     }
                 }
             }