Skip to content
This repository has been archived by the owner on Jan 5, 2023. It is now read-only.

Commit

Permalink
*: Prevented unit's Contents modification
Browse files Browse the repository at this point in the history
Resolves coreos#1514

The problem was caused by the [code optimization](coreos#1376). Before that each unit was stored in its own variable. Then this code was optimized and units became stored in hash map (`getAllUnitsHashMap`). Each hash was assigned to the unit's pointer. And when template unit was checked by `requirements()` function, its content was modified by `values[i] = unitPrintf(v, *uni)` code. Once templated unit was modified, all related units (which have same hash) were modified too, because they are related to one pointer.
  • Loading branch information
kayrus authored and hectorj2f committed Apr 6, 2016
1 parent 28f3347 commit 3145dbc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions job/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,14 @@ func (j *Job) requirements() map[string][]string {
}

if uni != nil {
processedValues := make([]string, len(values))
for i, v := range values {
values[i] = unitPrintf(v, *uni)
processedValues[i] = unitPrintf(v, *uni)
}
requirements[key] = processedValues
} else {
requirements[key] = values
}
requirements[key] = values
}

return requirements
Expand Down

0 comments on commit 3145dbc

Please sign in to comment.