util: Remove escaping spaces from volume ID
This was not configurable for users, and the default was always used, which meant no escaping. Might as well just remove the dead code. Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
add9835b56
commit
5926858b58
@ -220,7 +220,7 @@ class BuildinstallPhase(PhaseBase):
|
|||||||
os_tree = self.compose.paths.compose.os_tree(arch, variant)
|
os_tree = self.compose.paths.compose.os_tree(arch, variant)
|
||||||
# TODO: label is not used
|
# TODO: label is not used
|
||||||
label = ""
|
label = ""
|
||||||
volid = get_volid(self.compose, arch, variant, escape_spaces=False, disc_type=disc_type)
|
volid = get_volid(self.compose, arch, variant, disc_type=disc_type)
|
||||||
can_fail = self.compose.can_fail(variant, arch, 'buildinstall')
|
can_fail = self.compose.can_fail(variant, arch, 'buildinstall')
|
||||||
with failable(self.compose, can_fail, variant, arch, 'buildinstall'):
|
with failable(self.compose, can_fail, variant, arch, 'buildinstall'):
|
||||||
tweak_buildinstall(self.compose, buildinstall_dir, os_tree, arch, variant.uid, label, volid, kickstart_file)
|
tweak_buildinstall(self.compose, buildinstall_dir, os_tree, arch, variant.uid, label, volid, kickstart_file)
|
||||||
|
@ -334,7 +334,7 @@ def _apply_substitutions(compose, volid):
|
|||||||
return volid
|
return volid
|
||||||
|
|
||||||
|
|
||||||
def get_volid(compose, arch, variant=None, escape_spaces=False, disc_type=False,
|
def get_volid(compose, arch, variant=None, disc_type=False,
|
||||||
formats=None, **kwargs):
|
formats=None, **kwargs):
|
||||||
"""Get ISO volume ID for arch and variant"""
|
"""Get ISO volume ID for arch and variant"""
|
||||||
if variant and variant.type == "addon":
|
if variant and variant.type == "addon":
|
||||||
@ -397,9 +397,6 @@ def get_volid(compose, arch, variant=None, escape_spaces=False, disc_type=False,
|
|||||||
# dashes.
|
# dashes.
|
||||||
volid = re.sub(r"\W", "-", volid, flags=re.I)
|
volid = re.sub(r"\W", "-", volid, flags=re.I)
|
||||||
|
|
||||||
if volid and escape_spaces:
|
|
||||||
volid = volid.replace(" ", r"\x20")
|
|
||||||
|
|
||||||
return volid
|
return volid
|
||||||
|
|
||||||
|
|
||||||
|
@ -550,7 +550,7 @@ class TestCopyFiles(PungiTestCase):
|
|||||||
})
|
})
|
||||||
|
|
||||||
get_volid.side_effect = (
|
get_volid.side_effect = (
|
||||||
lambda compose, arch, variant, escape_spaces, disc_type: "%s.%s" % (variant.uid, arch)
|
lambda compose, arch, variant, disc_type: "%s.%s" % (variant.uid, arch)
|
||||||
)
|
)
|
||||||
get_kickstart_file.return_value = 'kickstart'
|
get_kickstart_file.return_value = 'kickstart'
|
||||||
|
|
||||||
@ -560,9 +560,9 @@ class TestCopyFiles(PungiTestCase):
|
|||||||
|
|
||||||
self.assertItemsEqual(
|
self.assertItemsEqual(
|
||||||
get_volid.mock_calls,
|
get_volid.mock_calls,
|
||||||
[mock.call(compose, 'x86_64', compose.variants['Server'], escape_spaces=False, disc_type='dvd'),
|
[mock.call(compose, 'x86_64', compose.variants['Server'], disc_type='dvd'),
|
||||||
mock.call(compose, 'amd64', compose.variants['Client'], escape_spaces=False, disc_type='dvd'),
|
mock.call(compose, 'amd64', compose.variants['Client'], disc_type='dvd'),
|
||||||
mock.call(compose, 'amd64', compose.variants['Server'], escape_spaces=False, disc_type='dvd')])
|
mock.call(compose, 'amd64', compose.variants['Server'], disc_type='dvd')])
|
||||||
self.assertItemsEqual(
|
self.assertItemsEqual(
|
||||||
tweak_buildinstall.mock_calls,
|
tweak_buildinstall.mock_calls,
|
||||||
[mock.call(compose,
|
[mock.call(compose,
|
||||||
@ -612,7 +612,7 @@ class TestCopyFiles(PungiTestCase):
|
|||||||
})
|
})
|
||||||
|
|
||||||
get_volid.side_effect = (
|
get_volid.side_effect = (
|
||||||
lambda compose, arch, variant, escape_spaces, disc_type: "%s.%s" % (variant.uid, arch)
|
lambda compose, arch, variant, disc_type: "%s.%s" % (variant.uid, arch)
|
||||||
)
|
)
|
||||||
get_kickstart_file.return_value = 'kickstart'
|
get_kickstart_file.return_value = 'kickstart'
|
||||||
|
|
||||||
@ -622,9 +622,9 @@ class TestCopyFiles(PungiTestCase):
|
|||||||
|
|
||||||
self.assertItemsEqual(
|
self.assertItemsEqual(
|
||||||
get_volid.mock_calls,
|
get_volid.mock_calls,
|
||||||
[mock.call(compose, 'x86_64', compose.variants['Server'], escape_spaces=False, disc_type='dvd'),
|
[mock.call(compose, 'x86_64', compose.variants['Server'], disc_type='dvd'),
|
||||||
mock.call(compose, 'amd64', compose.variants['Client'], escape_spaces=False, disc_type='dvd'),
|
mock.call(compose, 'amd64', compose.variants['Client'], disc_type='dvd'),
|
||||||
mock.call(compose, 'amd64', compose.variants['Server'], escape_spaces=False, disc_type='dvd')])
|
mock.call(compose, 'amd64', compose.variants['Server'], disc_type='dvd')])
|
||||||
self.assertItemsEqual(
|
self.assertItemsEqual(
|
||||||
tweak_buildinstall.mock_calls,
|
tweak_buildinstall.mock_calls,
|
||||||
[mock.call(compose,
|
[mock.call(compose,
|
||||||
@ -677,7 +677,7 @@ class TestCopyFiles(PungiTestCase):
|
|||||||
})
|
})
|
||||||
|
|
||||||
get_volid.side_effect = (
|
get_volid.side_effect = (
|
||||||
lambda compose, arch, variant, escape_spaces, disc_type: "%s.%s" % (variant.uid, arch)
|
lambda compose, arch, variant, disc_type: "%s.%s" % (variant.uid, arch)
|
||||||
)
|
)
|
||||||
get_kickstart_file.return_value = 'kickstart'
|
get_kickstart_file.return_value = 'kickstart'
|
||||||
tweak_buildinstall.side_effect = boom
|
tweak_buildinstall.side_effect = boom
|
||||||
@ -688,9 +688,9 @@ class TestCopyFiles(PungiTestCase):
|
|||||||
|
|
||||||
self.assertItemsEqual(
|
self.assertItemsEqual(
|
||||||
get_volid.mock_calls,
|
get_volid.mock_calls,
|
||||||
[mock.call(compose, 'x86_64', compose.variants['Server'], escape_spaces=False, disc_type='dvd'),
|
[mock.call(compose, 'x86_64', compose.variants['Server'], disc_type='dvd'),
|
||||||
mock.call(compose, 'amd64', compose.variants['Client'], escape_spaces=False, disc_type='dvd'),
|
mock.call(compose, 'amd64', compose.variants['Client'], disc_type='dvd'),
|
||||||
mock.call(compose, 'amd64', compose.variants['Server'], escape_spaces=False, disc_type='dvd')])
|
mock.call(compose, 'amd64', compose.variants['Server'], disc_type='dvd')])
|
||||||
self.assertItemsEqual(
|
self.assertItemsEqual(
|
||||||
tweak_buildinstall.mock_calls,
|
tweak_buildinstall.mock_calls,
|
||||||
[mock.call(compose,
|
[mock.call(compose,
|
||||||
|
@ -198,7 +198,7 @@ class TestVolumeIdGenerator(unittest.TestCase):
|
|||||||
|
|
||||||
c = compose.Compose(conf, self.tmp_dir)
|
c = compose.Compose(conf, self.tmp_dir)
|
||||||
|
|
||||||
volid = util.get_volid(c, 'x86_64', variant, escape_spaces=False, disc_type=False)
|
volid = util.get_volid(c, 'x86_64', variant, disc_type=False)
|
||||||
|
|
||||||
self.assertEqual(volid, expected)
|
self.assertEqual(volid, expected)
|
||||||
|
|
||||||
@ -234,7 +234,7 @@ class TestVolumeIdGenerator(unittest.TestCase):
|
|||||||
|
|
||||||
c = compose.Compose(conf, self.tmp_dir)
|
c = compose.Compose(conf, self.tmp_dir)
|
||||||
|
|
||||||
volid = util.get_volid(c, 'x86_64', variant, escape_spaces=False, disc_type=False)
|
volid = util.get_volid(c, 'x86_64', variant, disc_type=False)
|
||||||
|
|
||||||
self.assertEqual(volid, expected)
|
self.assertEqual(volid, expected)
|
||||||
|
|
||||||
@ -255,7 +255,7 @@ class TestVolumeIdGenerator(unittest.TestCase):
|
|||||||
c = compose.Compose(conf, self.tmp_dir)
|
c = compose.Compose(conf, self.tmp_dir)
|
||||||
|
|
||||||
with self.assertRaises(ValueError) as ctx:
|
with self.assertRaises(ValueError) as ctx:
|
||||||
util.get_volid(c, 'x86_64', variant, escape_spaces=False, disc_type=False)
|
util.get_volid(c, 'x86_64', variant, disc_type=False)
|
||||||
|
|
||||||
self.assertIn('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb', str(ctx.exception))
|
self.assertIn('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb', str(ctx.exception))
|
||||||
self.assertIn('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', str(ctx.exception))
|
self.assertIn('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', str(ctx.exception))
|
||||||
|
Loading…
Reference in New Issue
Block a user