Remove 1168.patch
This commit is contained in:
parent
fff7f59b03
commit
c461b33c1d
69
1168.patch
69
1168.patch
@ -1,69 +0,0 @@
|
|||||||
From 8f2e96099960cda6a18e55af6587c74c1379519a Mon Sep 17 00:00:00 2001
|
|
||||||
From: Marek Blaha <mblaha@redhat.com>
|
|
||||||
Date: Wed, 8 Aug 2018 10:50:26 +0200
|
|
||||||
Subject: [PATCH] [conf] Do not traceback on empty option (RhBug:1613577)
|
|
||||||
|
|
||||||
https://bugzilla.redhat.com/show_bug.cgi?id=1613577
|
|
||||||
---
|
|
||||||
dnf/conf/config.py | 2 +-
|
|
||||||
tests/conf/test_parser.py | 14 ++++++++++++--
|
|
||||||
tests/etc/empty_option.conf | 2 ++
|
|
||||||
3 files changed, 15 insertions(+), 3 deletions(-)
|
|
||||||
create mode 100644 tests/etc/empty_option.conf
|
|
||||||
|
|
||||||
diff --git a/dnf/conf/config.py b/dnf/conf/config.py
|
|
||||||
index 044bdcadc..741eddd2d 100644
|
|
||||||
--- a/dnf/conf/config.py
|
|
||||||
+++ b/dnf/conf/config.py
|
|
||||||
@@ -286,7 +286,7 @@ def _populate(self, parser, section, filename, priority=PRIO_DEFAULT):
|
|
||||||
for name in parser.getData()[section]:
|
|
||||||
value = parser.getSubstitutedValue(section, name)
|
|
||||||
if not value or value == 'None':
|
|
||||||
- value = None
|
|
||||||
+ value = ''
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not self._config:
|
|
||||||
diff --git a/tests/conf/test_parser.py b/tests/conf/test_parser.py
|
|
||||||
index 52bbdd021..304fc674b 100644
|
|
||||||
--- a/tests/conf/test_parser.py
|
|
||||||
+++ b/tests/conf/test_parser.py
|
|
||||||
@@ -20,14 +20,16 @@
|
|
||||||
from __future__ import absolute_import
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
+import dnf.conf
|
|
||||||
from libdnf.conf import ConfigParser
|
|
||||||
|
|
||||||
import tests.support
|
|
||||||
|
|
||||||
substitute = ConfigParser.substitute
|
|
||||||
|
|
||||||
-class SubstituteTest(tests.support.TestCase):
|
|
||||||
- def test_read(self):
|
|
||||||
+
|
|
||||||
+class ParserTest(tests.support.TestCase):
|
|
||||||
+ def test_substitute(self):
|
|
||||||
substs = {'lies': 'fact'}
|
|
||||||
# Test a single word without braces
|
|
||||||
rawstr = '$Substitute some $lies.'
|
|
||||||
@@ -51,3 +53,11 @@ def test_read(self):
|
|
||||||
rawstr = '$Substitute some $lies}withoutspace.'
|
|
||||||
result = '$Substitute some fact}withoutspace.'
|
|
||||||
self.assertEqual(substitute(rawstr, substs), result)
|
|
||||||
+
|
|
||||||
+ def test_empty_option(self):
|
|
||||||
+ # Parser is able to read config file with option without value
|
|
||||||
+ FN = tests.support.resource_path('etc/empty_option.conf')
|
|
||||||
+ conf = dnf.conf.Conf()
|
|
||||||
+ conf.config_file_path = FN
|
|
||||||
+ conf.read()
|
|
||||||
+ self.assertEqual(conf.installroot, '')
|
|
||||||
diff --git a/tests/etc/empty_option.conf b/tests/etc/empty_option.conf
|
|
||||||
new file mode 100644
|
|
||||||
index 000000000..37746172a
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/tests/etc/empty_option.conf
|
|
||||||
@@ -0,0 +1,2 @@
|
|
||||||
+[main]
|
|
||||||
+installroot =
|
|
Loading…
Reference in New Issue
Block a user