Skip to content

Commit b94f7b8

Browse files
authored
[GetTemplate] - Deep copy maps in constructor
* Deep copy maps in GetTemplate constructor to avoid modifications of the original maps * Utils mark mapDeepCopy as NonCPS
1 parent 2b29d69 commit b94f7b8

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

src/tech/pxfd/GetTemplate.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ class GetTemplate {
1515
GetTemplate(def context, Map conatinersConf, Map podConf) {
1616
this.context = context
1717

18-
this.conatinersConf = conatinersConf
19-
this.podConf = podConf
18+
this.conatinersConf = Utils.mapDeepCopy(conatinersConf)
19+
this.podConf = Utils.mapDeepCopy(podConf)
2020
}
2121

2222
String render() {

src/tech/pxfd/Utils.groovy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class Utils {
4242
this.context.error("ERROR " + msg)
4343
}
4444

45+
@NonCPS
4546
public static final Map mapDeepCopy(Map originalMap) {
4647
return new JsonSlurper().parseText(JsonOutput.toJson(originalMap))
4748
}

0 commit comments

Comments
 (0)