summaryrefslogtreecommitdiff
path: root/cloudinit/distros/parsers/sys_conf.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-03-11 21:15:45 +0100
committerGitHub <noreply@github.com>2020-03-11 21:15:45 +0100
commitfd87c24ff8f6f09a7e2cc223a4e8cdb8c08f1ef8 (patch)
treeb754b3991e5e57a9ae9155819f73fa0cbd4be269 /cloudinit/distros/parsers/sys_conf.py
parentca9a4eb26b41c204d1bd3a15586b14a5dde950bb (diff)
parentc6627bc05a57645e6af8b9a5a67e452d9f37e487 (diff)
downloadvyos-cloud-init-fd87c24ff8f6f09a7e2cc223a4e8cdb8c08f1ef8.tar.gz
vyos-cloud-init-fd87c24ff8f6f09a7e2cc223a4e8cdb8c08f1ef8.zip
Merge pull request #4 from zdc/T2117
Cloud-init: T2117: Updated to 20.1 version
Diffstat (limited to 'cloudinit/distros/parsers/sys_conf.py')
-rw-r--r--cloudinit/distros/parsers/sys_conf.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/cloudinit/distros/parsers/sys_conf.py b/cloudinit/distros/parsers/sys_conf.py
index c27b5d5d..dee4c551 100644
--- a/cloudinit/distros/parsers/sys_conf.py
+++ b/cloudinit/distros/parsers/sys_conf.py
@@ -4,11 +4,9 @@
#
# This file is part of cloud-init. See LICENSE file for license information.
-import six
-from six import StringIO
-
import pipes
import re
+from io import StringIO
# This library is used to parse/write
# out the various sysconfig files edited (best attempt effort)
@@ -43,6 +41,13 @@ def _contains_shell_variable(text):
class SysConf(configobj.ConfigObj):
+ """A configobj.ConfigObj subclass specialised for sysconfig files.
+
+ :param contents:
+ The sysconfig file to parse, in a format accepted by
+ ``configobj.ConfigObj.__init__`` (i.e. "a filename, file like object,
+ or list of lines").
+ """
def __init__(self, contents):
configobj.ConfigObj.__init__(self, contents,
interpolation=False,
@@ -58,7 +63,7 @@ class SysConf(configobj.ConfigObj):
return out_contents.getvalue()
def _quote(self, value, multiline=False):
- if not isinstance(value, six.string_types):
+ if not isinstance(value, str):
raise ValueError('Value "%s" is not a string' % (value))
if len(value) == 0:
return ''