Skip to content

Commit 7ad7e8a

Browse files
authored
BEE-41099 Fixed issue with set job step status in the overwrite mode during DSL evaluation (#107)
1 parent d98808d commit 7ad7e8a

File tree

3 files changed

+25
-8
lines changed

3 files changed

+25
-8
lines changed

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
2023-09.15 Valera Fessler <[email protected]>
22
* 4.2.2: BEE-39599 - Fixed test "overwrite_installDslFromDirectory.deploy persona, personaPage, personaCategory, user, group" due to changes in BEE-38177
3+
BEE-41099 - Fixed issue with set job step status in the overwrite mode during DSL evaluation
34

45
2023-07.04 Valera Fessler <[email protected]>
56
* 4.2.1: BEE-35400 - Fixed issue with import environment reservations

dsl/com/electriccloud/commander/dsl/util/BaseObject.groovy

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ abstract class BaseObject extends DslDelegatingScript {
6161
if (dslFile.name ==~ /(?i)${objType}\.(groovy|dsl)/) {
6262
if (found) {
6363
println "Multiple files match the ${objType}.groovy or ${objType}.dsl"
64-
setProperty(propertyName: "outcome", value: "warning")
64+
setWarningStatus()
6565
}
6666
found = dslFile
6767
} else {
6868
println "Ignoring incorrect file ${dslFile.name} in ${objDir.name}"
69-
setProperty(propertyName: "outcome", value: "warning")
69+
setWarningStatus()
7070
}
7171
}
7272
}
@@ -178,7 +178,6 @@ abstract class BaseObject extends DslDelegatingScript {
178178
// println " excludeObjects : $excludeObjects"
179179
// println " changeList : $changeList"
180180

181-
182181
def counters=[:]
183182
def nbObjs=0
184183
def plural=getPluralForm(objType)
@@ -198,7 +197,7 @@ abstract class BaseObject extends DslDelegatingScript {
198197
dir.eachDir {dlist << it }
199198
if (ORDERED_CHILD_ENTITY_TYPES.contains(plural) && dlist.size() > 1 && !metadata.order) {
200199
logger.warning('No order found in metadata.json for ordered entity type %objName. Objects will be loaded in alphabetical order.')
201-
setProperty(propertyName: "outcome", value: "warning")
200+
setWarningStatus()
202201
}
203202

204203
try {
@@ -319,7 +318,6 @@ abstract class BaseObject extends DslDelegatingScript {
319318
loaded = true
320319
}
321320

322-
323321
// skip overwrite mode for parent object when
324322
// handle children
325323
if (bindingMap.get('skipOverwrite') == null) {
@@ -414,7 +412,6 @@ abstract class BaseObject extends DslDelegatingScript {
414412
return loaded
415413
} // loadObjects
416414

417-
418415
def evalInlinePropertyDsl(String dslFile, Map bindingMap, String overwriteMode = "0") {
419416
// We should save current DSL evaluation context and restore it right after import properties
420417
def tmpCurrent
@@ -487,7 +484,6 @@ abstract class BaseObject extends DslDelegatingScript {
487484
// println " bindingMap : " + bindingMap.toMapString(250)
488485
// println " changeList : $changeList"
489486

490-
491487
aclDir.eachFileMatch(FileType.FILES, ~/(?i)^.*\.(groovy|dsl)/) { dslFile ->
492488
if (changeCheck("$objPath/acls/${dslFile.name}", changeList, ["changed", "added"])) {
493489
println " Processing ACL file $objPath/acls/${dslFile.name}"
@@ -611,7 +607,7 @@ abstract class BaseObject extends DslDelegatingScript {
611607
}
612608
} catch (Exception e) {
613609
println(String.format("Error: cannot load property %s", propPath, e.getMessage()))
614-
setProperty(propertyName: "outcome", value: "warning")
610+
setWarningStatus()
615611
}
616612
}
617613

@@ -627,6 +623,25 @@ abstract class BaseObject extends DslDelegatingScript {
627623
}
628624
}
629625

626+
// Set warning status for the current job step ignoring overwrite mode
627+
def setWarningStatus()
628+
{
629+
// Ignore overwrite mode
630+
if (bindingMap.get('skipOverwrite') == null) {
631+
bindingMap.put('skipOverwrite', new HashSet<String>())
632+
}
633+
634+
((Set<String>) bindingMap.get('skipOverwrite')).add('property')
635+
((Set<String>) bindingMap.get('skipOverwrite')).add('setProperty')
636+
637+
try {
638+
setProperty(propertyName: "outcome", value: "warning")
639+
} finally {
640+
((Set<String>) bindingMap.get('skipOverwrite')).remove('property')
641+
((Set<String>) bindingMap.get('skipOverwrite')).remove('setProperty')
642+
}
643+
}
644+
630645
/**
631646
* NMB-27865: Intercept the DslDelegate
632647
* so it can be set as the delegate on the

help/help.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ NOTE: If the commit ID cannot be found or if the procedure or steps cannot find,
369369
=== EC-DslDeploy 4.2.2
370370

371371
* Fixed test "overwrite_installDslFromDirectory.deploy persona, personaPage, personaCategory, user, group" due to changes in BEE-38177
372+
* Fixed issue with set job step status in the overwrite mode during DSL evaluation
372373

373374
=== EC-DslDeploy 4.2.1
374375

0 commit comments

Comments
 (0)