[live-images] Automatically populate release with date and respin
This is the same feature that is already available for image-build and live-media. Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
ec03a8685a
commit
7c81c5aa9c
@ -92,6 +92,12 @@ class LiveImagesPhase(PhaseBase):
|
|||||||
|
|
||||||
return repo
|
return repo
|
||||||
|
|
||||||
|
def _get_release(self, image_conf):
|
||||||
|
"""If release is set explicitly to None, replace it with date and respin."""
|
||||||
|
if 'release' in image_conf and image_conf['release'] is None:
|
||||||
|
return '%s.%s' % (self.compose.compose_date, self.compose.compose_respin)
|
||||||
|
return image_conf.get('release', None)
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
symlink_isos_to = self.compose.conf.get("symlink_isos_to", None)
|
symlink_isos_to = self.compose.conf.get("symlink_isos_to", None)
|
||||||
commands = []
|
commands = []
|
||||||
@ -134,6 +140,7 @@ class LiveImagesPhase(PhaseBase):
|
|||||||
cmd["version"] = data.get("version", None)
|
cmd["version"] = data.get("version", None)
|
||||||
|
|
||||||
cmd['type'] = data.get('type', 'live')
|
cmd['type'] = data.get('type', 'live')
|
||||||
|
cmd['release'] = self._get_release(data)
|
||||||
|
|
||||||
# Specfile (for images wrapped in rpm)
|
# Specfile (for images wrapped in rpm)
|
||||||
cmd["specfile"] = data.get("specfile", None)
|
cmd["specfile"] = data.get("specfile", None)
|
||||||
@ -223,6 +230,7 @@ class CreateLiveImageThread(WorkerThread):
|
|||||||
wait=True,
|
wait=True,
|
||||||
archive=archive,
|
archive=archive,
|
||||||
specfile=cmd["specfile"],
|
specfile=cmd["specfile"],
|
||||||
|
release=cmd['release'],
|
||||||
ksurl=cmd['ksurl'])
|
ksurl=cmd['ksurl'])
|
||||||
|
|
||||||
# avoid race conditions?
|
# avoid race conditions?
|
||||||
|
@ -17,6 +17,8 @@ from pungi.util import get_arch_variant_data
|
|||||||
class _DummyCompose(object):
|
class _DummyCompose(object):
|
||||||
def __init__(self, config):
|
def __init__(self, config):
|
||||||
self.compose_id = 'Test-20151203.0.t'
|
self.compose_id = 'Test-20151203.0.t'
|
||||||
|
self.compose_date = '20151203'
|
||||||
|
self.compose_respin = '0'
|
||||||
self.conf = config
|
self.conf = config
|
||||||
self.paths = mock.Mock(
|
self.paths = mock.Mock(
|
||||||
compose=mock.Mock(
|
compose=mock.Mock(
|
||||||
@ -69,6 +71,7 @@ class TestLiveImagesPhase(unittest.TestCase):
|
|||||||
'kickstart': 'test.ks',
|
'kickstart': 'test.ks',
|
||||||
'additional_repos': ['http://example.com/repo/'],
|
'additional_repos': ['http://example.com/repo/'],
|
||||||
'repos_from': ['Everything'],
|
'repos_from': ['Everything'],
|
||||||
|
'release': None,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
@ -97,6 +100,7 @@ class TestLiveImagesPhase(unittest.TestCase):
|
|||||||
'specfile': None,
|
'specfile': None,
|
||||||
'sign': False,
|
'sign': False,
|
||||||
'type': 'live',
|
'type': 'live',
|
||||||
|
'release': '20151203.0',
|
||||||
'ksurl': None},
|
'ksurl': None},
|
||||||
compose.variants['Client'],
|
compose.variants['Client'],
|
||||||
'amd64'))])
|
'amd64'))])
|
||||||
@ -142,6 +146,7 @@ class TestLiveImagesPhase(unittest.TestCase):
|
|||||||
'specfile': None,
|
'specfile': None,
|
||||||
'sign': False,
|
'sign': False,
|
||||||
'type': 'live',
|
'type': 'live',
|
||||||
|
'release': None,
|
||||||
'ksurl': None},
|
'ksurl': None},
|
||||||
compose.variants['Client'],
|
compose.variants['Client'],
|
||||||
'amd64')),
|
'amd64')),
|
||||||
@ -160,6 +165,7 @@ class TestLiveImagesPhase(unittest.TestCase):
|
|||||||
'specfile': None,
|
'specfile': None,
|
||||||
'sign': False,
|
'sign': False,
|
||||||
'type': 'live',
|
'type': 'live',
|
||||||
|
'release': None,
|
||||||
'ksurl': None},
|
'ksurl': None},
|
||||||
compose.variants['Client'],
|
compose.variants['Client'],
|
||||||
'amd64'))])
|
'amd64'))])
|
||||||
@ -206,6 +212,7 @@ class TestLiveImagesPhase(unittest.TestCase):
|
|||||||
'specfile': None,
|
'specfile': None,
|
||||||
'sign': False,
|
'sign': False,
|
||||||
'type': 'appliance',
|
'type': 'appliance',
|
||||||
|
'release': None,
|
||||||
'ksurl': 'https://git.example.com/kickstarts.git?#CAFEBABE'},
|
'ksurl': 'https://git.example.com/kickstarts.git?#CAFEBABE'},
|
||||||
compose.variants['Client'],
|
compose.variants['Client'],
|
||||||
'amd64'))])
|
'amd64'))])
|
||||||
@ -236,6 +243,7 @@ class TestCreateLiveImageThread(unittest.TestCase):
|
|||||||
'specfile': None,
|
'specfile': None,
|
||||||
'type': 'live',
|
'type': 'live',
|
||||||
'ksurl': 'https://git.example.com/kickstarts.git?#CAFEBABE',
|
'ksurl': 'https://git.example.com/kickstarts.git?#CAFEBABE',
|
||||||
|
'release': None,
|
||||||
}
|
}
|
||||||
|
|
||||||
koji_wrapper = KojiWrapper.return_value
|
koji_wrapper = KojiWrapper.return_value
|
||||||
@ -272,6 +280,7 @@ class TestCreateLiveImageThread(unittest.TestCase):
|
|||||||
archive=False,
|
archive=False,
|
||||||
specfile=None,
|
specfile=None,
|
||||||
wait=True,
|
wait=True,
|
||||||
|
release=None,
|
||||||
ksurl='https://git.example.com/kickstarts.git?#CAFEBABE')])
|
ksurl='https://git.example.com/kickstarts.git?#CAFEBABE')])
|
||||||
|
|
||||||
@mock.patch('shutil.copy2')
|
@mock.patch('shutil.copy2')
|
||||||
@ -295,6 +304,7 @@ class TestCreateLiveImageThread(unittest.TestCase):
|
|||||||
'specfile': None,
|
'specfile': None,
|
||||||
'type': 'appliance',
|
'type': 'appliance',
|
||||||
'ksurl': None,
|
'ksurl': None,
|
||||||
|
'release': None,
|
||||||
}
|
}
|
||||||
|
|
||||||
koji_wrapper = KojiWrapper.return_value
|
koji_wrapper = KojiWrapper.return_value
|
||||||
@ -331,6 +341,7 @@ class TestCreateLiveImageThread(unittest.TestCase):
|
|||||||
archive=False,
|
archive=False,
|
||||||
specfile=None,
|
specfile=None,
|
||||||
wait=True,
|
wait=True,
|
||||||
|
release=None,
|
||||||
ksurl=None)])
|
ksurl=None)])
|
||||||
|
|
||||||
@mock.patch('shutil.copy2')
|
@mock.patch('shutil.copy2')
|
||||||
|
Loading…
Reference in New Issue
Block a user