Skip to content

Commit

Permalink
BEE-41099 Fixed issue with set job step status in the overwrite mode …
Browse files Browse the repository at this point in the history
…during DSL evaluation (#107)
  • Loading branch information
karakurty authored Oct 6, 2023
1 parent d98808d commit 7ad7e8a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
2023-09.15 Valera Fessler <[email protected]>
* 4.2.2: BEE-39599 - Fixed test "overwrite_installDslFromDirectory.deploy persona, personaPage, personaCategory, user, group" due to changes in BEE-38177
BEE-41099 - Fixed issue with set job step status in the overwrite mode during DSL evaluation

2023-07.04 Valera Fessler <[email protected]>
* 4.2.1: BEE-35400 - Fixed issue with import environment reservations
Expand Down
31 changes: 23 additions & 8 deletions dsl/com/electriccloud/commander/dsl/util/BaseObject.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ abstract class BaseObject extends DslDelegatingScript {
if (dslFile.name ==~ /(?i)${objType}\.(groovy|dsl)/) {
if (found) {
println "Multiple files match the ${objType}.groovy or ${objType}.dsl"
setProperty(propertyName: "outcome", value: "warning")
setWarningStatus()
}
found = dslFile
} else {
println "Ignoring incorrect file ${dslFile.name} in ${objDir.name}"
setProperty(propertyName: "outcome", value: "warning")
setWarningStatus()
}
}
}
Expand Down Expand Up @@ -178,7 +178,6 @@ abstract class BaseObject extends DslDelegatingScript {
// println " excludeObjects : $excludeObjects"
// println " changeList : $changeList"


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

try {
Expand Down Expand Up @@ -319,7 +318,6 @@ abstract class BaseObject extends DslDelegatingScript {
loaded = true
}


// skip overwrite mode for parent object when
// handle children
if (bindingMap.get('skipOverwrite') == null) {
Expand Down Expand Up @@ -414,7 +412,6 @@ abstract class BaseObject extends DslDelegatingScript {
return loaded
} // loadObjects


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


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

Expand All @@ -627,6 +623,25 @@ abstract class BaseObject extends DslDelegatingScript {
}
}

// Set warning status for the current job step ignoring overwrite mode
def setWarningStatus()
{
// Ignore overwrite mode
if (bindingMap.get('skipOverwrite') == null) {
bindingMap.put('skipOverwrite', new HashSet<String>())
}

((Set<String>) bindingMap.get('skipOverwrite')).add('property')
((Set<String>) bindingMap.get('skipOverwrite')).add('setProperty')

try {
setProperty(propertyName: "outcome", value: "warning")
} finally {
((Set<String>) bindingMap.get('skipOverwrite')).remove('property')
((Set<String>) bindingMap.get('skipOverwrite')).remove('setProperty')
}
}

/**
* NMB-27865: Intercept the DslDelegate
* so it can be set as the delegate on the
Expand Down
1 change: 1 addition & 0 deletions help/help.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ NOTE: If the commit ID cannot be found or if the procedure or steps cannot find,
=== EC-DslDeploy 4.2.2

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

=== EC-DslDeploy 4.2.1

Expand Down

0 comments on commit 7ad7e8a

Please sign in to comment.