summaryrefslogtreecommitdiff
path: root/cloudinit/log.py
diff options
context:
space:
mode:
authorDaniel Watkins <oddbloke@ubuntu.com>2020-01-21 17:15:30 -0500
committerGitHub <noreply@github.com>2020-01-21 17:15:30 -0500
commit8c4fd886931abcf2cc8627a47463907d655b35c3 (patch)
tree5abcf1140d58c0498da01fa746d5581558423d2c /cloudinit/log.py
parent0562ca696fe1a36b6c3b2fb576068e05033f6f3f (diff)
downloadvyos-cloud-init-8c4fd886931abcf2cc8627a47463907d655b35c3.tar.gz
vyos-cloud-init-8c4fd886931abcf2cc8627a47463907d655b35c3.zip
Start removing dependency on six (#178)
* url_helper: drop six * url_helper: sort imports * log: drop six * log: sort imports * handlers/__init__: drop six * handlers/__init__: sort imports * user_data: drop six * user_data: sort imports * sources/__init__: drop six * sources/__init__: sort imports * DataSourceOVF: drop six * DataSourceOVF: sort imports * sources/helpers/openstack: drop six * sources/helpers/openstack: sort imports * mergers/m_str: drop six This also allowed simplification of the logic, as we will never encounter a non-string text type. * type_utils: drop six * mergers/m_dict: drop six * mergers/m_list: drop six * cmd/query: drop six * mergers/__init__: drop six * net/cmdline: drop six * reporting/handlers: drop six * reporting/handlers: sort imports
Diffstat (limited to 'cloudinit/log.py')
-rw-r--r--cloudinit/log.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/cloudinit/log.py b/cloudinit/log.py
index 5ae312ba..827db12b 100644
--- a/cloudinit/log.py
+++ b/cloudinit/log.py
@@ -8,17 +8,13 @@
#
# This file is part of cloud-init. See LICENSE file for license information.
+import collections
+import io
import logging
import logging.config
import logging.handlers
-
-import collections
import os
import sys
-
-import six
-from six import StringIO
-
import time
# Logging levels for easy access
@@ -74,13 +70,13 @@ def setupLogging(cfg=None):
log_cfgs = []
log_cfg = cfg.get('logcfg')
- if log_cfg and isinstance(log_cfg, six.string_types):
+ if log_cfg and isinstance(log_cfg, str):
# If there is a 'logcfg' entry in the config,
# respect it, it is the old keyname
log_cfgs.append(str(log_cfg))
elif "log_cfgs" in cfg:
for a_cfg in cfg['log_cfgs']:
- if isinstance(a_cfg, six.string_types):
+ if isinstance(a_cfg, str):
log_cfgs.append(a_cfg)
elif isinstance(a_cfg, (collections.Iterable)):
cfg_str = [str(c) for c in a_cfg]
@@ -100,7 +96,7 @@ def setupLogging(cfg=None):
# is acting as a file)
pass
else:
- log_cfg = StringIO(log_cfg)
+ log_cfg = io.StringIO(log_cfg)
# Attempt to load its config
logging.config.fileConfig(log_cfg)
# The first one to work wins!