Fix image-build modifying config

The code modifies the config in place, so it only works in the first
iteration. The fix is to create a copy which can be safely modified and
next iteration will still see the original data.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2016-01-05 10:20:00 +01:00
parent a1384b60f4
commit 88bb6ac3d7
1 changed files with 6 additions and 1 deletions

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
import copy
import os
import time
@ -34,6 +34,11 @@ class ImageBuildPhase(PhaseBase):
for variant in self.compose.get_variants(arch=arch):
image_build_data = get_arch_variant_data(self.compose.conf, self.name, arch, variant)
for image_conf in image_build_data:
# We will modify the data, so we need to make a copy to
# prevent problems in next iteration where the original
# value is needed.
image_conf = copy.deepcopy(image_conf)
# Replace possible ambiguous ref name with explicit hash.
if 'ksurl' in image_conf:
image_conf['ksurl'] = resolve_git_url(image_conf['ksurl'])