Add check for Dogtag present before start backup
If Dogtag backup enabled, but service itself is not installed (for example,
used different barbican backedn) raise warning, skip Dogtag and keep going
backup.
Change-Id: Ib933c8755c46edc849ab56fd3ab75f5eae8b50d4
Related-Prod: PROD-33937
diff --git a/backupninja-backup-pipeline.groovy b/backupninja-backup-pipeline.groovy
index 6dbd540..ad8b916 100644
--- a/backupninja-backup-pipeline.groovy
+++ b/backupninja-backup-pipeline.groovy
@@ -60,16 +60,22 @@
}
}
if (backupDogtag) {
- try {
- def dogtagPillar = salt.getPillar(pepperEnv, "I@dogtag:server", "dogtag:server").get('return')[0].values()[0]
- if (dogtagPillar.isEmpty()) {
- throw new Exception("Problem with dogtag pillar on I@dogtag:server node.")
+ def barbicanBackendPresent = salt.getPillar(pepperEnv, "I@salt:master", "_param:barbican_backend").get('return')[0].values()[0]
+ if (barbicanBackendPresent == 'dogtag') {
+ try {
+ def dogtagPillar = salt.getPillar(pepperEnv, "I@dogtag:server", "dogtag:server").get('return')[0].values()[0]
+ if (dogtagPillar.isEmpty()) {
+ throw new Exception("Problem with dogtag pillar on I@dogtag:server node.")
+ }
}
- }
- catch (Exception e) {
- common.errorMsg(e.getMessage())
- common.errorMsg("Looks like dogtag pillar is not defined. Fix your pillar or disable dogtag backup by setting the BACKUP_DOGTAG parameter to False if you're using different barbican backend.")
- throw e
+ catch (Exception e) {
+ common.errorMsg(e.getMessage())
+ common.errorMsg("Looks like dogtag pillar is not defined. Fix your pillar or disable dogtag backup by setting the BACKUP_DOGTAG parameter to False if you're using different barbican backend.")
+ throw e
+ }
+ } else {
+ backupDogtag = false
+ common.warningMsg('Backup for Dogtag is enabled, but service itself is not present. Skipping...')
}
}
}