Skip to content

Commit 86f0d70

Browse files
author
Joshua Harlow
committed
Remove the usage of set,list,dict and use the collections
iterable which performs the same, but can handle iterator types beyond those three.
1 parent 02fe9d1 commit 86f0d70

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

cloudinit/log.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import logging.handlers
2525
import logging.config
2626

27+
import collections
2728
import os
2829
import sys
2930

@@ -63,9 +64,11 @@ def setupLogging(cfg=None):
6364
# If there is a 'logcfg' entry in the config,
6465
# respect it, it is the old keyname
6566
log_cfgs.append(str(log_cfg))
66-
elif "log_cfgs" in cfg and isinstance(cfg['log_cfgs'], (set, list)):
67+
elif "log_cfgs" in cfg:
6768
for a_cfg in cfg['log_cfgs']:
68-
if isinstance(a_cfg, (list, set, dict)):
69+
if isinstance(a_cfg, (basestring, str)):
70+
log_cfgs.append(a_cfg)
71+
elif isinstance(a_cfg, (collections.Iterable)):
6972
cfg_str = [str(c) for c in a_cfg]
7073
log_cfgs.append('\n'.join(cfg_str))
7174
else:

0 commit comments

Comments
 (0)