[artifactory-replication] Fix command line parameters generator function (check/clean cases)
PRODX-26142
Change-Id: I13cf0eb36334d8a52f71470cefb0d91adfde89a2
diff --git a/src/com/mirantis/mk/KaasUtils.groovy b/src/com/mirantis/mk/KaasUtils.groovy
index 0bff92d..f4ab9cf 100644
--- a/src/com/mirantis/mk/KaasUtils.groovy
+++ b/src/com/mirantis/mk/KaasUtils.groovy
@@ -1186,15 +1186,16 @@
'SYNC_PATTERN': '-sync-pattern'
]
def cmdParams = ''
+ def isCheckClean = false
for (e in envToParam) {
if (env[e.key] == null) {
continue
}
if (e.key == 'CHECK_REPOS' || e.key == 'DOCKER_CLEAN') {
- if (env[e.key].toBoolean()) {
+ // Avoid CHECK_REPOS=true and DOCKER_CLEAN=true
+ if (env[e.key].toBoolean() && !isCheckClean) {
cmdParams += e.value + ' '
- } else {
- cmdParams += '-replicate '
+ isCheckClean = true
}
} else if (e.key == 'FORCE') {
if (env[e.key].toBoolean()) {
@@ -1204,5 +1205,9 @@
cmdParams += "${e.value} '${env[e.key]}' "
}
}
+ // No any check or clean was specified - take a default action
+ if (!isCheckClean) {
+ cmdParams += '-replicate'
+ }
return cmdParams
}