From 797b13b34a7243a9ef3f14418294567a28990049 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Tue, 19 Sep 2017 09:59:23 +0200 Subject: [PATCH] Convert configparser values to string MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Python 3, configparser will reject non string values, and theoretically we could have some in the configuration. Signed-off-by: Lubomír Sedlář --- pungi/wrappers/kojiwrapper.py | 4 ++++ tests/test_koji_wrapper.py | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pungi/wrappers/kojiwrapper.py b/pungi/wrappers/kojiwrapper.py index 850e964c..033d29e6 100644 --- a/pungi/wrappers/kojiwrapper.py +++ b/pungi/wrappers/kojiwrapper.py @@ -23,6 +23,7 @@ import contextlib import koji from kobo.shortcuts import run +import six from six.moves import configparser from .. import util @@ -171,6 +172,9 @@ class KojiWrapper(object): for section, opts in config_options.items(): cfg_parser.add_section(section) for option, value in opts.items(): + if not isinstance(value, six.string_types): + # Python 3 configparser will reject non-string values. + value = str(value) cfg_parser.set(section, option, value) fd = open(conf_file_dest, "w") diff --git a/tests/test_koji_wrapper.py b/tests/test_koji_wrapper.py index 16a70ac2..1a10c9d7 100644 --- a/tests/test_koji_wrapper.py +++ b/tests/test_koji_wrapper.py @@ -83,6 +83,7 @@ class KojiWrapperTest(KojiWrapperBaseTestCase): 'ksurl': 'git://example.com/ks.git', 'distro': 'test-distro', 'release': '20160222.0', + 'disk_size': 4, } }, self.tmpfile @@ -105,7 +106,8 @@ class KojiWrapperTest(KojiWrapperBaseTestCase): 'kickstart = test-kickstart', 'ksurl = git://example.com/ks.git', 'distro = test-distro', - 'release = 20160222.0']) + 'release = 20160222.0', + 'disk_size = 4']) def test_get_image_paths(self):