summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonah BrĂ¼chert <jbb@kaidan.im>2024-04-19 23:52:23 +0200
committerJonah BrĂ¼chert <jbb@kaidan.im>2024-04-19 23:52:23 +0200
commit2724e6409534a948b5a2c212ae0a7192326c1b4c (patch)
treefe49421ea9c00298c01d5c5c52d0687c2f4bb9fd
parent4d140a72fdde0e34060b9fa1ef76e05502245d20 (diff)
downloadbcfg2-2724e6409534a948b5a2c212ae0a7192326c1b4c.tar.gz
bcfg2-2724e6409534a948b5a2c212ae0a7192326c1b4c.tar.bz2
bcfg2-2724e6409534a948b5a2c212ae0a7192326c1b4c.zip
Run 2to3 on the entire project
-rwxr-xr-xsetup.py2
-rw-r--r--src/lib/Bcfg2/Client/Tools/APT.py2
-rw-r--r--src/lib/Bcfg2/Client/Tools/Debconf.py2
-rw-r--r--src/lib/Bcfg2/Client/Tools/Encap.py2
-rw-r--r--src/lib/Bcfg2/Client/Tools/POSIX/File.py2
-rw-r--r--src/lib/Bcfg2/Client/Tools/POSIX/__init__.py4
-rw-r--r--src/lib/Bcfg2/Client/Tools/POSIX/base.py12
-rw-r--r--src/lib/Bcfg2/Client/Tools/POSIXUsers.py8
-rw-r--r--src/lib/Bcfg2/Client/Tools/Pkgng.py2
-rw-r--r--src/lib/Bcfg2/Client/Tools/RPM.py4
-rw-r--r--src/lib/Bcfg2/Client/Tools/SELinux.py22
-rw-r--r--src/lib/Bcfg2/Client/Tools/SYSV.py2
-rw-r--r--src/lib/Bcfg2/Client/Tools/YUM.py6
-rw-r--r--src/lib/Bcfg2/Client/__init__.py6
-rw-r--r--src/lib/Bcfg2/Compat.py39
-rw-r--r--src/lib/Bcfg2/DBSettings.py2
-rw-r--r--src/lib/Bcfg2/Options/Actions.py2
-rw-r--r--src/lib/Bcfg2/Options/Options.py8
-rw-r--r--src/lib/Bcfg2/Options/Parser.py2
-rw-r--r--src/lib/Bcfg2/Options/Subcommands.py6
-rw-r--r--src/lib/Bcfg2/Options/Types.py2
-rwxr-xr-xsrc/lib/Bcfg2/Reporting/Reports.py26
-rw-r--r--src/lib/Bcfg2/Reporting/Storage/DjangoORM.py2
-rw-r--r--src/lib/Bcfg2/Reporting/Transport/RedisTransport.py4
-rw-r--r--src/lib/Bcfg2/Reporting/migrations/0001_initial.py2
-rw-r--r--src/lib/Bcfg2/Reporting/migrations/0002_convert_perms_to_mode.py2
-rw-r--r--src/lib/Bcfg2/Reporting/migrations/0003_expand_hash_key.py2
-rw-r--r--src/lib/Bcfg2/Reporting/migrations/0004_profile_can_be_null.py2
-rw-r--r--src/lib/Bcfg2/Reporting/migrations/0005_add_selinux_entry_support.py2
-rw-r--r--src/lib/Bcfg2/Reporting/migrations/0006_add_user_group_entry_support.py2
-rw-r--r--src/lib/Bcfg2/Reporting/migrations/0007_add_flag_fields_interaction.py2
-rw-r--r--src/lib/Bcfg2/Reporting/migrations/0008_add_ready_flag_interaction.py2
-rw-r--r--src/lib/Bcfg2/Reporting/migrations/0009_add_conf_entry.py2
-rw-r--r--src/lib/Bcfg2/Reporting/models.py2
-rw-r--r--src/lib/Bcfg2/Reporting/south_migrations/0009_add_conf_entry.py180
-rwxr-xr-xsrc/lib/Bcfg2/Reporting/utils.py2
-rw-r--r--src/lib/Bcfg2/Reporting/views.py2
-rw-r--r--src/lib/Bcfg2/Server/Admin.py58
-rw-r--r--src/lib/Bcfg2/Server/Cache.py2
-rw-r--r--src/lib/Bcfg2/Server/Core.py10
-rwxr-xr-xsrc/lib/Bcfg2/Server/Encryption.py10
-rw-r--r--src/lib/Bcfg2/Server/FileMonitor/Inotify.py5
-rw-r--r--src/lib/Bcfg2/Server/FileMonitor/__init__.py4
-rw-r--r--src/lib/Bcfg2/Server/Info.py106
-rw-r--r--src/lib/Bcfg2/Server/Lint/Bundler.py6
-rw-r--r--src/lib/Bcfg2/Server/Lint/Cfg.py8
-rw-r--r--src/lib/Bcfg2/Server/Lint/Comments.py20
-rw-r--r--src/lib/Bcfg2/Server/Lint/Genshi.py6
-rw-r--r--src/lib/Bcfg2/Server/Lint/GroupNames.py4
-rw-r--r--src/lib/Bcfg2/Server/Lint/InfoXML.py4
-rw-r--r--src/lib/Bcfg2/Server/Lint/Jinja2.py4
-rw-r--r--src/lib/Bcfg2/Server/Lint/MergeFiles.py4
-rw-r--r--src/lib/Bcfg2/Server/Lint/Metadata.py4
-rw-r--r--src/lib/Bcfg2/Server/Lint/RequiredAttrs.py8
-rw-r--r--src/lib/Bcfg2/Server/Lint/TemplateAbuse.py6
-rw-r--r--src/lib/Bcfg2/Server/Lint/TemplateHelper.py2
-rw-r--r--src/lib/Bcfg2/Server/Lint/Validate.py4
-rw-r--r--src/lib/Bcfg2/Server/Lint/__init__.py14
-rw-r--r--src/lib/Bcfg2/Server/MultiprocessingCore.py14
-rw-r--r--src/lib/Bcfg2/Server/Plugin/base.py2
-rw-r--r--src/lib/Bcfg2/Server/Plugin/helpers.py26
-rw-r--r--src/lib/Bcfg2/Server/Plugins/AWSTags.py2
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Bundler.py4
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Cfg/CfgCheetahGenerator.py4
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py12
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Deps.py2
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Ldap.py2
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Metadata.py16
-rw-r--r--src/lib/Bcfg2/Server/Plugins/POSIXCompat.py2
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Packages/Pac.py2
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Packages/Pkgng.py4
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Packages/Source.py2
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Packages/Yum.py6
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Packages/YumHelper.py8
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Packages/__init__.py4
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Pkgmgr.py8
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Probes.py10
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Properties.py2
-rw-r--r--src/lib/Bcfg2/Server/Plugins/PuppetENC.py6
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Rules.py2
-rw-r--r--src/lib/Bcfg2/Server/Plugins/SSHbase.py8
-rw-r--r--src/lib/Bcfg2/Server/Plugins/TemplateHelper.py8
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Trigger.py2
-rw-r--r--src/lib/Bcfg2/Server/Reports/reports/models.py2
-rw-r--r--src/lib/Bcfg2/Server/SSLServer.py2
-rw-r--r--src/lib/Bcfg2/Server/migrations/0001_initial.py2
-rw-r--r--src/lib/Bcfg2/Server/south_migrations/0001_initial.py20
-rw-r--r--src/lib/Bcfg2/Utils.py6
88 files changed, 426 insertions, 426 deletions
diff --git a/setup.py b/setup.py
index 79dc0e8a1..fea087c87 100755
--- a/setup.py
+++ b/setup.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
from setuptools import setup
from glob import glob
diff --git a/src/lib/Bcfg2/Client/Tools/APT.py b/src/lib/Bcfg2/Client/Tools/APT.py
index 77610d9bc..29b4a5575 100644
--- a/src/lib/Bcfg2/Client/Tools/APT.py
+++ b/src/lib/Bcfg2/Client/Tools/APT.py
@@ -245,7 +245,7 @@ class APT(Bcfg2.Client.Tools.Tool):
self.logger.error("Failed to find %s in apt package "
"cache" % pkgname)
continue
- avail_vers = self.pkg_cache[pkgname].versions.keys()
+ avail_vers = list(self.pkg_cache[pkgname].versions.keys())
if pkg.get('version') in avail_vers:
ipkgs.append("%s=%s" % (pkgname, pkg.get('version')))
continue
diff --git a/src/lib/Bcfg2/Client/Tools/Debconf.py b/src/lib/Bcfg2/Client/Tools/Debconf.py
index 784f7e9bc..106e9adbb 100644
--- a/src/lib/Bcfg2/Client/Tools/Debconf.py
+++ b/src/lib/Bcfg2/Client/Tools/Debconf.py
@@ -126,5 +126,5 @@ class Debconf(Bcfg2.Client.Tools.Tool):
extra[name] = Bcfg2.Client.XML.Element(
'Conf', name=name, type='debconf',
current_value=current_value[1:])
- return extra.values()
+ return list(extra.values())
FindExtra.__doc__ = Bcfg2.Client.Tools.Tool.FindExtra.__doc__
diff --git a/src/lib/Bcfg2/Client/Tools/Encap.py b/src/lib/Bcfg2/Client/Tools/Encap.py
index 270f0a5f2..4f286b8ea 100644
--- a/src/lib/Bcfg2/Client/Tools/Encap.py
+++ b/src/lib/Bcfg2/Client/Tools/Encap.py
@@ -23,7 +23,7 @@ class Encap(Bcfg2.Client.Tools.PkgTool):
if match:
self.installed[match.group('name')] = match.group('version')
else:
- print("Failed to split name %s" % pkg)
+ print(("Failed to split name %s" % pkg))
self.logger.debug("Encap: RefreshPackages: self.installed.keys() are:")
self.logger.debug("%s" % list(self.installed.keys()))
diff --git a/src/lib/Bcfg2/Client/Tools/POSIX/File.py b/src/lib/Bcfg2/Client/Tools/POSIX/File.py
index c68c57995..75856782f 100644
--- a/src/lib/Bcfg2/Client/Tools/POSIX/File.py
+++ b/src/lib/Bcfg2/Client/Tools/POSIX/File.py
@@ -188,7 +188,7 @@ class POSIXFile(POSIXTool):
if interactive:
entry.set("qtext", "\n".join(prompt))
if not sensitive:
- for attr, val in attrs.items():
+ for attr, val in list(attrs.items()):
entry.set(attr, val)
def _diff(self, content1, content2, filename=None):
diff --git a/src/lib/Bcfg2/Client/Tools/POSIX/__init__.py b/src/lib/Bcfg2/Client/Tools/POSIX/__init__.py
index 41bff751d..ce7976a98 100644
--- a/src/lib/Bcfg2/Client/Tools/POSIX/__init__.py
+++ b/src/lib/Bcfg2/Client/Tools/POSIX/__init__.py
@@ -31,9 +31,9 @@ class POSIX(Bcfg2.Client.Tools.Tool):
Bcfg2.Client.Tools.Tool.__init__(self, config)
self._handlers = self._load_handlers()
self.logger.debug("POSIX: Handlers loaded: %s" %
- (", ".join(self._handlers.keys())))
+ (", ".join(list(self._handlers.keys()))))
self.__req__ = dict(Path=dict())
- for etype, hdlr in self._handlers.items():
+ for etype, hdlr in list(self._handlers.items()):
self.__req__['Path'][etype] = hdlr.__req__
self.__handles__.append(('Path', etype))
# Tool.__init__() sets up the list of handled entries, but we
diff --git a/src/lib/Bcfg2/Client/Tools/POSIX/base.py b/src/lib/Bcfg2/Client/Tools/POSIX/base.py
index ffa527cd6..487811d38 100644
--- a/src/lib/Bcfg2/Client/Tools/POSIX/base.py
+++ b/src/lib/Bcfg2/Client/Tools/POSIX/base.py
@@ -250,7 +250,7 @@ class POSIXTool(Bcfg2.Client.Tools.Tool):
entry.get("name"))
return True
- for aclkey, perms in acls.items():
+ for aclkey, perms in list(acls.items()):
atype, scope, qualifier = aclkey
if atype == "default":
if defacl is None:
@@ -260,7 +260,7 @@ class POSIXTool(Bcfg2.Client.Tools.Tool):
aclentry = posix1e.Entry(defacl)
else:
aclentry = posix1e.Entry(acl)
- for perm in ACL_MAP.values():
+ for perm in list(ACL_MAP.values()):
if perm & perms:
aclentry.permset.add(perm)
aclentry.tag_type = scope
@@ -374,7 +374,7 @@ class POSIXTool(Bcfg2.Client.Tools.Tool):
return 0
elif hasattr(perms, 'test'):
# Permset object
- return sum([p for p in ACL_MAP.values()
+ return sum([p for p in list(ACL_MAP.values())
if perms.test(p)])
try:
@@ -576,7 +576,7 @@ class POSIXTool(Bcfg2.Client.Tools.Tool):
self.logger.debug("POSIX: " + error)
entry.set('qtext', "\n".join([entry.get('qtext', '')] + errors))
if path == entry.get("name"):
- for attr, val in attrib.items():
+ for attr, val in list(attrib.items()):
if val is not None:
entry.set(attr, str(val))
@@ -710,10 +710,10 @@ class POSIXTool(Bcfg2.Client.Tools.Tool):
missing = []
extra = []
wrong = []
- for aclkey, perms in wanted.items():
+ for aclkey, perms in list(wanted.items()):
_verify_acl(aclkey, perms)
- for aclkey, perms in existing.items():
+ for aclkey, perms in list(existing.items()):
if aclkey not in wanted:
extra.append(self._acl2string(aclkey, perms))
diff --git a/src/lib/Bcfg2/Client/Tools/POSIXUsers.py b/src/lib/Bcfg2/Client/Tools/POSIXUsers.py
index 004f85682..ff61bbcb1 100644
--- a/src/lib/Bcfg2/Client/Tools/POSIXUsers.py
+++ b/src/lib/Bcfg2/Client/Tools/POSIXUsers.py
@@ -150,7 +150,7 @@ class POSIXUsers(Bcfg2.Client.Tools.Tool):
for entry in self.getSupportedEntries():
if entry.tag == tag:
specified.append(entry.get("name"))
- for name, data in self.existing[tag].items():
+ for name, data in list(self.existing[tag].items()):
eid = data[self.attr_mapping[tag][self.id_mapping[tag]]]
if name not in specified and self._in_managed_range(tag, eid):
extra.append(Bcfg2.Client.XML.Element(tag, name=name))
@@ -167,7 +167,7 @@ class POSIXUsers(Bcfg2.Client.Tools.Tool):
defaults['home'] = '/root'
else:
defaults['home'] = '/home/%s' % entry.get('name')
- for key, val in defaults.items():
+ for key, val in list(defaults.items()):
if entry.get(key) is None:
entry.set(key, val)
if entry.get('group') in self.existing['POSIXGroup']:
@@ -178,7 +178,7 @@ class POSIXUsers(Bcfg2.Client.Tools.Tool):
def user_supplementary_groups(self, entry):
""" Get a list of supplmentary groups that the user in the
given entry is a member of """
- return [g for g in self.existing['POSIXGroup'].values()
+ return [g for g in list(self.existing['POSIXGroup'].values())
if entry.get("name") in g[3] and
self._in_managed_range('POSIXSupGroup', g[2])]
@@ -221,7 +221,7 @@ class POSIXUsers(Bcfg2.Client.Tools.Tool):
errors.append("%s %s does not exist" % (entry.tag,
entry.get("name")))
else:
- for attr, idx in self.attr_mapping[entry.tag].items():
+ for attr, idx in list(self.attr_mapping[entry.tag].items()):
val = str(self.existing[entry.tag][entry.get("name")][idx])
entry.set("current_%s" % attr, val)
if attr in ["uid", "gid"]:
diff --git a/src/lib/Bcfg2/Client/Tools/Pkgng.py b/src/lib/Bcfg2/Client/Tools/Pkgng.py
index 025bc59be..ffcbfff6e 100644
--- a/src/lib/Bcfg2/Client/Tools/Pkgng.py
+++ b/src/lib/Bcfg2/Client/Tools/Pkgng.py
@@ -64,7 +64,7 @@ class Pkgng(Bcfg2.Client.Tools.Tool):
def FindExtra(self):
"""Find extra packages."""
packages = [entry.get('name') for entry in self.getSupportedEntries()]
- extras = [(name, value) for (name, value) in self.pkg_cache.items()
+ extras = [(name, value) for (name, value) in list(self.pkg_cache.items())
if name not in packages]
return [Bcfg2.Client.XML.Element('Package', name=name, type='pkgng',
current_version=version)
diff --git a/src/lib/Bcfg2/Client/Tools/RPM.py b/src/lib/Bcfg2/Client/Tools/RPM.py
index 6b379918a..001f9bc9a 100644
--- a/src/lib/Bcfg2/Client/Tools/RPM.py
+++ b/src/lib/Bcfg2/Client/Tools/RPM.py
@@ -811,7 +811,7 @@ def rpm_erase(erase_pkgspecs, erase_flags):
idx_list = getindexbykeyword(erase_ts, **pkgspec)
if len(idx_list) > 1 and not 'allmatches' in erase_flags:
#pass
- print('ERROR - Multiple package match for erase', pkgspec)
+ print(('ERROR - Multiple package match for erase', pkgspec))
else:
for idx in idx_list:
erase_ts.addErase(idx)
@@ -891,7 +891,7 @@ def display_verify_file(file_results):
else:
result_string = result_string + '.'
- print(result_string + ' ' + filetype + ' ' + filename)
+ print((result_string + ' ' + filetype + ' ' + filename))
sys.stdout.flush()
#=============================================================================
diff --git a/src/lib/Bcfg2/Client/Tools/SELinux.py b/src/lib/Bcfg2/Client/Tools/SELinux.py
index 7b5ff7813..8a7593660 100644
--- a/src/lib/Bcfg2/Client/Tools/SELinux.py
+++ b/src/lib/Bcfg2/Client/Tools/SELinux.py
@@ -13,7 +13,7 @@ import seobject
import Bcfg2.Client.XML
import Bcfg2.Client.Tools
from Bcfg2.Client.Tools.POSIX.File import POSIXFile
-from Bcfg2.Compat import long # pylint: disable=W0622
+from Bcfg2.Compat import int # pylint: disable=W0622
def pack128(int_val):
@@ -49,7 +49,7 @@ def netmask_itoa(netmask, proto="ipv4"):
if netmask > size:
raise ValueError("Netmask too large: %s" % netmask)
- res = long(0)
+ res = int(0)
for i in range(netmask):
res |= 1 << (size - i - 1)
netmask = socket.inet_ntop(family, pack128(res))
@@ -102,7 +102,7 @@ class SELinux(Bcfg2.Client.Tools.Tool):
def FindExtra(self):
extra = []
- for handler in self.handlers.values():
+ for handler in list(self.handlers.values()):
extra.extend(handler.FindExtra())
return extra
@@ -372,7 +372,7 @@ class SELinuxEntryHandler(object):
except ValueError:
records = self.all_records
return [self.key2entry(key)
- for key in records.keys()
+ for key in list(records.keys())
if key not in specified]
@@ -390,8 +390,8 @@ class SELinuxSebooleanHandler(SELinuxEntryHandler):
# the newer format as far as interoperation with the rest of
# SELinuxEntryHandler goes
rv = SELinuxEntryHandler.all_records.fget(self)
- if rv.values()[0] in [0, 1]:
- for key, val in rv.items():
+ if list(rv.values())[0] in [0, 1]:
+ for key, val in list(rv.items()):
rv[key] = [val, val, val]
return rv
@@ -458,12 +458,12 @@ class SELinuxSeportHandler(SELinuxEntryHandler):
# (type, level) as the value. abstracting around this
# sucks.
ports = self.records.get_all()
- if len(ports.keys()[0]) == 3:
+ if len(list(ports.keys())[0]) == 3:
self._all = ports
else:
# uglist list comprehension ever?
self._all = dict([((k[0], k[1], v[1]), (v[0], v[2]))
- for k, v in ports.items()])
+ for k, v in list(ports.items())])
return self._all
def _key(self, entry):
@@ -522,7 +522,7 @@ class SELinuxSefcontextHandler(SELinuxEntryHandler):
block="block device",
char="character device",
door="door")
- filetypeattrs = dict([v, k] for k, v in filetypenames.iteritems())
+ filetypeattrs = dict([v, k] for k, v in filetypenames.items())
custom_re = re.compile(r'-f \'(?P<filetype>[a-z ]+)\'.*? \'(?P<name>.*)\'')
@property
@@ -754,7 +754,7 @@ class SELinuxSemoduleHandler(SELinuxEntryHandler):
self._all[mod] = (version, 1)
# get other (disabled) modules from the filesystem
- for mod in self._all_records_from_filesystem().keys():
+ for mod in list(self._all_records_from_filesystem().keys()):
if mod not in self._all:
self._all[mod] = ('', 0)
else:
@@ -902,7 +902,7 @@ class SELinuxSemoduleHandler(SELinuxEntryHandler):
specified = [self._key(e)
for e in self.tool.getSupportedEntries()]
rv = []
- for module in self._all_records_from_filesystem().keys():
+ for module in list(self._all_records_from_filesystem().keys()):
if module not in specified:
rv.append(self.key2entry(module))
return rv
diff --git a/src/lib/Bcfg2/Client/Tools/SYSV.py b/src/lib/Bcfg2/Client/Tools/SYSV.py
index 4eea0273f..31fe499a7 100644
--- a/src/lib/Bcfg2/Client/Tools/SYSV.py
+++ b/src/lib/Bcfg2/Client/Tools/SYSV.py
@@ -71,7 +71,7 @@ class SYSV(Bcfg2.Client.Tools.PkgTool):
string
"""
if hasattr(self, 'origpkgtool'):
- if len(packages) == 1 and '_sysv_pkg_path' in packages[0].keys():
+ if len(packages) == 1 and '_sysv_pkg_path' in list(packages[0].keys()):
self.pkgtool = (self.pkgtool[0], ('%s %s',
['_sysv_pkg_path', 'name']))
else:
diff --git a/src/lib/Bcfg2/Client/Tools/YUM.py b/src/lib/Bcfg2/Client/Tools/YUM.py
index ade4da5b3..ad012abfb 100644
--- a/src/lib/Bcfg2/Client/Tools/YUM.py
+++ b/src/lib/Bcfg2/Client/Tools/YUM.py
@@ -499,16 +499,16 @@ class YUM(Bcfg2.Client.Tools.PkgTool):
if self.yumbase.comps.has_group(entry.get('group')):
group = self.yumbase.comps.return_group(entry.get('group'))
group_packages = [p
- for p, d in group.mandatory_packages.items()
+ for p, d in list(group.mandatory_packages.items())
if d]
group_type = entry.get('choose', 'default')
if group_type in ['default', 'optional', 'all']:
group_packages += [
- p for p, d in group.default_packages.items()
+ p for p, d in list(group.default_packages.items())
if d]
if group_type in ['optional', 'all']:
group_packages += [
- p for p, d in group.optional_packages.items()
+ p for p, d in list(group.optional_packages.items())
if d]
if len(group_packages) == 0:
self.logger.error("No packages found for group %s" %
diff --git a/src/lib/Bcfg2/Client/__init__.py b/src/lib/Bcfg2/Client/__init__.py
index 14c14a224..15fdd5234 100644
--- a/src/lib/Bcfg2/Client/__init__.py
+++ b/src/lib/Bcfg2/Client/__init__.py
@@ -74,7 +74,7 @@ def prompt(msg):
# handle ^C
raise SystemExit(1)
except:
- print("Error while reading input: %s" % sys.exc_info()[1])
+ print(("Error while reading input: %s" % sys.exc_info()[1]))
return False
@@ -493,7 +493,7 @@ class Client(object):
entries[pkey] += 1
else:
entries[pkey] = 1
- multi = [e for e, c in entries.items() if c > 1]
+ multi = [e for e, c in list(entries.items()) if c > 1]
if multi:
self.logger.debug("The following entries are included multiple "
"times:")
@@ -868,7 +868,7 @@ class Client(object):
self.logger.info('Incorrect entries: %d' %
list(self.states.values()).count(False))
if phase == 'final' and list(self.states.values()).count(False):
- for entry in sorted(self.states.keys(), key=lambda e: e.tag + ":" +
+ for entry in sorted(list(self.states.keys()), key=lambda e: e.tag + ":" +
e.get('name')):
if not self.states[entry]:
etype = entry.get('type')
diff --git a/src/lib/Bcfg2/Compat.py b/src/lib/Bcfg2/Compat.py
index 251c80f4c..9be7d1152 100644
--- a/src/lib/Bcfg2/Compat.py
+++ b/src/lib/Bcfg2/Compat.py
@@ -19,12 +19,11 @@ except ImportError:
# urllib imports
try:
- from urllib import quote_plus
- from urllib import urlretrieve
- from urlparse import urljoin, urlparse
- from urllib2 import HTTPBasicAuthHandler, \
- HTTPPasswordMgrWithDefaultRealm, build_opener, install_opener, \
- urlopen, HTTPError, URLError
+ from urllib.parse import quote_plus
+ from urllib.request import urlretrieve
+ from urllib.parse import urljoin, urlparse
+ from urllib.request import HTTPBasicAuthHandler, HTTPPasswordMgrWithDefaultRealm, build_opener, install_opener, urlopen
+ from urllib.error import HTTPError, URLError
except ImportError:
from urllib.parse import urljoin, urlparse, quote_plus
from urllib.request import HTTPBasicAuthHandler, \
@@ -33,49 +32,49 @@ except ImportError:
from urllib.error import HTTPError, URLError
try:
- from cStringIO import StringIO
+ from io import StringIO
except ImportError:
from io import StringIO
try:
- import ConfigParser
+ import configparser
except ImportError:
import configparser as ConfigParser
try:
- import cPickle
+ import pickle
except ImportError:
import pickle as cPickle
try:
- from Queue import Queue, Empty, Full
+ from queue import Queue, Empty, Full
except ImportError:
from queue import Queue, Empty, Full
# xmlrpc imports
try:
- import xmlrpclib
- import SimpleXMLRPCServer
+ import xmlrpc.client
+ import xmlrpc.server
except ImportError:
import xmlrpc.client as xmlrpclib
import xmlrpc.server as SimpleXMLRPCServer
# socketserver import
try:
- import SocketServer
+ import socketserver
except ImportError:
import socketserver as SocketServer
# httplib imports
try:
- import httplib
+ import http.client
except ImportError:
import http.client as httplib
try:
- unicode = unicode
+ str = str
except NameError:
- unicode = str
+ str = str
def u_str(string, encoding=None):
@@ -84,13 +83,13 @@ def u_str(string, encoding=None):
return string
else:
if encoding is not None:
- return unicode(string, encoding)
+ return str(string, encoding)
else:
- return unicode(string)
+ return str(string)
def ensure_binary(string, encoding='utf-8'):
- if type(string) == unicode:
+ if type(string) == str:
return string.encode(encoding)
return string
@@ -280,7 +279,7 @@ def oct_mode(mode):
try:
- long = long
+ long = int
except NameError:
# longs are just ints in py3k
long = int
diff --git a/src/lib/Bcfg2/DBSettings.py b/src/lib/Bcfg2/DBSettings.py
index 9b493944b..5d2df6078 100644
--- a/src/lib/Bcfg2/DBSettings.py
+++ b/src/lib/Bcfg2/DBSettings.py
@@ -160,7 +160,7 @@ def finalize_django_config(opts=None, silent=False):
logger.debug("Finalizing Django settings: %s" % settings)
module = sys.modules[__name__]
- for name, value in settings.items():
+ for name, value in list(settings.items()):
setattr(module, name, value)
try:
django.conf.settings.configure(**settings)
diff --git a/src/lib/Bcfg2/Options/Actions.py b/src/lib/Bcfg2/Options/Actions.py
index 854e6039d..051f4adcb 100644
--- a/src/lib/Bcfg2/Options/Actions.py
+++ b/src/lib/Bcfg2/Options/Actions.py
@@ -104,7 +104,7 @@ class ComponentAction(FinalizableAction):
def __init__(self, *args, **kwargs):
if self.mapping and not self.islist:
if 'choices' not in kwargs:
- kwargs['choices'] = self.mapping.keys()
+ kwargs['choices'] = list(self.mapping.keys())
FinalizableAction.__init__(self, *args, **kwargs)
def _import(self, module, name):
diff --git a/src/lib/Bcfg2/Options/Options.py b/src/lib/Bcfg2/Options/Options.py
index c85cfd87c..b152c9899 100644
--- a/src/lib/Bcfg2/Options/Options.py
+++ b/src/lib/Bcfg2/Options/Options.py
@@ -26,7 +26,7 @@ def _debug(msg):
enabled by changing this to True. The verbosity here is primarily
of use to developers. """
if unit_test:
- print("DEBUG: %s" % msg)
+ print(("DEBUG: %s" % msg))
elif os.environ.get('BCFG2_OPTIONS_DEBUG', '0').lower() in ["true", "yes",
"on", "1"]:
sys.stderr.write("%s\n" % msg)
@@ -178,7 +178,7 @@ class Option(object):
determined that the default will be used (i.e., the option is
not given on the command line or in the config file) to store
the appropriate default value in the appropriate format."""
- for parser, action in self.actions.items():
+ for parser, action in list(self.actions.items()):
if hasattr(action, "finalize"):
if parser:
_debug("Finalizing %s for %s" % (self, parser))
@@ -276,7 +276,7 @@ class Option(object):
def _set_default(self, value):
""" Setter for the ``default`` property """
self._default = value
- for action in self.actions.values():
+ for action in list(self.actions.values()):
action.default = value
#: The current default value of this option
@@ -289,7 +289,7 @@ class Option(object):
def _set_dest(self, value):
""" Setter for the ``dest`` property """
self._dest = value
- for action in self.actions.values():
+ for action in list(self.actions.values()):
action.dest = value
def early_parsing_hook(self, early_opts): # pylint: disable=C0111
diff --git a/src/lib/Bcfg2/Options/Parser.py b/src/lib/Bcfg2/Options/Parser.py
index 51e41850c..e2573e74c 100644
--- a/src/lib/Bcfg2/Options/Parser.py
+++ b/src/lib/Bcfg2/Options/Parser.py
@@ -175,7 +175,7 @@ class Parser(argparse.ArgumentParser):
if not opt.args and opt.dest not in self.namespace:
value = opt.default
if value:
- for _, action in opt.actions.items():
+ for _, action in list(opt.actions.items()):
_debug("Setting config file-only option %s to %s" %
(opt, value))
action(self, self.namespace, value)
diff --git a/src/lib/Bcfg2/Options/Subcommands.py b/src/lib/Bcfg2/Options/Subcommands.py
index 2ba81e18d..f4ee207a9 100644
--- a/src/lib/Bcfg2/Options/Subcommands.py
+++ b/src/lib/Bcfg2/Options/Subcommands.py
@@ -151,17 +151,17 @@ class Help(Subcommand):
def run(self, setup):
commands = dict((name, cmd)
- for (name, cmd) in self._registry.commands.items()
+ for (name, cmd) in list(self._registry.commands.items())
if not cmd.only_interactive)
if setup.command:
try:
commands[setup.command].parser.print_help()
return 0
except KeyError:
- print("No such command: %s" % setup.command)
+ print(("No such command: %s" % setup.command))
return 1
for command in sorted(commands.keys()):
- print(commands[command].usage())
+ print((commands[command].usage()))
class CommandRegistry(object):
diff --git a/src/lib/Bcfg2/Options/Types.py b/src/lib/Bcfg2/Options/Types.py
index ad2e04f10..29cbb30d9 100644
--- a/src/lib/Bcfg2/Options/Types.py
+++ b/src/lib/Bcfg2/Options/Types.py
@@ -86,7 +86,7 @@ _bytes_multipliers = dict(k=1,
m=2,
g=3,
t=4)
-_suffixes = "".join(_bytes_multipliers.keys()).lower()
+_suffixes = "".join(list(_bytes_multipliers.keys())).lower()
_suffixes += _suffixes.upper()
_bytes_re = re.compile(r'(?P<value>\d+)(?P<multiplier>[%s])?' % _suffixes)
# pylint: enable=C0103
diff --git a/src/lib/Bcfg2/Reporting/Reports.py b/src/lib/Bcfg2/Reporting/Reports.py
index 7e1661c5a..40bb685f6 100755
--- a/src/lib/Bcfg2/Reporting/Reports.py
+++ b/src/lib/Bcfg2/Reporting/Reports.py
@@ -12,7 +12,7 @@ from django.core.exceptions import ObjectDoesNotExist
def print_entries(interaction, etype):
items = getattr(interaction, etype)()
for item in items:
- print("%-70s %s" % (item.entry_type + ":" + item.name, etype))
+ print(("%-70s %s" % (item.entry_type + ":" + item.name, etype)))
class _FlagsFilterMixin(object):
@@ -63,7 +63,7 @@ class _SingleHostCmd(Bcfg2.Options.Subcommand): # pylint: disable=W0223
try:
return Client.objects.select_related().get(name=setup.host)
except Client.DoesNotExist:
- print("No such host: %s" % setup.host)
+ print(("No such host: %s" % setup.host))
raise SystemExit(2)
@@ -83,7 +83,7 @@ class Show(_SingleHostCmd, _FlagsFilterMixin):
show_all = not setup.bad and not setup.extra and not setup.modified
interaction = self.get_interaction(client, setup)
if interaction is None:
- print("No interactions found for host: %s" % client.name)
+ print(("No interactions found for host: %s" % client.name))
else:
if setup.bad or show_all:
print_entries(interaction, "bad")
@@ -102,11 +102,11 @@ class Total(_SingleHostCmd, _FlagsFilterMixin):
client = self.get_client(setup)
interaction = self.get_interaction(client, setup)
if interaction is None:
- print("No interactions found for host: %s" % client.name)
+ print(("No interactions found for host: %s" % client.name))
else:
managed = interaction.total_count
good = interaction.good_count
- print("Total managed entries: %d (good: %d)" % (managed, good))
+ print(("Total managed entries: %d (good: %d)" % (managed, good)))
class Expire(_SingleHostCmd):
@@ -116,10 +116,10 @@ class Expire(_SingleHostCmd):
client = self.get_client(setup)
if client.expiration is None:
client.expiration = datetime.datetime.now()
- print("%s expired." % client.name)
+ print(("%s expired." % client.name))
else:
client.expiration = None
- print("%s un-expired." % client.name)
+ print(("%s un-expired." % client.name))
client.save()
@@ -168,7 +168,7 @@ class _ClientSelectCmd(Bcfg2.Options.Subcommand, _FlagsFilterMixin):
except AttributeError:
fdata.append(extra.get(field, "N/A"))
- print(fmt % tuple(fdata))
+ print((fmt % tuple(fdata)))
def display(self, setup, result, fields, extra=None):
if 'name' not in fields:
@@ -188,7 +188,7 @@ class _ClientSelectCmd(Bcfg2.Options.Subcommand, _FlagsFilterMixin):
else:
ffmt.append("%%-%ds" % len(field))
fmt = " ".join(ffmt)
- print(fmt % tuple(f.title() for f in fields))
+ print((fmt % tuple(f.title() for f in fields)))
for client in result:
if not client.expiration:
self._print_fields(setup, fields, client, fmt,
@@ -264,8 +264,8 @@ class Entries(_ClientSelectCmd):
entries = [l.strip().split(":") for l in setup.file]
except IOError:
err = sys.exc_info()[1]
- print("Cannot read entries from %s: %s" % (setup.file.name,
- err))
+ print(("Cannot read entries from %s: %s" % (setup.file.name,
+ err)))
return 2
else:
entries = [a.split(":") for a in setup.entries]
@@ -302,7 +302,7 @@ class Entry(_ClientSelectCmd):
try:
entry_cls = BaseEntry.entry_from_type(etype)
except ValueError:
- print("Unhandled/unknown type %s" % etype)
+ print(("Unhandled/unknown type %s" % etype))
return 2
# TODO: batch fetch this. sqlite could break
@@ -328,7 +328,7 @@ class CLI(Bcfg2.Options.CommandRegistry):
def __init__(self):
Bcfg2.Options.CommandRegistry.__init__(self)
- self.register_commands(globals().values())
+ self.register_commands(list(globals().values()))
parser = Bcfg2.Options.get_parser(
description="Query the Bcfg2 reporting subsystem",
components=[self])
diff --git a/src/lib/Bcfg2/Reporting/Storage/DjangoORM.py b/src/lib/Bcfg2/Reporting/Storage/DjangoORM.py
index e0566a51b..54fbbcea6 100644
--- a/src/lib/Bcfg2/Reporting/Storage/DjangoORM.py
+++ b/src/lib/Bcfg2/Reporting/Storage/DjangoORM.py
@@ -392,7 +392,7 @@ class DjangoORM(StorageBase):
inter.modified_count = counter_fields[TYPE_MODIFIED]
inter.extra_count = counter_fields[TYPE_EXTRA]
inter.save()
- for entry_type in updates.keys():
+ for entry_type in list(updates.keys()):
# batch this for sqlite
i = 0
while(i < len(updates[entry_type])):
diff --git a/src/lib/Bcfg2/Reporting/Transport/RedisTransport.py b/src/lib/Bcfg2/Reporting/Transport/RedisTransport.py
index 7427c2e1d..0ea1b6355 100644
--- a/src/lib/Bcfg2/Reporting/Transport/RedisTransport.py
+++ b/src/lib/Bcfg2/Reporting/Transport/RedisTransport.py
@@ -124,8 +124,8 @@ class RedisTransport(TransportBase):
resp = pubsub.listen()
signal.signal(signal.SIGALRM, self.shutdown)
signal.alarm(10)
- resp.next() # clear subscribe message
- response = resp.next()
+ next(resp) # clear subscribe message
+ response = next(resp)
pubsub.unsubscribe()
try:
diff --git a/src/lib/Bcfg2/Reporting/migrations/0001_initial.py b/src/lib/Bcfg2/Reporting/migrations/0001_initial.py
index 6a52a8b2d..22d0e9862 100644
--- a/src/lib/Bcfg2/Reporting/migrations/0001_initial.py
+++ b/src/lib/Bcfg2/Reporting/migrations/0001_initial.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
+
from django.db import models, migrations
diff --git a/src/lib/Bcfg2/Reporting/migrations/0002_convert_perms_to_mode.py b/src/lib/Bcfg2/Reporting/migrations/0002_convert_perms_to_mode.py
index 48bfd6412..4f08445d9 100644
--- a/src/lib/Bcfg2/Reporting/migrations/0002_convert_perms_to_mode.py
+++ b/src/lib/Bcfg2/Reporting/migrations/0002_convert_perms_to_mode.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
+
from django.db import models, migrations
diff --git a/src/lib/Bcfg2/Reporting/migrations/0003_expand_hash_key.py b/src/lib/Bcfg2/Reporting/migrations/0003_expand_hash_key.py
index b9ae207dd..87d9ffc31 100644
--- a/src/lib/Bcfg2/Reporting/migrations/0003_expand_hash_key.py
+++ b/src/lib/Bcfg2/Reporting/migrations/0003_expand_hash_key.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
+
from django.db import models, migrations
diff --git a/src/lib/Bcfg2/Reporting/migrations/0004_profile_can_be_null.py b/src/lib/Bcfg2/Reporting/migrations/0004_profile_can_be_null.py
index d0b2de417..5ff11037e 100644
--- a/src/lib/Bcfg2/Reporting/migrations/0004_profile_can_be_null.py
+++ b/src/lib/Bcfg2/Reporting/migrations/0004_profile_can_be_null.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
+
from django.db import models, migrations
diff --git a/src/lib/Bcfg2/Reporting/migrations/0005_add_selinux_entry_support.py b/src/lib/Bcfg2/Reporting/migrations/0005_add_selinux_entry_support.py
index 0c6934b10..01b4055d7 100644
--- a/src/lib/Bcfg2/Reporting/migrations/0005_add_selinux_entry_support.py
+++ b/src/lib/Bcfg2/Reporting/migrations/0005_add_selinux_entry_support.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
+
from django.db import models, migrations
diff --git a/src/lib/Bcfg2/Reporting/migrations/0006_add_user_group_entry_support.py b/src/lib/Bcfg2/Reporting/migrations/0006_add_user_group_entry_support.py
index 4853faaf3..31c9ec460 100644
--- a/src/lib/Bcfg2/Reporting/migrations/0006_add_user_group_entry_support.py
+++ b/src/lib/Bcfg2/Reporting/migrations/0006_add_user_group_entry_support.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
+
from django.db import models, migrations
diff --git a/src/lib/Bcfg2/Reporting/migrations/0007_add_flag_fields_interaction.py b/src/lib/Bcfg2/Reporting/migrations/0007_add_flag_fields_interaction.py
index 1d1274288..cee34ea5d 100644
--- a/src/lib/Bcfg2/Reporting/migrations/0007_add_flag_fields_interaction.py
+++ b/src/lib/Bcfg2/Reporting/migrations/0007_add_flag_fields_interaction.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
+
from django.db import models, migrations
diff --git a/src/lib/Bcfg2/Reporting/migrations/0008_add_ready_flag_interaction.py b/src/lib/Bcfg2/Reporting/migrations/0008_add_ready_flag_interaction.py
index 18ea6e8ba..381d80f30 100644
--- a/src/lib/Bcfg2/Reporting/migrations/0008_add_ready_flag_interaction.py
+++ b/src/lib/Bcfg2/Reporting/migrations/0008_add_ready_flag_interaction.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
+
from django.db import models, migrations
diff --git a/src/lib/Bcfg2/Reporting/migrations/0009_add_conf_entry.py b/src/lib/Bcfg2/Reporting/migrations/0009_add_conf_entry.py
index 527a7bbe9..35a3827b3 100644
--- a/src/lib/Bcfg2/Reporting/migrations/0009_add_conf_entry.py
+++ b/src/lib/Bcfg2/Reporting/migrations/0009_add_conf_entry.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
+
from django.db import migrations, models
diff --git a/src/lib/Bcfg2/Reporting/models.py b/src/lib/Bcfg2/Reporting/models.py
index 7bff0ab3b..afac6487e 100644
--- a/src/lib/Bcfg2/Reporting/models.py
+++ b/src/lib/Bcfg2/Reporting/models.py
@@ -7,7 +7,7 @@ try:
from django.db import models, connections
except ImproperlyConfigured:
e = sys.exc_info()[1]
- print("Reports: unable to import django models: %s" % e)
+ print(("Reports: unable to import django models: %s" % e))
sys.exit(1)
from django.core.cache import cache
diff --git a/src/lib/Bcfg2/Reporting/south_migrations/0009_add_conf_entry.py b/src/lib/Bcfg2/Reporting/south_migrations/0009_add_conf_entry.py
index cbbad4d59..357bc56e9 100644
--- a/src/lib/Bcfg2/Reporting/south_migrations/0009_add_conf_entry.py
+++ b/src/lib/Bcfg2/Reporting/south_migrations/0009_add_conf_entry.py
@@ -9,8 +9,8 @@ class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'ConfEntry'
- db.create_table(u'Reporting_confentry', (
- (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ db.create_table('Reporting_confentry', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('name', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)),
('hash_key', self.gf('django.db.models.fields.BigIntegerField')(db_index=True)),
('state', self.gf('django.db.models.fields.IntegerField')()),
@@ -18,186 +18,186 @@ class Migration(SchemaMigration):
('value', self.gf('django.db.models.fields.TextField')(null=True)),
('current_value', self.gf('django.db.models.fields.TextField')(null=True)),
))
- db.send_create_signal(u'Reporting', ['ConfEntry'])
+ db.send_create_signal('Reporting', ['ConfEntry'])
# Adding M2M table for field confs on 'Interaction'
- m2m_table_name = db.shorten_name(u'Reporting_interaction_confs')
+ m2m_table_name = db.shorten_name('Reporting_interaction_confs')
db.create_table(m2m_table_name, (
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
- ('interaction', models.ForeignKey(orm[u'Reporting.interaction'], null=False)),
- ('confentry', models.ForeignKey(orm[u'Reporting.confentry'], null=False))
+ ('interaction', models.ForeignKey(orm['Reporting.interaction'], null=False)),
+ ('confentry', models.ForeignKey(orm['Reporting.confentry'], null=False))
))
db.create_unique(m2m_table_name, ['interaction_id', 'confentry_id'])
def backwards(self, orm):
# Deleting model 'ConfEntry'
- db.delete_table(u'Reporting_confentry')
+ db.delete_table('Reporting_confentry')
# Removing M2M table for field confs on 'Interaction'
- db.delete_table(db.shorten_name(u'Reporting_interaction_confs'))
+ db.delete_table(db.shorten_name('Reporting_interaction_confs'))
models = {
- u'Reporting.actionentry': {
+ 'Reporting.actionentry': {
'Meta': {'ordering': "('state', 'name')", 'object_name': 'ActionEntry'},
'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}),
- u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}),
'output': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
'state': ('django.db.models.fields.IntegerField', [], {}),
'status': ('django.db.models.fields.CharField', [], {'default': "'check'", 'max_length': '128'})
},
- u'Reporting.bundle': {
+ 'Reporting.bundle': {
'Meta': {'ordering': "('name',)", 'object_name': 'Bundle'},
- u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'})
},
- u'Reporting.client': {
+ 'Reporting.client': {
'Meta': {'object_name': 'Client'},
'creation': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
- 'current_interaction': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'parent_client'", 'null': 'True', 'to': u"orm['Reporting.Interaction']"}),
+ 'current_interaction': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'parent_client'", 'null': 'True', 'to': "orm['Reporting.Interaction']"}),
'expiration': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
- u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '128'})
},
- u'Reporting.confentry': {
+ 'Reporting.confentry': {
'Meta': {'ordering': "('state', 'name')", 'object_name': 'ConfEntry'},
'current_value': ('django.db.models.fields.TextField', [], {'null': 'True'}),
'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}),
- u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}),
'state': ('django.db.models.fields.IntegerField', [], {}),
'value': ('django.db.models.fields.TextField', [], {'null': 'True'})
},
- u'Reporting.deviceentry': {
- 'Meta': {'ordering': "('state', 'name')", 'object_name': 'DeviceEntry', '_ormbases': [u'Reporting.PathEntry']},
+ 'Reporting.deviceentry': {
+ 'Meta': {'ordering': "('state', 'name')", 'object_name': 'DeviceEntry', '_ormbases': ['Reporting.PathEntry']},
'current_major': ('django.db.models.fields.IntegerField', [], {}),
'current_minor': ('django.db.models.fields.IntegerField', [], {}),
'device_type': ('django.db.models.fields.CharField', [], {'max_length': '16'}),
- u'pathentry_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['Reporting.PathEntry']", 'unique': 'True', 'primary_key': 'True'}),
+ 'pathentry_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['Reporting.PathEntry']", 'unique': 'True', 'primary_key': 'True'}),
'target_major': ('django.db.models.fields.IntegerField', [], {}),
'target_minor': ('django.db.models.fields.IntegerField', [], {})
},
- u'Reporting.failureentry': {
+ 'Reporting.failureentry': {
'Meta': {'object_name': 'FailureEntry'},
'entry_type': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}),
- u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'message': ('django.db.models.fields.TextField', [], {}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'})
},
- u'Reporting.fileacl': {
+ 'Reporting.fileacl': {
'Meta': {'object_name': 'FileAcl'},
- u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'})
},
- u'Reporting.fileperms': {
+ 'Reporting.fileperms': {
'Meta': {'unique_together': "(('owner', 'group', 'mode'),)", 'object_name': 'FilePerms'},
'group': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
- u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'mode': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'owner': ('django.db.models.fields.CharField', [], {'max_length': '128'})
},
- u'Reporting.group': {
+ 'Reporting.group': {
'Meta': {'ordering': "('name',)", 'object_name': 'Group'},
- 'bundles': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['Reporting.Bundle']", 'symmetrical': 'False'}),
+ 'bundles': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Bundle']", 'symmetrical': 'False'}),
'category': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}),
'comment': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
- 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['Reporting.Group']", 'symmetrical': 'False'}),
- u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Group']", 'symmetrical': 'False'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}),
'profile': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'public': ('django.db.models.fields.BooleanField', [], {'default': 'False'})
},
- u'Reporting.interaction': {
+ 'Reporting.interaction': {
'Meta': {'ordering': "['-timestamp']", 'unique_together': "(('client', 'timestamp'),)", 'object_name': 'Interaction'},
- 'actions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['Reporting.ActionEntry']", 'symmetrical': 'False'}),
+ 'actions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.ActionEntry']", 'symmetrical': 'False'}),
'bad_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
- 'bundles': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['Reporting.Bundle']", 'symmetrical': 'False'}),
- 'client': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'interactions'", 'to': u"orm['Reporting.Client']"}),
- 'confs': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['Reporting.ConfEntry']", 'symmetrical': 'False'}),
+ 'bundles': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Bundle']", 'symmetrical': 'False'}),
+ 'client': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'interactions'", 'to': "orm['Reporting.Client']"}),
+ 'confs': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.ConfEntry']", 'symmetrical': 'False'}),
'dry_run': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'extra_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
- 'failures': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['Reporting.FailureEntry']", 'symmetrical': 'False'}),
+ 'failures': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.FailureEntry']", 'symmetrical': 'False'}),
'good_count': ('django.db.models.fields.IntegerField', [], {}),
- 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['Reporting.Group']", 'symmetrical': 'False'}),
- u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Group']", 'symmetrical': 'False'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'modified_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
'only_important': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
- 'packages': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['Reporting.PackageEntry']", 'symmetrical': 'False'}),
- 'paths': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['Reporting.PathEntry']", 'symmetrical': 'False'}),
- 'posixgroups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['Reporting.POSIXGroupEntry']", 'symmetrical': 'False'}),
- 'posixusers': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['Reporting.POSIXUserEntry']", 'symmetrical': 'False'}),
- 'profile': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'null': 'True', 'to': u"orm['Reporting.Group']"}),
+ 'packages': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.PackageEntry']", 'symmetrical': 'False'}),
+ 'paths': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.PathEntry']", 'symmetrical': 'False'}),
+ 'posixgroups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.POSIXGroupEntry']", 'symmetrical': 'False'}),
+ 'posixusers': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.POSIXUserEntry']", 'symmetrical': 'False'}),
+ 'profile': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'null': 'True', 'to': "orm['Reporting.Group']"}),
'ready': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'repo_rev_code': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
- 'sebooleans': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['Reporting.SEBooleanEntry']", 'symmetrical': 'False'}),
- 'sefcontexts': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['Reporting.SEFcontextEntry']", 'symmetrical': 'False'}),
- 'seinterfaces': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['Reporting.SEInterfaceEntry']", 'symmetrical': 'False'}),
- 'selogins': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['Reporting.SELoginEntry']", 'symmetrical': 'False'}),
- 'semodules': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['Reporting.SEModuleEntry']", 'symmetrical': 'False'}),
- 'senodes': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['Reporting.SENodeEntry']", 'symmetrical': 'False'}),
- 'sepermissives': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['Reporting.SEPermissiveEntry']", 'symmetrical': 'False'}),
- 'seports': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['Reporting.SEPortEntry']", 'symmetrical': 'False'}),
+ 'sebooleans': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEBooleanEntry']", 'symmetrical': 'False'}),
+ 'sefcontexts': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEFcontextEntry']", 'symmetrical': 'False'}),
+ 'seinterfaces': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEInterfaceEntry']", 'symmetrical': 'False'}),
+ 'selogins': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SELoginEntry']", 'symmetrical': 'False'}),
+ 'semodules': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEModuleEntry']", 'symmetrical': 'False'}),
+ 'senodes': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SENodeEntry']", 'symmetrical': 'False'}),
+ 'sepermissives': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEPermissiveEntry']", 'symmetrical': 'False'}),
+ 'seports': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEPortEntry']", 'symmetrical': 'False'}),
'server': ('django.db.models.fields.CharField', [], {'max_length': '256'}),
- 'services': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['Reporting.ServiceEntry']", 'symmetrical': 'False'}),
- 'seusers': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['Reporting.SEUserEntry']", 'symmetrical': 'False'}),
+ 'services': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.ServiceEntry']", 'symmetrical': 'False'}),
+ 'seusers': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEUserEntry']", 'symmetrical': 'False'}),
'state': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
'timestamp': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),
'total_count': ('django.db.models.fields.IntegerField', [], {})
},
- u'Reporting.linkentry': {
- 'Meta': {'ordering': "('state', 'name')", 'object_name': 'LinkEntry', '_ormbases': [u'Reporting.PathEntry']},
+ 'Reporting.linkentry': {
+ 'Meta': {'ordering': "('state', 'name')", 'object_name': 'LinkEntry', '_ormbases': ['Reporting.PathEntry']},
'current_path': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}),
- u'pathentry_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['Reporting.PathEntry']", 'unique': 'True', 'primary_key': 'True'}),
+ 'pathentry_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['Reporting.PathEntry']", 'unique': 'True', 'primary_key': 'True'}),
'target_path': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'})
},
- u'Reporting.packageentry': {
+ 'Reporting.packageentry': {
'Meta': {'ordering': "('state', 'name')", 'object_name': 'PackageEntry'},
'current_version': ('django.db.models.fields.CharField', [], {'max_length': '1024'}),
'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}),
- u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}),
'state': ('django.db.models.fields.IntegerField', [], {}),
'target_version': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '1024'}),
'verification_details': ('django.db.models.fields.TextField', [], {'default': "''"})
},
- u'Reporting.pathentry': {
+ 'Reporting.pathentry': {
'Meta': {'ordering': "('state', 'name')", 'object_name': 'PathEntry'},
- 'acls': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['Reporting.FileAcl']", 'symmetrical': 'False'}),
- 'current_perms': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': u"orm['Reporting.FilePerms']"}),
+ 'acls': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.FileAcl']", 'symmetrical': 'False'}),
+ 'current_perms': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['Reporting.FilePerms']"}),
'detail_type': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
'details': ('django.db.models.fields.TextField', [], {'default': "''"}),
'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}),
- u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}),
'path_type': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'state': ('django.db.models.fields.IntegerField', [], {}),
- 'target_perms': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': u"orm['Reporting.FilePerms']"})
+ 'target_perms': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['Reporting.FilePerms']"})
},
- u'Reporting.performance': {
+ 'Reporting.performance': {
'Meta': {'object_name': 'Performance'},
- u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'interaction': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'performance_items'", 'to': u"orm['Reporting.Interaction']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'interaction': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'performance_items'", 'to': "orm['Reporting.Interaction']"}),
'metric': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'value': ('django.db.models.fields.DecimalField', [], {'max_digits': '32', 'decimal_places': '16'})
},
- u'Reporting.posixgroupentry': {
+ 'Reporting.posixgroupentry': {
'Meta': {'ordering': "('state', 'name')", 'object_name': 'POSIXGroupEntry'},
'current_gid': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'gid': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}),
- u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}),
'state': ('django.db.models.fields.IntegerField', [], {})
},
- u'Reporting.posixuserentry': {
+ 'Reporting.posixuserentry': {
'Meta': {'ordering': "('state', 'name')", 'object_name': 'POSIXUserEntry'},
'current_gecos': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True'}),
'current_group': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True'}),
@@ -209,108 +209,108 @@ class Migration(SchemaMigration):
'group': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}),
'home': ('django.db.models.fields.CharField', [], {'max_length': '1024'}),
- u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}),
'shell': ('django.db.models.fields.CharField', [], {'default': "'/bin/bash'", 'max_length': '1024'}),
'state': ('django.db.models.fields.IntegerField', [], {}),
'uid': ('django.db.models.fields.IntegerField', [], {'null': 'True'})
},
- u'Reporting.sebooleanentry': {
+ 'Reporting.sebooleanentry': {
'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEBooleanEntry'},
'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}),
- u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}),
'state': ('django.db.models.fields.IntegerField', [], {}),
'value': ('django.db.models.fields.BooleanField', [], {'default': 'True'})
},
- u'Reporting.sefcontextentry': {
+ 'Reporting.sefcontextentry': {
'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEFcontextEntry'},
'current_selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}),
'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'filetype': ('django.db.models.fields.CharField', [], {'max_length': '16'}),
'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}),
- u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}),
'selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'state': ('django.db.models.fields.IntegerField', [], {})
},
- u'Reporting.seinterfaceentry': {
+ 'Reporting.seinterfaceentry': {
'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEInterfaceEntry'},
'current_selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}),
'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}),
- u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}),
'selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'state': ('django.db.models.fields.IntegerField', [], {})
},
- u'Reporting.seloginentry': {
+ 'Reporting.seloginentry': {
'Meta': {'ordering': "('state', 'name')", 'object_name': 'SELoginEntry'},
'current_selinuxuser': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}),
'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}),
- u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}),
'selinuxuser': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'state': ('django.db.models.fields.IntegerField', [], {})
},
- u'Reporting.semoduleentry': {
+ 'Reporting.semoduleentry': {
'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEModuleEntry'},
'current_disabled': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'disabled': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}),
- u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}),
'state': ('django.db.models.fields.IntegerField', [], {})
},
- u'Reporting.senodeentry': {
+ 'Reporting.senodeentry': {
'Meta': {'ordering': "('state', 'name')", 'object_name': 'SENodeEntry'},
'current_selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}),
'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}),
- u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}),
'proto': ('django.db.models.fields.CharField', [], {'max_length': '4'}),
'selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'state': ('django.db.models.fields.IntegerField', [], {})
},
- u'Reporting.sepermissiveentry': {
+ 'Reporting.sepermissiveentry': {
'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEPermissiveEntry'},
'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}),
- u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}),
'state': ('django.db.models.fields.IntegerField', [], {})
},
- u'Reporting.seportentry': {
+ 'Reporting.seportentry': {
'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEPortEntry'},
'current_selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}),
'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}),
- u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}),
'selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'state': ('django.db.models.fields.IntegerField', [], {})
},
- u'Reporting.serviceentry': {
+ 'Reporting.serviceentry': {
'Meta': {'ordering': "('state', 'name')", 'object_name': 'ServiceEntry'},
'current_status': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128'}),
'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}),
- u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}),
'state': ('django.db.models.fields.IntegerField', [], {}),
'target_status': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128'})
},
- u'Reporting.seuserentry': {
+ 'Reporting.seuserentry': {
'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEUserEntry'},
'current_prefix': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}),
'current_roles': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}),
'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}),
- u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}),
'prefix': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'roles': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
diff --git a/src/lib/Bcfg2/Reporting/utils.py b/src/lib/Bcfg2/Reporting/utils.py
index 694f38824..4165477ab 100755
--- a/src/lib/Bcfg2/Reporting/utils.py
+++ b/src/lib/Bcfg2/Reporting/utils.py
@@ -19,7 +19,7 @@ class BatchFetch(object):
def __iter__(self):
return self
- def next(self):
+ def __next__(self):
"""Provide compatibility with python < 3.0"""
return self.__next__()
diff --git a/src/lib/Bcfg2/Reporting/views.py b/src/lib/Bcfg2/Reporting/views.py
index 3b9e2e53b..cef0958d9 100644
--- a/src/lib/Bcfg2/Reporting/views.py
+++ b/src/lib/Bcfg2/Reporting/views.py
@@ -329,7 +329,7 @@ def client_detail(request, hostname=None, pk=None):
TYPE_MODIFIED: 'modified',
TYPE_EXTRA: 'extra'}
edict = dict()
- for label in etypes.values():
+ for label in list(etypes.values()):
edict[label] = []
for ekind in inter.entry_types:
if ekind == 'failures':
diff --git a/src/lib/Bcfg2/Server/Admin.py b/src/lib/Bcfg2/Server/Admin.py
index 0accd0361..98ce9e524 100644
--- a/src/lib/Bcfg2/Server/Admin.py
+++ b/src/lib/Bcfg2/Server/Admin.py
@@ -92,8 +92,8 @@ def print_table(rows, justify='left', hdr=True, vdelim=" ", padding=1):
# Print out the table
print(borderline)
for row in rows:
- print(vdelim.join([justify(str(item), width)
- for (item, width) in zip(row, col_widths)]))
+ print((vdelim.join([justify(str(item), width)
+ for (item, width) in zip(row, col_widths)])))
if hdr:
print(borderline)
hdr = False
@@ -173,7 +173,7 @@ class Backup(AdminCmd):
out = tarfile.open(os.path.join(datastore, filename), mode=mode)
out.add(datastore, os.path.basename(datastore))
out.close()
- print("Archive %s was stored under %s" % (filename, datastore))
+ print(("Archive %s was stored under %s" % (filename, datastore)))
class Client(_ServerAdminCmd):
@@ -199,8 +199,8 @@ class Client(_ServerAdminCmd):
for i in setup.attributes:
attr, val = i.split('=', 1)
if attr not in self.valid_attribs:
- print("Attribute %s unknown. Valid attributes: %s" %
- (attr, self.valid_attribs))
+ print(("Attribute %s unknown. Valid attributes: %s" %
+ (attr, self.valid_attribs)))
raise SystemExit(1)
attr_d[attr] = val
return attr_d
@@ -387,7 +387,7 @@ class Compare(AdminCmd):
for el in bundle.getchildren():
elements2["%s:%s" % (el.tag, el.get("name"))] = el
- for el in elements1.values():
+ for el in list(elements1.values()):
elid = "%s:%s" % (el.tag, el.get("name"))
if elid not in elements2:
self.removed("Element %s" % elid, host)
@@ -428,16 +428,16 @@ class Compare(AdminCmd):
lines=setup.diff_lines))
self.changed("\n".join(err), host)
- for el in elements2.values():
+ for el in list(elements2.values()):
elid = "%s:%s" % (el.tag, el.get("name"))
if elid not in elements2:
self.removed("Element %s" % elid, host)
- for change, hosts in self.changes.items():
+ for change, hosts in list(self.changes.items()):
hlist = [h for h in hosts if h is not None]
if len(files) > 1 and len(hlist):
- print("===== %s =====" %
- "\n ".join(hostnames2ranges(hlist)))
+ print(("===== %s =====" %
+ "\n ".join(hostnames2ranges(hlist))))
print(change)
if len(files) > 1 and len(hlist):
print("")
@@ -636,7 +636,7 @@ bcfg2 = %s
result = safe_input("\nWarning: %s already exists. "
"Overwrite? [y/N]: " % self.data['configfile'])
if result not in ['Y', 'y']:
- print("Leaving %s unchanged" % self.data['configfile'])
+ print(("Leaving %s unchanged" % self.data['configfile']))
return
try:
open(self.data['configfile'], "w").write(confdata)
@@ -654,10 +654,10 @@ bcfg2 = %s
try:
os.makedirs(path)
self._init_plugins()
- print("Repository created successfuly in %s" %
- self.data['repopath'])
+ print(("Repository created successfuly in %s" %
+ self.data['repopath']))
except OSError:
- print("Failed to create %s." % path)
+ print(("Failed to create %s." % path))
# Create the configuration file and SSL key
self.create_conf()
@@ -674,21 +674,21 @@ bcfg2 = %s
"-newkey", "rsa:2048",
"-keyout", self.data['keypath'], "-noout"])
if not key.success:
- print("Error generating key: %s" % key.error)
+ print(("Error generating key: %s" % key.error))
return
os.chmod(self.data['keypath'], stat.S_IRUSR | stat.S_IWUSR) # 0600
csr = cmd.run(["openssl", "req", "-batch", "-new", "-subj", subject,
"-key", self.data['keypath']])
if not csr.success:
- print("Error generating certificate signing request: %s" %
- csr.error)
+ print(("Error generating certificate signing request: %s" %
+ csr.error))
return
cert = cmd.run(["openssl", "x509", "-req", "-days", "1000",
"-signkey", self.data['keypath'],
"-out", self.data['certpath']],
inputdata=csr.stdout)
if not cert.success:
- print("Error signing certificate: %s" % cert.error)
+ print(("Error signing certificate: %s" % cert.error))
return
@@ -774,9 +774,9 @@ class Pull(_ServerAdminCmd):
try:
self.PullEntry(*line.split(None, 3))
except SystemExit:
- print(" for %s" % line)
+ print((" for %s" % line))
except:
- print("Bad entry: %s" % line.strip())
+ print(("Bad entry: %s" % line.strip()))
else:
self.PullEntry(setup.hostname, setup.entrytype, setup.entryname)
@@ -818,10 +818,10 @@ class Pull(_ServerAdminCmd):
if choice.all:
print(" => global entry")
elif choice.group:
- print(" => group entry: %s (prio %d)" %
- (choice.group, choice.prio))
+ print((" => group entry: %s (prio %d)" %
+ (choice.group, choice.prio)))
else:
- print(" => host entry: %s" % (choice.hostname))
+ print((" => host entry: %s" % (choice.hostname)))
# flush input buffer
ans = safe_input("Use this entry? [yN]: ") in ['y', 'Y']
@@ -979,8 +979,8 @@ if HAS_REPORTS:
(start_count - cls.objects.count(),
cls.__name__))
except: # pylint: disable=W0702
- print("Failed to prune %s: %s" %
- (cls.__name__, sys.exc_info()[1]))
+ print(("Failed to prune %s: %s" %
+ (cls.__name__, sys.exc_info()[1])))
class InitReports(AdminCmd):
""" Initialize the Reporting database """
@@ -1003,8 +1003,8 @@ if HAS_REPORTS:
""" Print Reporting database statistics """
def run(self, _):
for cls in self.reports_classes:
- print("%s has %s records" % (cls.__name__,
- cls.objects.count()))
+ print(("%s has %s records" % (cls.__name__,
+ cls.objects.count())))
class PurgeReports(_ReportsCmd):
""" Purge records from the Reporting database """
@@ -1198,7 +1198,7 @@ class Viz(_ServerAdminCmd):
if not result.success:
self.errExit("Error running %s: %s" % (cmd, result.error))
if not setup.outfile:
- print(result.stdout)
+ print((result.stdout))
class Xcmd(_ProxyAdminCmd):
@@ -1223,7 +1223,7 @@ class CLI(Bcfg2.Options.CommandRegistry):
def __init__(self):
Bcfg2.Options.CommandRegistry.__init__(self)
- self.register_commands(globals().values(), parent=AdminCmd)
+ self.register_commands(list(globals().values()), parent=AdminCmd)
parser = Bcfg2.Options.get_parser(
description="Manage a running Bcfg2 server",
components=[self])
diff --git a/src/lib/Bcfg2/Server/Cache.py b/src/lib/Bcfg2/Server/Cache.py
index b3b906b2c..cba36d7d5 100644
--- a/src/lib/Bcfg2/Server/Cache.py
+++ b/src/lib/Bcfg2/Server/Cache.py
@@ -127,7 +127,7 @@ class _CacheRegistry(dict):
for :class:`Bcfg2.Server.Cache._Cache` objects that have been
instantiated via :func:`Bcfg2.Server.Cache.Cache`. """
tags = frozenset(tags)
- for key in self.keys():
+ for key in list(self.keys()):
if key.issuperset(tags) and len(key.difference(tags)) == 1:
yield key
diff --git a/src/lib/Bcfg2/Server/Core.py b/src/lib/Bcfg2/Server/Core.py
index a1ee24e18..78eed4b3e 100644
--- a/src/lib/Bcfg2/Server/Core.py
+++ b/src/lib/Bcfg2/Server/Core.py
@@ -301,7 +301,7 @@ class Core(object):
:returns: list of :attr:`Bcfg2.Server.Plugin.base.Plugin`
objects
"""
- return sorted([plugin for plugin in self.plugins.values()
+ return sorted([plugin for plugin in list(self.plugins.values())
if isinstance(plugin, base_cls)],
key=lambda p: (p.sort_order, p.name))
@@ -312,7 +312,7 @@ class Core(object):
while not self.terminate.isSet():
self.terminate.wait(Bcfg2.Options.setup.performance_interval)
if not self.terminate.isSet():
- for name, stats in self.get_statistics(None).items():
+ for name, stats in list(self.get_statistics(None).items()):
self.logger.info("Performance statistics: "
"%s min=%.06f, max=%.06f, average=%.06f, "
"count=%d" % ((name, ) + stats))
@@ -1041,7 +1041,7 @@ class Core(object):
def _get_rmi(self):
""" Get a list of RMI calls exposed by plugins """
rmi = dict()
- for pname, pinst in self._get_rmi_objects().items():
+ for pname, pinst in list(self._get_rmi_objects().items()):
for mname in pinst.__rmi__:
rmi["%s.%s" % (pname, mname)] = getattr(pinst, mname)
return rmi
@@ -1076,7 +1076,7 @@ class Core(object):
for name, func in inspect.getmembers(self, callable)
if (getattr(func, "exposed", False) and
self.check_acls(address, name))]
- methods.extend([m for m in self._get_rmi().keys()
+ methods.extend([m for m in list(self._get_rmi().keys())
if self.check_acls(address, m)])
return methods
@@ -1323,7 +1323,7 @@ class Core(object):
"""
if debug not in [True, False]:
debug = debug.lower() == "true"
- for plugin in self.plugins.values():
+ for plugin in list(self.plugins.values()):
plugin.set_debug(debug)
rv = self.set_core_debug(address, debug)
return self.fam.set_debug(debug) and rv
diff --git a/src/lib/Bcfg2/Server/Encryption.py b/src/lib/Bcfg2/Server/Encryption.py
index c6cd4232e..bc12eb129 100755
--- a/src/lib/Bcfg2/Server/Encryption.py
+++ b/src/lib/Bcfg2/Server/Encryption.py
@@ -199,7 +199,7 @@ def bruteforce_decrypt(crypted, passphrases=None, algorithm=None):
:raises: :class:`M2Crypto.EVP.EVPError`, if the data cannot be decrypted
"""
if passphrases is None:
- passphrases = Bcfg2.Options.setup.passphrases.values()
+ passphrases = list(Bcfg2.Options.setup.passphrases.values())
for passwd in passphrases:
try:
return ssl_decrypt(crypted, passwd, algorithm=algorithm)
@@ -278,7 +278,7 @@ class CryptoTool(object):
(pname, Bcfg2.Options.setup.config))
else:
if len(Bcfg2.Options.setup.passphrases) == 1:
- pname, passphrase = Bcfg2.Options.setup.passphrases.items()[0]
+ pname, passphrase = list(Bcfg2.Options.setup.passphrases.items())[0]
self.logger.info("Using passphrase %s" % pname)
return (pname, passphrase)
elif len(Bcfg2.Options.setup.passphrases) > 1:
@@ -399,9 +399,9 @@ class PropertiesCryptoMixin(object):
elt.remove(child)
else:
elt = element
- print(lxml.etree.tostring(
+ print((lxml.etree.tostring(
elt,
- xml_declaration=False).decode("UTF-8").strip())
+ xml_declaration=False).decode("UTF-8").strip()))
ans = safe_input("Encrypt this element? [y/N] ")
if not ans.lower().startswith("y"):
elements.remove(element)
@@ -664,7 +664,7 @@ class CLI(object):
continue
if Bcfg2.Options.setup.stdout:
if len(Bcfg2.Options.setup.files) > 1:
- print("----- %s -----" % fname)
+ print(("----- %s -----" % fname))
print(data)
if len(Bcfg2.Options.setup.files) > 1:
print("")
diff --git a/src/lib/Bcfg2/Server/FileMonitor/Inotify.py b/src/lib/Bcfg2/Server/FileMonitor/Inotify.py
index 8f6e136fd..6ed938e18 100644
--- a/src/lib/Bcfg2/Server/FileMonitor/Inotify.py
+++ b/src/lib/Bcfg2/Server/FileMonitor/Inotify.py
@@ -7,6 +7,7 @@ import pyinotify
from Bcfg2.Compat import reduce # pylint: disable=W0622
from Bcfg2.Server.FileMonitor import Event
from Bcfg2.Server.FileMonitor.Pseudo import Pseudo
+from functools import reduce
class Inotify(Pseudo, pyinotify.ProcessEvent):
@@ -32,7 +33,7 @@ class Inotify(Pseudo, pyinotify.ProcessEvent):
#: The pyinotify event mask. We only ask for events that are
#: listed in :attr:`action_map`
- mask = reduce(lambda x, y: x | y, action_map.keys())
+ mask = reduce(lambda x, y: x | y, list(action_map.keys()))
def __init__(self):
Pseudo.__init__(self)
@@ -106,7 +107,7 @@ class Inotify(Pseudo, pyinotify.ProcessEvent):
:type ievent: pyinotify._Event
"""
action = ievent.maskname
- for amask, aname in self.action_map.items():
+ for amask, aname in list(self.action_map.items()):
if ievent.mask & amask:
action = aname
break
diff --git a/src/lib/Bcfg2/Server/FileMonitor/__init__.py b/src/lib/Bcfg2/Server/FileMonitor/__init__.py
index c10677804..0f51e0d2b 100644
--- a/src/lib/Bcfg2/Server/FileMonitor/__init__.py
+++ b/src/lib/Bcfg2/Server/FileMonitor/__init__.py
@@ -327,7 +327,7 @@ class FileMonitor(Debuggable):
:attr:`Bcfg2.Server.FileMonitor.FileMonitor.handles` for
debugging purposes. """
rv = dict()
- for watch, handler in self.handles.items():
+ for watch, handler in list(self.handles.items()):
rv[watch] = getattr(handler, "name", handler.__class__.__name__)
return rv
@@ -377,7 +377,7 @@ try:
except ImportError:
pass
-for fdrv in reversed(sorted(available.keys(),
+for fdrv in reversed(sorted(list(available.keys()),
key=lambda k: available[k].__priority__)):
if fdrv in available:
available['default'] = available[fdrv]
diff --git a/src/lib/Bcfg2/Server/Info.py b/src/lib/Bcfg2/Server/Info.py
index 044dcdf0c..cd9a98c86 100644
--- a/src/lib/Bcfg2/Server/Info.py
+++ b/src/lib/Bcfg2/Server/Info.py
@@ -38,10 +38,10 @@ def print_tabular(rows):
for index in range(len(rows[0]))])
fstring = (" %%-%ss |" * len(cmax)) % cmax
fstring = ('|'.join([" %%-%ss "] * len(cmax))) % cmax
- print(fstring % rows[0])
- print((sum(cmax) + (len(cmax) * 2) + (len(cmax) - 1)) * '=')
+ print((fstring % rows[0]))
+ print(((sum(cmax) + (len(cmax) * 2) + (len(cmax) - 1)) * '='))
for row in rows[1:]:
- print(fstring % row)
+ print((fstring % row))
def display_trace(trace):
@@ -137,7 +137,7 @@ class Debug(InfoCmd):
Bcfg2.Options.Option(
"--interpreter", cf=("bcfg2-info", "interpreter"),
env="BCFG2_INFO_INTERPRETER",
- choices=interpreters.keys(), default=default_interpreter)]
+ choices=list(interpreters.keys()), default=default_interpreter)]
def run(self, setup):
if setup.cmd_list:
@@ -167,7 +167,7 @@ class Build(InfoCmd):
pretty_print=True)
except IOError:
err = sys.exc_info()[1]
- print("Failed to write %s: %s" % (setup.filename, err))
+ print(("Failed to write %s: %s" % (setup.filename, err)))
class Builddir(InfoCmd):
@@ -200,8 +200,8 @@ dir>. This only handles file entries, and does not respect 'owner' or
entry.get("type") not in self.blacklisted_types):
failure = entry.get("failure")
if failure is not None:
- print("Skipping entry %s:%s with bind failure: %s" %
- (entry.tag, entry.get("name"), failure))
+ print(("Skipping entry %s:%s with bind failure: %s" %
+ (entry.tag, entry.get("name"), failure)))
continue
entry.set('name',
os.path.join(setup.directory,
@@ -228,8 +228,8 @@ class Buildfile(InfoCmd):
try:
self.core.Bind(entry, self.core.build_metadata(setup.hostname))
except: # pylint: disable=W0702
- print("Failed to build entry %s for host %s" % (setup.filename,
- setup.hostname))
+ print(("Failed to build entry %s for host %s" % (setup.filename,
+ setup.hostname)))
raise
try:
setup.outfile.write(
@@ -238,7 +238,7 @@ class Buildfile(InfoCmd):
setup.outfile.write("\n")
except IOError:
err = sys.exc_info()[1]
- print("Failed to write %s: %s" % (setup.outfile.name, err))
+ print(("Failed to write %s: %s" % (setup.outfile.name, err)))
class BuildAllMixin(object):
@@ -265,7 +265,7 @@ class BuildAllMixin(object):
except OSError:
err = sys.exc_info()[1]
if err.errno != 17:
- print("Could not create %s: %s" % (setup.directory, err))
+ print(("Could not create %s: %s" % (setup.directory, err)))
return 1
clients = self.get_client_list(setup.hostname)
for client in clients:
@@ -324,16 +324,16 @@ class Buildbundle(InfoCmd):
if fname in bundler.entries:
bundle = bundler.entries[bundle]
if not bundle:
- print("No such bundle %s" % setup.bundle)
+ print(("No such bundle %s" % setup.bundle))
return 1
try:
metadata = self.core.build_metadata(setup.hostname)
- print(lxml.etree.tostring(bundle.XMLMatch(metadata),
+ print((lxml.etree.tostring(bundle.XMLMatch(metadata),
xml_declaration=False,
- pretty_print=True).decode('UTF-8'))
+ pretty_print=True).decode('UTF-8')))
except: # pylint: disable=W0702
- print("Failed to render bundle %s for host %s: %s" %
- (setup.bundle, setup.hostname, sys.exc_info()[1]))
+ print(("Failed to render bundle %s for host %s: %s" %
+ (setup.bundle, setup.hostname, sys.exc_info()[1])))
raise
@@ -358,12 +358,12 @@ class Automatch(InfoCmd):
if (not Bcfg2.Options.setup.force and
not Bcfg2.Options.setup.automatch and
pfile.xdata.get("automatch", "false").lower() != "true"):
- print("Automatch not enabled on %s" % setup.propertyfile)
+ print(("Automatch not enabled on %s" % setup.propertyfile))
else:
metadata = self.core.build_metadata(setup.hostname)
- print(lxml.etree.tostring(pfile.XMLMatch(metadata),
+ print((lxml.etree.tostring(pfile.XMLMatch(metadata),
xml_declaration=False,
- pretty_print=True).decode('UTF-8'))
+ pretty_print=True).decode('UTF-8')))
class ExpireCache(InfoCmd):
@@ -437,7 +437,7 @@ class Config(InfoCmd):
value = getattr(setup, option.dest)
if any(issubclass(a.__class__,
Bcfg2.Options.ComponentAction)
- for a in option.actions.values()):
+ for a in list(option.actions.values())):
if not setup.raw:
try:
if option.action.islist:
@@ -473,15 +473,15 @@ class Probes(InfoCmd):
if setup.pretty:
for probe in probes:
pname = probe.get("name")
- print("=" * (len(pname) + 2))
- print(" %s" % pname)
- print("=" * (len(pname) + 2))
+ print(("=" * (len(pname) + 2)))
+ print((" %s" % pname))
+ print(("=" * (len(pname) + 2)))
print("")
- print(probe.text)
+ print((probe.text))
print("")
else:
- print(lxml.etree.tostring(probes, xml_declaration=False,
- pretty_print=True).decode('UTF-8'))
+ print((lxml.etree.tostring(probes, xml_declaration=False,
+ pretty_print=True).decode('UTF-8')))
class Showentries(InfoCmd):
@@ -494,8 +494,8 @@ class Showentries(InfoCmd):
try:
metadata = self.core.build_metadata(setup.hostname)
except Bcfg2.Server.Plugin.MetadataConsistencyError:
- print("Unable to build metadata for %s: %s" % (setup.hostname,
- sys.exc_info()[1]))
+ print(("Unable to build metadata for %s: %s" % (setup.hostname,
+ sys.exc_info()[1])))
structures = self.core.GetStructures(metadata)
output = [('Entry Type', 'Name')]
etypes = None
@@ -540,39 +540,39 @@ class Showclient(InfoCmd):
try:
metadata = self.core.build_metadata(client)
except Bcfg2.Server.Plugin.MetadataConsistencyError:
- print("Could not build metadata for %s: %s" %
- (client, sys.exc_info()[1]))
+ print(("Could not build metadata for %s: %s" %
+ (client, sys.exc_info()[1])))
continue
fmt = "%-10s %s"
- print(fmt % ("Hostname:", metadata.hostname))
- print(fmt % ("Profile:", metadata.profile))
+ print((fmt % ("Hostname:", metadata.hostname)))
+ print((fmt % ("Profile:", metadata.profile)))
group_fmt = "%-10s %-30s %s"
header = False
for group in sorted(list(metadata.groups)):
category = ""
- for cat, grp in metadata.categories.items():
+ for cat, grp in list(metadata.categories.items()):
if grp == group:
category = "Category: %s" % cat
break
if not header:
- print(group_fmt % ("Groups:", group, category))
+ print((group_fmt % ("Groups:", group, category)))
header = True
else:
- print(group_fmt % ("", group, category))
+ print((group_fmt % ("", group, category)))
if metadata.bundles:
sorted_bundles = sorted(list(metadata.bundles))
- print(fmt % ("Bundles:", sorted_bundles[0]))
+ print((fmt % ("Bundles:", sorted_bundles[0])))
for bnd in sorted_bundles[1:]:
- print(fmt % ("", bnd))
+ print((fmt % ("", bnd)))
if metadata.connectors:
print("Connector data")
- print("=" * 80)
+ print(("=" * 80))
for conn in metadata.connectors:
if getattr(metadata, conn):
- print(fmt % (conn + ":", getattr(metadata, conn)))
- print("=" * 80)
+ print((fmt % (conn + ":", getattr(metadata, conn))))
+ print(("=" * 80))
class Mappings(InfoCmd):
@@ -625,10 +625,10 @@ class PackageResolve(InfoCmd):
pkgs._build_packages(metadata, indep, # pylint: disable=W0212
structures)
- print("%d new packages added" % len(indep.getchildren()))
+ print(("%d new packages added" % len(indep.getchildren())))
if len(indep.getchildren()):
- print(" %s" % "\n ".join(lxml.etree.tostring(p)
- for p in indep.getchildren()))
+ print((" %s" % "\n ".join(lxml.etree.tostring(p)
+ for p in indep.getchildren())))
class Packagesources(InfoCmd):
@@ -645,10 +645,10 @@ class Packagesources(InfoCmd):
try:
metadata = self.core.build_metadata(setup.hostname)
except Bcfg2.Server.Plugin.MetadataConsistencyError:
- print("Unable to build metadata for %s: %s" % (setup.hostname,
- sys.exc_info()[1]))
+ print(("Unable to build metadata for %s: %s" % (setup.hostname,
+ sys.exc_info()[1])))
return 1
- print(pkgs.get_collection(metadata).sourcelist())
+ print((pkgs.get_collection(metadata).sourcelist()))
class Query(InfoCmd):
@@ -677,7 +677,7 @@ class Query(InfoCmd):
elif setup.querybundles:
res = self.core.metadata.get_client_names_by_bundles(
setup.querybundles)
- print("\n".join(res))
+ print(("\n".join(res)))
class Quit(InfoCmd):
@@ -791,7 +791,7 @@ class ProfileTemplates(InfoCmd):
# print out per-file results
tmpltimes = []
- for tmpl, ptimes in times.items():
+ for tmpl, ptimes in list(times.items()):
try:
mean = float(sum(ptimes)) / len(ptimes)
except ZeroDivisionError:
@@ -801,10 +801,10 @@ class ProfileTemplates(InfoCmd):
std = self.stdev(ptimes)
if mean > 0.01 or median > 0.01 or std > 1 or setup.templates:
tmpltimes.append((tmpl, mean, median, std))
- print("%-50s %-9s %-11s %6s" %
- ("Template", "Mean Time", "Median Time", "σ"))
+ print(("%-50s %-9s %-11s %6s" %
+ ("Template", "Mean Time", "Median Time", "σ")))
for info in reversed(sorted(tmpltimes, key=operator.itemgetter(1))):
- print("%-50s %9.02f %11.02f %6.02f" % info)
+ print(("%-50s %9.02f %11.02f %6.02f" % info))
if HAS_PROFILE:
@@ -856,7 +856,7 @@ class CLI(cmd.Cmd, Bcfg2.Options.CommandRegistry):
Bcfg2.Options.CommandRegistry.__init__(self)
self.prompt = 'bcfg2-info> '
- self.register_commands(globals().values(), parent=InfoCmd)
+ self.register_commands(list(globals().values()), parent=InfoCmd)
parser = Bcfg2.Options.get_parser(
description="Inspect a running Bcfg2 server",
components=[self, InfoCore])
@@ -872,7 +872,7 @@ class CLI(cmd.Cmd, Bcfg2.Options.CommandRegistry):
print("Profiling functionality not available.")
self.core = InfoCore(self)
- for command in self.commands.values():
+ for command in list(self.commands.values()):
command.core = self.core
def run(self):
diff --git a/src/lib/Bcfg2/Server/Lint/Bundler.py b/src/lib/Bcfg2/Server/Lint/Bundler.py
index 7b024229b..7bf6f0baa 100644
--- a/src/lib/Bcfg2/Server/Lint/Bundler.py
+++ b/src/lib/Bcfg2/Server/Lint/Bundler.py
@@ -11,7 +11,7 @@ class Bundler(ServerPlugin):
def Run(self):
self.missing_bundles()
- for bundle in self.core.plugins['Bundler'].entries.values():
+ for bundle in list(self.core.plugins['Bundler'].entries.values()):
if self.HandlesFile(bundle.name):
self.bundle_names(bundle)
@@ -32,11 +32,11 @@ class Bundler(ServerPlugin):
ref_bundles = set([b.get("name")
for b in groupdata.findall("//Bundle")])
- for bundle in self.core.plugins['Bundler'].bundles.values():
+ for bundle in list(self.core.plugins['Bundler'].bundles.values()):
ref_bundles |= set([rb.get("name") for rb in
bundle.xdata.findall(".//RequiredBundle")])
- allbundles = self.core.plugins['Bundler'].bundles.keys()
+ allbundles = list(self.core.plugins['Bundler'].bundles.keys())
for bundle in ref_bundles:
if bundle not in allbundles:
self.LintError("bundle-not-found",
diff --git a/src/lib/Bcfg2/Server/Lint/Cfg.py b/src/lib/Bcfg2/Server/Lint/Cfg.py
index 13b04a6b8..e4eba2619 100644
--- a/src/lib/Bcfg2/Server/Lint/Cfg.py
+++ b/src/lib/Bcfg2/Server/Lint/Cfg.py
@@ -29,8 +29,8 @@ class Cfg(ServerPlugin):
""" Check that a single entryset doesn't have multiple
non-specific (i.e., 'all') handlers. """
cfg = self.core.plugins['Cfg']
- for eset in cfg.entries.values():
- alls = [e for e in eset.entries.values()
+ for eset in list(cfg.entries.values()):
+ alls = [e for e in list(eset.entries.values())
if (e.specific.all and
issubclass(e.__class__, CfgGenerator))]
if len(alls) > 1:
@@ -98,9 +98,9 @@ class Cfg(ServerPlugin):
# next, get a list of all files known to Cfg
cfg_files = set()
- for root, eset in cfg.entries.items():
+ for root, eset in list(cfg.entries.items()):
cfg_files.update(os.path.join(cfg.data, root.lstrip("/"), fname)
- for fname in eset.entries.keys())
+ for fname in list(eset.entries.keys()))
# finally, compare the two
unknown_files = all_files - cfg_files
diff --git a/src/lib/Bcfg2/Server/Lint/Comments.py b/src/lib/Bcfg2/Server/Lint/Comments.py
index fbe84de87..7061dee3f 100644
--- a/src/lib/Bcfg2/Server/Lint/Comments.py
+++ b/src/lib/Bcfg2/Server/Lint/Comments.py
@@ -180,7 +180,7 @@ class Comments(Bcfg2.Server.Lint.ServerPlugin):
def check_bundles(self):
""" Check bundle files for required comments. """
if 'Bundler' in self.core.plugins:
- for bundle in self.core.plugins['Bundler'].entries.values():
+ for bundle in list(self.core.plugins['Bundler'].entries.values()):
xdata = None
rtype = ""
try:
@@ -197,7 +197,7 @@ class Comments(Bcfg2.Server.Lint.ServerPlugin):
""" Check Properties files for required comments. """
if 'Properties' in self.core.plugins:
props = self.core.plugins['Properties']
- for propfile, pdata in props.entries.items():
+ for propfile, pdata in list(props.entries.items()):
if os.path.splitext(propfile)[1] == ".xml":
self.check_xml(pdata.name, pdata.xdata, 'properties')
@@ -243,8 +243,8 @@ class Comments(Bcfg2.Server.Lint.ServerPlugin):
""" Check Cfg files and ``info.xml`` files for required
comments. """
if 'Cfg' in self.core.plugins:
- for entryset in self.core.plugins['Cfg'].entries.values():
- for entry in entryset.entries.values():
+ for entryset in list(self.core.plugins['Cfg'].entries.values()):
+ for entry in list(entryset.entries.values()):
rtype = None
if isinstance(entry, CfgGenshiGenerator):
rtype = "genshi"
@@ -265,7 +265,7 @@ class Comments(Bcfg2.Server.Lint.ServerPlugin):
def check_probes(self):
""" Check Probes for required comments """
if 'Probes' in self.core.plugins:
- for probe in self.core.plugins['Probes'].probes.entries.values():
+ for probe in list(self.core.plugins['Probes'].probes.entries.values()):
self.check_plaintext(probe.name, probe.data, "probes")
def check_xml(self, filename, xdata, rtype):
@@ -319,21 +319,21 @@ class Comments(Bcfg2.Server.Lint.ServerPlugin):
for line in lines:
# we check for both '$<keyword>:' and '$<keyword>$' to see
# if the keyword just hasn't been expanded
- for (keyword, status) in found.items():
+ for (keyword, status) in list(found.items()):
if not status:
if '$%s:' % keyword in line:
found[keyword] = True
elif '$%s$' % keyword in line:
found[keyword] = None
- unexpanded = [keyword for (keyword, status) in found.items()
+ unexpanded = [keyword for (keyword, status) in list(found.items())
if status is None]
if unexpanded:
self.LintError("unexpanded-keywords",
"%s: Required keywords(s) found but not "
"expanded: %s" %
(filename, ", ".join(unexpanded)))
- missing = [keyword for (keyword, status) in found.items()
+ missing = [keyword for (keyword, status) in list(found.items())
if status is False]
if missing:
self.LintError("keywords-not-found",
@@ -345,11 +345,11 @@ class Comments(Bcfg2.Server.Lint.ServerPlugin):
found = dict((k, False) for k in self.required_comments(rtype))
for line in lines:
- for (comment, status) in found.items():
+ for (comment, status) in list(found.items()):
if not status:
found[comment] = comment in line
- missing = [comment for (comment, status) in found.items()
+ missing = [comment for (comment, status) in list(found.items())
if status is False]
if missing:
self.LintError("comments-not-found",
diff --git a/src/lib/Bcfg2/Server/Lint/Genshi.py b/src/lib/Bcfg2/Server/Lint/Genshi.py
index a2581e70b..fb12e4254 100644
--- a/src/lib/Bcfg2/Server/Lint/Genshi.py
+++ b/src/lib/Bcfg2/Server/Lint/Genshi.py
@@ -36,8 +36,8 @@ class Genshi(Bcfg2.Server.Lint.ServerPlugin):
def check_cfg(self):
""" Check genshi templates in Cfg for syntax errors. """
- for entryset in self.core.plugins['Cfg'].entries.values():
- for entry in entryset.entries.values():
+ for entryset in list(self.core.plugins['Cfg'].entries.values()):
+ for entry in list(entryset.entries.values()):
if (self.HandlesFile(entry.name) and
isinstance(entry, CfgGenshiGenerator) and
not entry.template):
@@ -47,7 +47,7 @@ class Genshi(Bcfg2.Server.Lint.ServerPlugin):
def check_bundler(self):
""" Check templates in Bundler for syntax errors. """
loader = TemplateLoader()
- for entry in self.core.plugins['Bundler'].entries.values():
+ for entry in list(self.core.plugins['Bundler'].entries.values()):
if (self.HandlesFile(entry.name) and
entry.template is not None):
self.check_template(loader, entry.name, cls=MarkupTemplate)
diff --git a/src/lib/Bcfg2/Server/Lint/GroupNames.py b/src/lib/Bcfg2/Server/Lint/GroupNames.py
index e28080300..3bfb4949f 100644
--- a/src/lib/Bcfg2/Server/Lint/GroupNames.py
+++ b/src/lib/Bcfg2/Server/Lint/GroupNames.py
@@ -34,7 +34,7 @@ class GroupNames(Bcfg2.Server.Lint.ServerPlugin):
def check_rules(self):
""" Check groups used in the Rules plugin for validity. """
- for rules in self.core.plugins['Rules'].entries.values():
+ for rules in list(self.core.plugins['Rules'].entries.values()):
if not self.HandlesFile(rules.name):
continue
xdata = rules.pnode.data
@@ -44,7 +44,7 @@ class GroupNames(Bcfg2.Server.Lint.ServerPlugin):
def check_bundles(self):
""" Check groups used in the Bundler plugin for validity. """
- for bundle in self.core.plugins['Bundler'].entries.values():
+ for bundle in list(self.core.plugins['Bundler'].entries.values()):
if self.HandlesFile(bundle.name) and bundle.template is None:
self.check_entries(bundle.xdata.xpath("//Group"),
bundle.name)
diff --git a/src/lib/Bcfg2/Server/Lint/InfoXML.py b/src/lib/Bcfg2/Server/Lint/InfoXML.py
index 950a86f01..cd21371e7 100644
--- a/src/lib/Bcfg2/Server/Lint/InfoXML.py
+++ b/src/lib/Bcfg2/Server/Lint/InfoXML.py
@@ -29,11 +29,11 @@ class InfoXML(Bcfg2.Server.Lint.ServerPlugin):
if 'Cfg' not in self.core.plugins:
return
- for filename, entryset in self.core.plugins['Cfg'].entries.items():
+ for filename, entryset in list(self.core.plugins['Cfg'].entries.items()):
infoxml_fname = os.path.join(entryset.path, "info.xml")
if self.HandlesFile(infoxml_fname):
found = False
- for entry in entryset.entries.values():
+ for entry in list(entryset.entries.values()):
if isinstance(entry, CfgInfoXML):
self.check_infoxml(infoxml_fname,
entry.infoxml.xdata)
diff --git a/src/lib/Bcfg2/Server/Lint/Jinja2.py b/src/lib/Bcfg2/Server/Lint/Jinja2.py
index 333249cc2..0b177d640 100644
--- a/src/lib/Bcfg2/Server/Lint/Jinja2.py
+++ b/src/lib/Bcfg2/Server/Lint/Jinja2.py
@@ -34,8 +34,8 @@ class Jinja2(Bcfg2.Server.Lint.ServerPlugin):
def check_cfg(self):
""" Check jinja2 templates in Cfg for syntax errors. """
- for entryset in self.core.plugins['Cfg'].entries.values():
- for entry in entryset.entries.values():
+ for entryset in list(self.core.plugins['Cfg'].entries.values()):
+ for entry in list(entryset.entries.values()):
if (self.HandlesFile(entry.name) and
isinstance(entry, CfgJinja2Generator)):
self.check_template(entry)
diff --git a/src/lib/Bcfg2/Server/Lint/MergeFiles.py b/src/lib/Bcfg2/Server/Lint/MergeFiles.py
index 3b89e507a..b1a0fa8ef 100644
--- a/src/lib/Bcfg2/Server/Lint/MergeFiles.py
+++ b/src/lib/Bcfg2/Server/Lint/MergeFiles.py
@@ -48,8 +48,8 @@ class MergeFiles(Bcfg2.Server.Lint.ServerPlugin):
if not hdlr.__specific__:
ignore.extend(hdlr.__basenames__)
- for filename, entryset in self.core.plugins['Cfg'].entries.items():
- candidates = dict([(f, e) for f, e in entryset.entries.items()
+ for filename, entryset in list(self.core.plugins['Cfg'].entries.items()):
+ candidates = dict([(f, e) for f, e in list(entryset.entries.items())
if (isinstance(e, CfgGenerator) and
is_string(e.data,
Bcfg2.Options.setup.encoding) and
diff --git a/src/lib/Bcfg2/Server/Lint/Metadata.py b/src/lib/Bcfg2/Server/Lint/Metadata.py
index e445892d1..3c1d49a45 100644
--- a/src/lib/Bcfg2/Server/Lint/Metadata.py
+++ b/src/lib/Bcfg2/Server/Lint/Metadata.py
@@ -131,7 +131,7 @@ class Metadata(ServerPlugin):
groups[grpname] = grp
else: # group has no options
groups[grpname] = grp
- for grpname, grps in duplicates.items():
+ for grpname, grps in list(duplicates.items()):
self.LintError("duplicate-group",
"Group %s is defined multiple times:\n%s" %
(grpname,
@@ -154,7 +154,7 @@ class Metadata(ServerPlugin):
entries[el.get("name")].append(self.RenderXML(el))
else:
entries[el.get("name")] = [self.RenderXML(el)]
- for ename, els in entries.items():
+ for ename, els in list(entries.items()):
if len(els) > 1:
self.LintError("duplicate-%s" % etype,
"%s %s is defined multiple times:\n%s" %
diff --git a/src/lib/Bcfg2/Server/Lint/RequiredAttrs.py b/src/lib/Bcfg2/Server/Lint/RequiredAttrs.py
index 56b4e7477..6d872bfa5 100644
--- a/src/lib/Bcfg2/Server/Lint/RequiredAttrs.py
+++ b/src/lib/Bcfg2/Server/Lint/RequiredAttrs.py
@@ -230,7 +230,7 @@ class RequiredAttrs(Bcfg2.Server.Lint.ServerPlugin):
if 'Rules' not in self.core.plugins:
return
- for rules in self.core.plugins['Rules'].entries.values():
+ for rules in list(self.core.plugins['Rules'].entries.values()):
xdata = rules.pnode.data
for path in xdata.xpath("//Path"):
self.check_entry(path,
@@ -243,7 +243,7 @@ class RequiredAttrs(Bcfg2.Server.Lint.ServerPlugin):
if 'Bundler' not in self.core.plugins:
return
- for bundle in self.core.plugins['Bundler'].entries.values():
+ for bundle in list(self.core.plugins['Bundler'].entries.values()):
if self.HandlesFile(bundle.name) and bundle.template is None:
for path in bundle.xdata.xpath(
"//*[substring(name(), 1, 5) = 'Bound']"):
@@ -327,7 +327,7 @@ class RequiredAttrs(Bcfg2.Server.Lint.ServerPlugin):
"Text content of %s %s in %s is malformed\n%s" %
(tag, name, filename, self.RenderXML(entry)))
- if not attrs.issuperset(required_attrs.keys()):
+ if not attrs.issuperset(list(required_attrs.keys())):
self.LintError(
"required-attrs-missing",
"The following required attribute(s) are missing for %s "
@@ -338,7 +338,7 @@ class RequiredAttrs(Bcfg2.Server.Lint.ServerPlugin):
set(required_attrs.keys()).difference(attrs)]),
self.RenderXML(entry)))
- for attr, fmt in required_attrs.items():
+ for attr, fmt in list(required_attrs.items()):
if fmt and attr in attrs and not fmt(entry.attrib[attr]):
self.LintError(
"required-attr-format",
diff --git a/src/lib/Bcfg2/Server/Lint/TemplateAbuse.py b/src/lib/Bcfg2/Server/Lint/TemplateAbuse.py
index a437c1318..8ca2ccaed 100644
--- a/src/lib/Bcfg2/Server/Lint/TemplateAbuse.py
+++ b/src/lib/Bcfg2/Server/Lint/TemplateAbuse.py
@@ -26,8 +26,8 @@ class TemplateAbuse(Bcfg2.Server.Lint.ServerPlugin):
def Run(self):
if 'Cfg' in self.core.plugins:
- for entryset in self.core.plugins['Cfg'].entries.values():
- for entry in entryset.entries.values():
+ for entryset in list(self.core.plugins['Cfg'].entries.values()):
+ for entry in list(entryset.entries.values()):
if (self.HandlesFile(entry.name) and
any(isinstance(entry, t) for t in self.templates)):
self.check_template(entryset, entry)
@@ -60,7 +60,7 @@ class TemplateAbuse(Bcfg2.Server.Lint.ServerPlugin):
return
# finally, check for executable permissions in info.xml
- for entry in entryset.entries.values():
+ for entry in list(entryset.entries.values()):
if isinstance(entry, CfgInfoXML):
for pinfo in entry.infoxml.xdata.xpath("//FileInfo/Info"):
try:
diff --git a/src/lib/Bcfg2/Server/Lint/TemplateHelper.py b/src/lib/Bcfg2/Server/Lint/TemplateHelper.py
index 98faa269d..403437bc0 100644
--- a/src/lib/Bcfg2/Server/Lint/TemplateHelper.py
+++ b/src/lib/Bcfg2/Server/Lint/TemplateHelper.py
@@ -31,7 +31,7 @@ class TemplateHelper(ServerPlugin):
self.reserved_defaults = dummy.reserved_defaults
def Run(self):
- for helper in self.core.plugins['TemplateHelper'].entries.values():
+ for helper in list(self.core.plugins['TemplateHelper'].entries.values()):
if self.HandlesFile(helper.name):
self.check_helper(helper.name)
diff --git a/src/lib/Bcfg2/Server/Lint/Validate.py b/src/lib/Bcfg2/Server/Lint/Validate.py
index 146f18b0c..7bccce87c 100644
--- a/src/lib/Bcfg2/Server/Lint/Validate.py
+++ b/src/lib/Bcfg2/Server/Lint/Validate.py
@@ -71,7 +71,7 @@ class Validate(Bcfg2.Server.Lint.ServerlessPlugin):
def Run(self):
- for path, schemaname in self.filesets.items():
+ for path, schemaname in list(self.filesets.items()):
try:
filelist = self.filelists[path]
except KeyError:
@@ -211,7 +211,7 @@ class Validate(Bcfg2.Server.Lint.ServerlessPlugin):
values are lists of the full paths to all files in the Bcfg2
repository (or given with ``bcfg2-lint --stdin``) that match
the glob."""
- for path in self.filesets.keys():
+ for path in list(self.filesets.keys()):
if '/**/' in path:
if self.files is not None:
self.filelists[path] = self.list_matching_files(path)
diff --git a/src/lib/Bcfg2/Server/Lint/__init__.py b/src/lib/Bcfg2/Server/Lint/__init__.py
index 66c8180f4..23ec65a58 100644
--- a/src/lib/Bcfg2/Server/Lint/__init__.py
+++ b/src/lib/Bcfg2/Server/Lint/__init__.py
@@ -188,7 +188,7 @@ class ErrorHandler(object):
#: A dict of registered errors
self.errortypes = dict()
if errors is not None:
- self.RegisterErrors(dict(errors.items()))
+ self.RegisterErrors(dict(list(errors.items())))
def RegisterErrors(self, errors):
""" Register a dict of errors that a plugin may raise. The
@@ -199,7 +199,7 @@ class ErrorHandler(object):
:param errors: The error dict
:type errors: dict
"""
- for err, action in errors.items():
+ for err, action in list(errors.items()):
if err not in self.errortypes:
if "warn" in action:
self.errortypes[err] = self.warn
@@ -400,9 +400,9 @@ class CLI(object):
for plugin in self.serverplugins + self.serverlessplugins:
self.errorhandler.RegisterErrors(getattr(plugin, 'Errors')())
- print("%-35s %-35s" % ("Error name", "Handler"))
- for err, handler in self.errorhandler.errortypes.items():
- print("%-35s %-35s" % (err, handler.__name__))
+ print(("%-35s %-35s" % ("Error name", "Handler")))
+ for err, handler in list(self.errorhandler.errortypes.items()):
+ print(("%-35s %-35s" % (err, handler.__name__)))
return 0
if not self.serverplugins and not self.serverlessplugins:
@@ -429,8 +429,8 @@ class CLI(object):
if (self.errorhandler.errors or
self.errorhandler.warnings or
Bcfg2.Options.setup.verbose):
- print("%d errors" % self.errorhandler.errors)
- print("%d warnings" % self.errorhandler.warnings)
+ print(("%d errors" % self.errorhandler.errors))
+ print(("%d warnings" % self.errorhandler.warnings))
if self.errorhandler.errors:
return 2
diff --git a/src/lib/Bcfg2/Server/MultiprocessingCore.py b/src/lib/Bcfg2/Server/MultiprocessingCore.py
index 4bf3e4a27..d02b5f852 100644
--- a/src/lib/Bcfg2/Server/MultiprocessingCore.py
+++ b/src/lib/Bcfg2/Server/MultiprocessingCore.py
@@ -53,7 +53,7 @@ class RPCQueue(Bcfg2.Server.Plugin.Debuggable):
def publish(self, method, args=None, kwargs=None):
""" Publish an RPC call to the queue for consumption by all
subscribers. """
- for queue in self._queues.values():
+ for queue in list(self._queues.values()):
queue.put((None, (method, args or [], kwargs or dict())))
def rpc(self, dest, method, args=None, kwargs=None):
@@ -84,7 +84,7 @@ class RPCQueue(Bcfg2.Server.Plugin.Debuggable):
""" Close queues and connections. """
self._terminate.set()
self.logger.debug("Closing RPC queues")
- for name, queue in self._queues.items():
+ for name, queue in list(self._queues.items()):
self.logger.debug("Closing RPC queue to %s" % name)
queue.close()
@@ -258,7 +258,7 @@ class ChildCore(Core):
def _get_rmi(self):
rmi = dict()
- for pname, pinst in self._get_rmi_objects().items():
+ for pname, pinst in list(self._get_rmi_objects().items()):
for crmi in pinst.__child_rmi__:
if isinstance(crmi, tuple):
mname = crmi[1]
@@ -394,7 +394,7 @@ class MultiprocessingCore(BuiltinCore):
def _get_rmi(self):
child_rmi = dict()
- for pname, pinst in self._get_rmi_objects().items():
+ for pname, pinst in list(self._get_rmi_objects().items()):
for crmi in pinst.__child_rmi__:
if isinstance(crmi, tuple):
parentname, childname = crmi
@@ -404,7 +404,7 @@ class MultiprocessingCore(BuiltinCore):
"%s.%s" % (pname, childname)
rmi = BuiltinCore._get_rmi(self)
- for method in rmi.keys():
+ for method in list(rmi.keys()):
if method in child_rmi:
rmi[method] = self._child_rmi_wrapper(method,
rmi[method],
@@ -439,7 +439,7 @@ class MultiprocessingCore(BuiltinCore):
@exposed
def GetConfig(self, address):
client = self.resolve_client(address)[0]
- childname = self.children.next()
+ childname = next(self.children)
self.logger.debug("Building configuration for %s on %s" % (client,
childname))
return self.rpc_q.rpc(childname, "GetConfig", args=[client])
@@ -455,7 +455,7 @@ class MultiprocessingCore(BuiltinCore):
"Child-1", to uniquely identify this set of statistics),
and aggregates it with the set of running totals that are
kept from all cores. """
- for statname, vals in newstats.items():
+ for statname, vals in list(newstats.items()):
if statname.startswith("ChildCore:"):
statname = statname[5:]
if prefix:
diff --git a/src/lib/Bcfg2/Server/Plugin/base.py b/src/lib/Bcfg2/Server/Plugin/base.py
index 549f7b543..747d9992a 100644
--- a/src/lib/Bcfg2/Server/Plugin/base.py
+++ b/src/lib/Bcfg2/Server/Plugin/base.py
@@ -95,7 +95,7 @@ class Plugin(Debuggable):
def set_debug(self, debug):
self.debug_log("%s: debug = %s" % (self.name, self.debug_flag),
flag=True)
- for entry in self.Entries.values():
+ for entry in list(self.Entries.values()):
if isinstance(entry, Debuggable):
entry.set_debug(debug)
return Debuggable.set_debug(self, debug)
diff --git a/src/lib/Bcfg2/Server/Plugin/helpers.py b/src/lib/Bcfg2/Server/Plugin/helpers.py
index ca0fe8188..45b8101dc 100644
--- a/src/lib/Bcfg2/Server/Plugin/helpers.py
+++ b/src/lib/Bcfg2/Server/Plugin/helpers.py
@@ -145,7 +145,7 @@ def _get_template_data(func_name, args, default=_sentinel):
source = dict()
for prov in providers:
pdata = getattr(prov, func_name)(*args)
- for key, val in pdata.items():
+ for key, val in list(pdata.items()):
if key not in rv:
rv[key] = val
source[key] = prov
@@ -348,7 +348,7 @@ class DirectoryBacked(Debuggable):
self.add_directory_monitor('')
def set_debug(self, debug):
- for entry in self.entries.values():
+ for entry in list(self.entries.values()):
if isinstance(entry, Debuggable):
entry.set_debug(debug)
return Debuggable.set_debug(self, debug)
@@ -379,7 +379,7 @@ class DirectoryBacked(Debuggable):
:returns: None
"""
dirpathname = os.path.join(self.data, relative)
- if relative not in self.handles.values():
+ if relative not in list(self.handles.values()):
if not os.path.isdir(dirpathname):
self.logger.error("%s is not a directory" % dirpathname)
return
@@ -801,7 +801,7 @@ class StructFile(XMLFileBacked):
""" recursive helper for
:func:`Bcfg2.Server.Plugin.helpers.StructFile.Match` """
if self._include_element(item, metadata, *args):
- if item.tag in self._include_tests.keys():
+ if item.tag in list(self._include_tests.keys()):
rv = []
if self._include_element(item, metadata, *args):
for child in item.iterchildren():
@@ -854,7 +854,7 @@ class StructFile(XMLFileBacked):
""" recursive helper for
:func:`Bcfg2.Server.Plugin.helpers.StructFile.XMLMatch` """
if self._include_element(item, metadata, *args):
- if item.tag in self._include_tests.keys():
+ if item.tag in list(self._include_tests.keys()):
for child in item.iterchildren():
item.remove(child)
item.getparent().append(child)
@@ -945,7 +945,7 @@ class InfoXML(StructFile):
elif len(fileinfo) > 1:
self.logger.warning("Multiple file metadata found in %s for %s" %
(self.name, entry.get('name')))
- for attr, val in fileinfo[0].attrib.items():
+ for attr, val in list(fileinfo[0].attrib.items()):
entry.set(attr, val)
@@ -1003,7 +1003,7 @@ class PrioDir(Plugin, Generator, XMLDirectoryBacked):
def HandleEvent(self, event):
XMLDirectoryBacked.HandleEvent(self, event)
self.Entries = {}
- for src in self.entries.values():
+ for src in list(self.entries.values()):
for child in src.xdata.iterchildren():
if child.tag in ['Group', 'Client']:
continue
@@ -1040,7 +1040,7 @@ class PrioDir(Plugin, Generator, XMLDirectoryBacked):
:returns: None
"""
matching = []
- for src in self.entries.values():
+ for src in list(self.entries.values()):
for candidate in src.XMLMatch(metadata).xpath("//%s" % entry.tag):
if self._matches(entry, metadata, candidate):
matching.append((src, candidate))
@@ -1297,7 +1297,7 @@ class EntrySet(Debuggable):
def set_debug(self, debug):
rv = Debuggable.set_debug(self, debug)
- for entry in self.entries.values():
+ for entry in list(self.entries.values()):
entry.set_debug(debug)
return rv
@@ -1634,7 +1634,7 @@ class GroupSpool(Plugin, Generator):
return self.handles[event.requestID].rstrip("/")
def set_debug(self, debug):
- for entry in self.entries.values():
+ for entry in list(self.entries.values()):
if hasattr(entry, "set_debug"):
entry.set_debug(debug)
return Plugin.set_debug(self, debug)
@@ -1738,14 +1738,14 @@ class CallableDict(MutableMapping):
return len(self._getters)
def __iter__(self):
- return iter(self._getters.keys())
+ return iter(list(self._getters.keys()))
def _current_data(self):
""" Return a dict with the current available static data
and ``unknown`` for all callable values.
"""
rv = dict()
- for key in self._getters.keys():
+ for key in list(self._getters.keys()):
if callable(self._getters[key]):
rv[key] = 'unknown'
else:
@@ -1777,7 +1777,7 @@ class OnDemandDict(CallableDict):
def _current_data(self):
rv = super(OnDemandDict, self)._current_data()
- for (key, value) in rv.items():
+ for (key, value) in list(rv.items()):
if key in self._values:
rv[key] = value
return rv
diff --git a/src/lib/Bcfg2/Server/Plugins/AWSTags.py b/src/lib/Bcfg2/Server/Plugins/AWSTags.py
index 556805bde..d823a3986 100644
--- a/src/lib/Bcfg2/Server/Plugins/AWSTags.py
+++ b/src/lib/Bcfg2/Server/Plugins/AWSTags.py
@@ -26,7 +26,7 @@ class AWSTagPattern(object):
def get_groups(self, tags):
""" Get groups that apply to the given tag set """
- for key, value in tags.items():
+ for key, value in list(tags.items()):
name_match = self.name.search(key)
if name_match:
if self.value is not None:
diff --git a/src/lib/Bcfg2/Server/Plugins/Bundler.py b/src/lib/Bcfg2/Server/Plugins/Bundler.py
index 4f5a79465..bbdf62866 100644
--- a/src/lib/Bcfg2/Server/Plugins/Bundler.py
+++ b/src/lib/Bcfg2/Server/Plugins/Bundler.py
@@ -58,7 +58,7 @@ class Bundler(Plugin,
def HandleEvent(self, event):
XMLDirectoryBacked.HandleEvent(self, event)
self.bundles = dict([(b.bundle_name, b)
- for b in self.entries.values()])
+ for b in list(self.entries.values())])
def validate_structures(self, metadata, structures):
""" Translate <Path glob='...'/> entries into <Path name='...'/>
@@ -66,7 +66,7 @@ class Bundler(Plugin,
for struct in structures:
for pathglob in struct.xpath("//Path[@glob]"):
for plugin in self.core.plugins_by_type(Generator):
- for match in fnmatch.filter(plugin.Entries['Path'].keys(),
+ for match in fnmatch.filter(list(plugin.Entries['Path'].keys()),
pathglob.get("glob")):
lxml.etree.SubElement(pathglob.getparent(),
"Path", name=match)
diff --git a/src/lib/Bcfg2/Server/Plugins/Cfg/CfgCheetahGenerator.py b/src/lib/Bcfg2/Server/Plugins/Cfg/CfgCheetahGenerator.py
index 84309b5dd..2a452f345 100644
--- a/src/lib/Bcfg2/Server/Plugins/Cfg/CfgCheetahGenerator.py
+++ b/src/lib/Bcfg2/Server/Plugins/Cfg/CfgCheetahGenerator.py
@@ -50,9 +50,9 @@ class CfgCheetahGenerator(CfgGenerator):
def get_data(self, entry, metadata):
template = Template(self.data.decode(Bcfg2.Options.setup.encoding),
compilerSettings=self.settings)
- for key, val in get_template_data(
+ for key, val in list(get_template_data(
entry, metadata, self.name,
- default=DefaultCheetahDataProvider()).items():
+ default=DefaultCheetahDataProvider()).items()):
setattr(template, key, val)
return template.respond()
get_data.__doc__ = CfgGenerator.get_data.__doc__
diff --git a/src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py b/src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py
index 44d980967..e4013a347 100644
--- a/src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py
+++ b/src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py
@@ -10,7 +10,7 @@ import Bcfg2.Options
import Bcfg2.Server.Plugin
from Bcfg2.Server.Plugin import PluginExecutionError
# pylint: disable=W0622
-from Bcfg2.Compat import u_str, unicode, b64encode, any, walk_packages
+from Bcfg2.Compat import u_str, str, b64encode, any, walk_packages
# pylint: enable=W0622
try:
@@ -511,7 +511,7 @@ class CfgDefaultInfo(CfgInfo):
__init__.__doc__ = CfgInfo.__init__.__doc__.split(".. -----")[0]
def bind_info_to_entry(self, entry, _):
- for key, value in Bcfg2.Server.Plugin.default_path_metadata().items():
+ for key, value in list(Bcfg2.Server.Plugin.default_path_metadata().items()):
entry.attrib[key] = value
bind_info_to_entry.__doc__ = CfgInfo.bind_info_to_entry.__doc__
@@ -527,7 +527,7 @@ class CfgEntrySet(Bcfg2.Server.Plugin.EntrySet):
def set_debug(self, debug):
rv = Bcfg2.Server.Plugin.EntrySet.set_debug(self, debug)
- for entry in self.entries.values():
+ for entry in list(self.entries.values()):
entry.set_debug(debug)
return rv
@@ -648,7 +648,7 @@ class CfgEntrySet(Bcfg2.Server.Plugin.EntrySet):
data = b64encode(data)
else:
try:
- if not isinstance(data, unicode):
+ if not isinstance(data, str):
if not isinstance(data, str):
data = data.decode('utf-8')
data = u_str(data, Bcfg2.Options.setup.encoding)
@@ -688,7 +688,7 @@ class CfgEntrySet(Bcfg2.Server.Plugin.EntrySet):
:returns: list of Cfg handler classes
"""
rv = []
- for ent in self.entries.values():
+ for ent in list(self.entries.values()):
if (isinstance(ent, handler_type) and
(not ent.__specific__ or ent.specific.matches(metadata))):
rv.append(ent)
@@ -786,7 +786,7 @@ class CfgEntrySet(Bcfg2.Server.Plugin.EntrySet):
verifiers_by_class[cls] = [verifier]
else:
verifiers_by_class[cls].append(verifier)
- for verifiers in verifiers_by_class.values():
+ for verifiers in list(verifiers_by_class.values()):
verifier = self.best_matching(metadata, verifiers)
verifier.verify_entry(entry, metadata, data)
diff --git a/src/lib/Bcfg2/Server/Plugins/Deps.py b/src/lib/Bcfg2/Server/Plugins/Deps.py
index 1872e68af..7288698db 100644
--- a/src/lib/Bcfg2/Server/Plugins/Deps.py
+++ b/src/lib/Bcfg2/Server/Plugins/Deps.py
@@ -65,7 +65,7 @@ class Deps(Bcfg2.Server.Plugin.PrioDir,
# tuples of (PriorityStructFile, element) for each
# matching element and the structfile that contains it
matching = []
- for deps in self.entries.values():
+ for deps in list(self.entries.values()):
el = deps.find("/%s[name='%s']" % (entry.tag,
entry.get("name")))
if el:
diff --git a/src/lib/Bcfg2/Server/Plugins/Ldap.py b/src/lib/Bcfg2/Server/Plugins/Ldap.py
index 770419ba5..cb82d962e 100644
--- a/src/lib/Bcfg2/Server/Plugins/Ldap.py
+++ b/src/lib/Bcfg2/Server/Plugins/Ldap.py
@@ -210,7 +210,7 @@ class LdapConnection(Debuggable):
self.conn = ldap.initialize(self.get_uri())
if self.options is not None:
- for (option, value) in self.options.items():
+ for (option, value) in list(self.options.items()):
self.conn.set_option(option, value)
if self.binddn is not None and self.bindpw is not None:
diff --git a/src/lib/Bcfg2/Server/Plugins/Metadata.py b/src/lib/Bcfg2/Server/Plugins/Metadata.py
index b912d3725..bdefd4b45 100644
--- a/src/lib/Bcfg2/Server/Plugins/Metadata.py
+++ b/src/lib/Bcfg2/Server/Plugins/Metadata.py
@@ -959,7 +959,7 @@ class Metadata(Bcfg2.Server.Plugin.Metadata,
def HandleEvent(self, event):
"""Handle update events for data files."""
- for handles, event_handler in self.handlers.items():
+ for handles, event_handler in list(self.handlers.items()):
if handles(event):
# clear the entire cache when we get an event for any
# metadata file
@@ -968,7 +968,7 @@ class Metadata(Bcfg2.Server.Plugin.Metadata,
# clear out the list of category suppressions that
# have been warned about, since this may change when
# clients.xml or groups.xml changes.
- for group in self.groups.values():
+ for group in list(self.groups.values()):
group.warned = []
event_handler(event)
@@ -1120,7 +1120,7 @@ class Metadata(Bcfg2.Server.Plugin.Metadata,
self.groups[grpname].category):
categories[self.groups[grpname].category] = grpname
groups.update(newgroups)
- for grpname, predicates in self.negated_groups.items():
+ for grpname, predicates in list(self.negated_groups.items()):
if grpname not in groups:
continue
if any(p(client, groups, categories) for p in predicates):
@@ -1289,16 +1289,16 @@ class Metadata(Bcfg2.Server.Plugin.Metadata,
def get_all_group_names(self):
""" return a list of all group names """
all_groups = set()
- all_groups.update(self.groups.keys())
- all_groups.update(self.group_membership.keys())
- all_groups.update(self.negated_groups.keys())
- for grp in self.clientgroups.values():
+ all_groups.update(list(self.groups.keys()))
+ all_groups.update(list(self.group_membership.keys()))
+ all_groups.update(list(self.negated_groups.keys()))
+ for grp in list(self.clientgroups.values()):
all_groups.update(grp)
return all_groups
def get_all_groups_in_category(self, category):
""" return a list of names of groups in the given category """
- return set([g.name for g in self.groups.values()
+ return set([g.name for g in list(self.groups.values())
if g.category == category])
def get_client_names_by_profiles(self, profiles):
diff --git a/src/lib/Bcfg2/Server/Plugins/POSIXCompat.py b/src/lib/Bcfg2/Server/Plugins/POSIXCompat.py
index cf53c5866..1cd5e059e 100644
--- a/src/lib/Bcfg2/Server/Plugins/POSIXCompat.py
+++ b/src/lib/Bcfg2/Server/Plugins/POSIXCompat.py
@@ -24,5 +24,5 @@ class POSIXCompat(Bcfg2.Server.Plugin.Plugin,
for goal in goals:
for entry in goal.getchildren():
- if entry.tag == 'Path' and 'mode' in entry.keys():
+ if entry.tag == 'Path' and 'mode' in list(entry.keys()):
entry.set('perms', entry.get('mode'))
diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/Pac.py b/src/lib/Bcfg2/Server/Plugins/Packages/Pac.py
index e3432c934..9d019b46a 100644
--- a/src/lib/Bcfg2/Server/Plugins/Packages/Pac.py
+++ b/src/lib/Bcfg2/Server/Plugins/Packages/Pac.py
@@ -160,7 +160,7 @@ class PacSource(Source):
pkg = parse_db_file(tar.extractfile(tarinfo))
packages[prefix].update(pkg)
- for pkg in packages.values():
+ for pkg in list(packages.values()):
pkgname = pkg['%NAME%'][0]
self.pkgnames.add(pkgname)
bdeps[barch][pkgname] = []
diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/Pkgng.py b/src/lib/Bcfg2/Server/Plugins/Packages/Pkgng.py
index 5248ad896..230be2ccd 100644
--- a/src/lib/Bcfg2/Server/Plugins/Packages/Pkgng.py
+++ b/src/lib/Bcfg2/Server/Plugins/Packages/Pkgng.py
@@ -87,10 +87,10 @@ class PkgngSource(Source):
self.logger.error("Packages: Failed to read file %s" % fname)
raise
for line in packagesite.readlines():
- pkg = json.loads(unicode(line, errors='ignore'))
+ pkg = json.loads(str(line, errors='ignore'))
pkgname = pkg['name']
self.pkgnames.add(pkgname)
if 'deps' in pkg:
- bdeps[barch][pkgname] = pkg['deps'].keys()
+ bdeps[barch][pkgname] = list(pkg['deps'].keys())
self.process_files(bdeps, dict())
read_files.__doc__ = Source.read_files.__doc__
diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/Source.py b/src/lib/Bcfg2/Server/Plugins/Packages/Source.py
index 574dbd851..d6529eb20 100644
--- a/src/lib/Bcfg2/Server/Plugins/Packages/Source.py
+++ b/src/lib/Bcfg2/Server/Plugins/Packages/Source.py
@@ -310,7 +310,7 @@ class Source(Debuggable): # pylint: disable=R0902
opts = xsource.findall("Options")
for el in opts:
repoopts = dict([(k, v)
- for k, v in el.attrib.items()
+ for k, v in list(el.attrib.items())
if k != "clientonly" and k != "serveronly"])
if el.get("clientonly", "false").lower() == "false":
self.server_options.update(repoopts)
diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/Yum.py b/src/lib/Bcfg2/Server/Plugins/Packages/Yum.py
index acb11f1ab..6732f4179 100644
--- a/src/lib/Bcfg2/Server/Plugins/Packages/Yum.py
+++ b/src/lib/Bcfg2/Server/Plugins/Packages/Yum.py
@@ -405,7 +405,7 @@ class YumCollection(Collection):
mainopts['debuglevel'] = "2"
try:
- for opt, val in Bcfg2.Options.setup.yum_options.items():
+ for opt, val in list(Bcfg2.Options.setup.yum_options.items()):
if opt not in self.option_blacklist:
mainopts[opt] = val
except ConfigParser.NoSectionError:
@@ -486,7 +486,7 @@ class YumCollection(Collection):
opts = source.server_options
else:
opts = source.client_options
- for opt, val in opts.items():
+ for opt, val in list(opts.items()):
config.set(reponame, opt, val)
if raw:
@@ -805,7 +805,7 @@ class YumCollection(Collection):
packages[pkg[0]].append(pkg)
except KeyError:
packages[pkg[0]] = [pkg]
- for name, instances in packages.items():
+ for name, instances in list(packages.items()):
pkgattrs = dict(type=self.ptype,
origin='Packages',
name=name)
diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/YumHelper.py b/src/lib/Bcfg2/Server/Plugins/Packages/YumHelper.py
index 89cc23090..93e8092b4 100644
--- a/src/lib/Bcfg2/Server/Plugins/Packages/YumHelper.py
+++ b/src/lib/Bcfg2/Server/Plugins/Packages/YumHelper.py
@@ -290,16 +290,16 @@ class HelperSubcommand(Bcfg2.Options.Subcommand):
except ValueError:
self.logger.error("Error decoding JSON input: %s" %
sys.exc_info()[1])
- print(json.dumps(self.fallback))
+ print((json.dumps(self.fallback)))
return 2
try:
- print(json.dumps(self._run(setup, data)))
+ print((json.dumps(self._run(setup, data))))
except: # pylint: disable=W0702
self.logger.error("Unexpected error running %s: %s" %
(self.__class__.__name__.lower(),
sys.exc_info()[1]), exc_info=1)
- print(json.dumps(self.fallback))
+ print((json.dumps(self.fallback)))
return 2
return 0
@@ -388,7 +388,7 @@ class CLI(Bcfg2.Options.CommandRegistry):
def __init__(self):
Bcfg2.Options.CommandRegistry.__init__(self)
- self.register_commands(globals().values(), parent=HelperSubcommand)
+ self.register_commands(list(globals().values()), parent=HelperSubcommand)
parser = Bcfg2.Options.get_parser("Bcfg2 yum helper",
components=[self])
parser.add_options(self.subcommand_options)
diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/__init__.py b/src/lib/Bcfg2/Server/Plugins/Packages/__init__.py
index 1a9673891..eb8322ad6 100644
--- a/src/lib/Bcfg2/Server/Plugins/Packages/__init__.py
+++ b/src/lib/Bcfg2/Server/Plugins/Packages/__init__.py
@@ -166,7 +166,7 @@ class Packages(Bcfg2.Server.Plugin.Plugin,
def set_debug(self, debug):
rv = Bcfg2.Server.Plugin.Plugin.set_debug(self, debug)
self.sources.set_debug(debug)
- for collection in self.collections.values():
+ for collection in list(self.collections.values()):
collection.set_debug(debug)
return rv
set_debug.__doc__ = Bcfg2.Server.Plugin.Plugin.set_debug.__doc__
@@ -366,7 +366,7 @@ class Packages(Bcfg2.Server.Plugin.Plugin,
gkey = hash(tuple(groups))
if gkey not in gcache:
gcache[gkey] = collection.get_groups(groups)
- for pkgs in gcache[gkey].values():
+ for pkgs in list(gcache[gkey].values()):
base.update(pkgs)
# essential pkgs are those marked as such by the distribution
diff --git a/src/lib/Bcfg2/Server/Plugins/Pkgmgr.py b/src/lib/Bcfg2/Server/Plugins/Pkgmgr.py
index 7c6ab0ed7..436fdbcec 100644
--- a/src/lib/Bcfg2/Server/Plugins/Pkgmgr.py
+++ b/src/lib/Bcfg2/Server/Plugins/Pkgmgr.py
@@ -20,7 +20,7 @@ class FuzzyDict(dict):
if mdata:
return dict.__getitem__(self, mdata.groupdict()['name'])
else:
- print("got non-string key %s" % str(key))
+ print(("got non-string key %s" % str(key)))
return dict.__getitem__(self, key)
def __contains__(self, key):
@@ -29,7 +29,7 @@ class FuzzyDict(dict):
if mdata:
return dict.__contains__(self, mdata.groupdict()['name'])
else:
- print("got non-string key %s" % str(key))
+ print(("got non-string key %s" % str(key)))
return dict.__contains__(self, key)
def get(self, key, default=None):
@@ -66,7 +66,7 @@ class PNode(object):
pdict['Package'] = set()
for child in data.getchildren():
attrs = set(data.attrib.keys()).difference(
- child.attrib.keys() + ['name'])
+ list(child.attrib.keys()) + ['name'])
for attr in attrs:
try:
child.set(attr, data.get(attr))
@@ -284,7 +284,7 @@ class Pkgmgr(Bcfg2.Server.Plugin.PrioDir):
def HandlesEntry(self, entry, metadata):
return (
entry.tag == 'Package' and
- entry.get('name').split(':')[0] in self.Entries['Package'].keys())
+ entry.get('name').split(':')[0] in list(self.Entries['Package'].keys()))
def HandleEntry(self, entry, metadata):
self.BindEntry(entry, metadata)
diff --git a/src/lib/Bcfg2/Server/Plugins/Probes.py b/src/lib/Bcfg2/Server/Plugins/Probes.py
index 270bfa62d..1d9603798 100644
--- a/src/lib/Bcfg2/Server/Plugins/Probes.py
+++ b/src/lib/Bcfg2/Server/Plugins/Probes.py
@@ -10,7 +10,7 @@ import lxml.etree
import Bcfg2.Server
import Bcfg2.Server.Cache
import Bcfg2.Server.Plugin
-from Bcfg2.Compat import unicode, any # pylint: disable=W0622
+from Bcfg2.Compat import str, any # pylint: disable=W0622
import Bcfg2.Server.FileMonitor
from Bcfg2.Logger import Debuggable
from Bcfg2.Server.Statistics import track_statistics
@@ -178,7 +178,7 @@ class DBProbeStore(ProbeStore, Bcfg2.Server.Plugin.DatabaseBacked):
Bcfg2.Server.Cache.expire("Probes", "probedata", hostname)
self._datacache[hostname] = ClientProbeDataSet()
expire_metadata = False
- for probe, pdata in data.items():
+ for probe, pdata in list(data.items()):
self._datacache[hostname][probe] = pdata
try:
record, created = ProbesDataModel.objects.get_or_create(
@@ -196,7 +196,7 @@ class DBProbeStore(ProbeStore, Bcfg2.Server.Plugin.DatabaseBacked):
record.save()
expire_metadata = True
qset = ProbesDataModel.objects.filter(
- hostname=hostname).exclude(probe__in=data.keys())
+ hostname=hostname).exclude(probe__in=list(data.keys()))
if len(qset):
qset.delete()
expire_metadata = True
@@ -283,7 +283,7 @@ class XMLProbeStore(ProbeStore):
Bcfg2.Server.Cache.expire("Probes", "probedata", hostname)
self._datacache[hostname] = ClientProbeDataSet()
expire_metadata = False
- for probe, pdata in data.items():
+ for probe, pdata in list(data.items()):
olddata = self._datacache[hostname].get(probe, ProbeData(''))
self._datacache[hostname][probe] = pdata
expire_metadata |= olddata != data
@@ -308,7 +308,7 @@ class ProbeData(str): # pylint: disable=E0012,R0924
ProbeData objects as XML, JSON, or YAML data """
def __new__(cls, data):
# prevent double encoding utf-8 in python3
- if isinstance(data, unicode) and not isinstance(data, str):
+ if isinstance(data, str) and not isinstance(data, str):
return str.__new__(cls, data.encode('utf-8'))
else:
return str.__new__(cls, data)
diff --git a/src/lib/Bcfg2/Server/Plugins/Properties.py b/src/lib/Bcfg2/Server/Plugins/Properties.py
index e6549b714..2ea383249 100644
--- a/src/lib/Bcfg2/Server/Plugins/Properties.py
+++ b/src/lib/Bcfg2/Server/Plugins/Properties.py
@@ -288,7 +288,7 @@ class Properties(Bcfg2.Server.Plugin.Plugin,
def get_additional_data(self, metadata):
rv = dict()
- for fname, pfile in self.entries.items():
+ for fname, pfile in list(self.entries.items()):
rv[fname] = pfile.get_additional_data(metadata)
return rv
get_additional_data.__doc__ = \
diff --git a/src/lib/Bcfg2/Server/Plugins/PuppetENC.py b/src/lib/Bcfg2/Server/Plugins/PuppetENC.py
index e2d8a058f..c5795c69b 100644
--- a/src/lib/Bcfg2/Server/Plugins/PuppetENC.py
+++ b/src/lib/Bcfg2/Server/Plugins/PuppetENC.py
@@ -41,7 +41,7 @@ class PuppetENC(Bcfg2.Server.Plugin.Plugin,
def _run_encs(self, metadata):
""" Run all Puppet ENCs """
cache = dict(groups=[], params=dict())
- for enc in self.entries.keys():
+ for enc in list(self.entries.keys()):
epath = os.path.join(self.data, enc)
self.debug_log("PuppetENC: Running ENC %s for %s" %
(enc, metadata.hostname))
@@ -73,8 +73,8 @@ class PuppetENC(Bcfg2.Server.Plugin.Plugin,
cache['groups'].extend(groups)
else:
self.debug_log("ENC %s adding groups to %s: %s" %
- (enc, metadata.hostname, groups.keys()))
- for group, params in groups.items():
+ (enc, metadata.hostname, list(groups.keys())))
+ for group, params in list(groups.items()):
cache['groups'].append(group)
if params:
cache['params'].update(params)
diff --git a/src/lib/Bcfg2/Server/Plugins/Rules.py b/src/lib/Bcfg2/Server/Plugins/Rules.py
index cf659251c..776a905ca 100644
--- a/src/lib/Bcfg2/Server/Plugins/Rules.py
+++ b/src/lib/Bcfg2/Server/Plugins/Rules.py
@@ -29,7 +29,7 @@ class Rules(Bcfg2.Server.Plugin.PrioDir):
self._regex_cache = dict()
def HandlesEntry(self, entry, metadata):
- for src in self.entries.values():
+ for src in list(self.entries.values()):
for candidate in src.XMLMatch(metadata).xpath("//%s" % entry.tag):
if self._matches(entry, metadata, candidate):
return True
diff --git a/src/lib/Bcfg2/Server/Plugins/SSHbase.py b/src/lib/Bcfg2/Server/Plugins/SSHbase.py
index 08acc4d8d..ecdb6d9ed 100644
--- a/src/lib/Bcfg2/Server/Plugins/SSHbase.py
+++ b/src/lib/Bcfg2/Server/Plugins/SSHbase.py
@@ -226,7 +226,7 @@ class SSHbase(Bcfg2.Server.Plugin.Plugin,
if pubk.endswith('.pub')]
pubkeys.sort()
for pubkey in pubkeys:
- for entry in sorted(self.entries[pubkey].entries.values(),
+ for entry in sorted(list(self.entries[pubkey].entries.values()),
key=lambda e: (e.specific.hostname or
e.specific.group)):
specific = entry.specific
@@ -421,9 +421,9 @@ class SSHbase(Bcfg2.Server.Plugin.Plugin,
self.entries[entry.get('name')].bind_entry(entry, metadata)
is_bound = True
except Bcfg2.Server.Plugin.PluginExecutionError:
- print("Failed to bind %s: %s") % (
+ print(("Failed to bind %s: %s") % (
lxml.etree.tostring(entry),
- sys.exc_info()[1])
+ sys.exc_info()[1]))
def GenerateHostKeyPair(self, client, filename):
"""Generate new host key pair for client."""
@@ -497,7 +497,7 @@ class SSHbase(Bcfg2.Server.Plugin.Plugin,
try:
open(filename, 'w').write(entry['text'])
if log:
- print("Wrote file %s" % filename)
+ print(("Wrote file %s" % filename))
except KeyError:
self.logger.error("Failed to pull %s. This file does not "
"currently exist on the client" %
diff --git a/src/lib/Bcfg2/Server/Plugins/TemplateHelper.py b/src/lib/Bcfg2/Server/Plugins/TemplateHelper.py
index ff67571fa..030f4d74a 100644
--- a/src/lib/Bcfg2/Server/Plugins/TemplateHelper.py
+++ b/src/lib/Bcfg2/Server/Plugins/TemplateHelper.py
@@ -31,9 +31,9 @@ class HelperModule(Debuggable):
self.defaults = []
default_prov = DefaultTemplateDataProvider()
- self.reserved_defaults = default_prov.get_template_data(
+ self.reserved_defaults = list(default_prov.get_template_data(
lxml.etree.Element("Path", name="/dummy"),
- None, None).keys() + ["path"]
+ None, None).keys()) + ["path"]
def HandleEvent(self, event=None):
""" HandleEvent is called whenever the FAM registers an event.
@@ -119,12 +119,12 @@ class TemplateHelper(Plugin, Connector, DirectoryBacked, TemplateDataProvider):
def get_additional_data(self, _):
return dict([(h._module_name, h) # pylint: disable=W0212
- for h in self.entries.values()])
+ for h in list(self.entries.values())])
def get_template_data(self, *_):
rv = dict()
source = dict()
- for helper in self.entries.values():
+ for helper in list(self.entries.values()):
for key in helper.defaults:
if key not in rv:
rv[key] = getattr(helper, key)
diff --git a/src/lib/Bcfg2/Server/Plugins/Trigger.py b/src/lib/Bcfg2/Server/Plugins/Trigger.py
index 12672de7d..807b196d7 100644
--- a/src/lib/Bcfg2/Server/Plugins/Trigger.py
+++ b/src/lib/Bcfg2/Server/Plugins/Trigger.py
@@ -46,6 +46,6 @@ class Trigger(Bcfg2.Server.Plugin.Plugin,
def end_client_run(self, metadata):
args = [metadata.hostname, '-p', metadata.profile, '-g',
':'.join([g for g in metadata.groups])]
- for notifier in self.entries.keys():
+ for notifier in list(self.entries.keys()):
npath = os.path.join(self.data, notifier)
self.async_run([npath] + args)
diff --git a/src/lib/Bcfg2/Server/Reports/reports/models.py b/src/lib/Bcfg2/Server/Reports/reports/models.py
index 67aa425d9..d7da08381 100644
--- a/src/lib/Bcfg2/Server/Reports/reports/models.py
+++ b/src/lib/Bcfg2/Server/Reports/reports/models.py
@@ -6,7 +6,7 @@ try:
from django.db import models
except ImproperlyConfigured:
e = sys.exc_info()[1]
- print("Reports: unable to import django models: %s" % e)
+ print(("Reports: unable to import django models: %s" % e))
sys.exit(1)
from django.db import connection
diff --git a/src/lib/Bcfg2/Server/SSLServer.py b/src/lib/Bcfg2/Server/SSLServer.py
index 1f8febd0e..f0e8696cf 100644
--- a/src/lib/Bcfg2/Server/SSLServer.py
+++ b/src/lib/Bcfg2/Server/SSLServer.py
@@ -424,7 +424,7 @@ class XMLRPCServer(SocketServer.ThreadingMixIn, SSLServer,
except AttributeError:
name = "unknown"
if hasattr(instance, '_get_rmi'):
- for fname, func in instance._get_rmi().items():
+ for fname, func in list(instance._get_rmi().items()):
self.register_function(func, name=fname)
self.logger.info("serving %s at %s" % (name, self.url))
diff --git a/src/lib/Bcfg2/Server/migrations/0001_initial.py b/src/lib/Bcfg2/Server/migrations/0001_initial.py
index 3b3dca455..c81293ce7 100644
--- a/src/lib/Bcfg2/Server/migrations/0001_initial.py
+++ b/src/lib/Bcfg2/Server/migrations/0001_initial.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2016-08-17 18:52
-from __future__ import unicode_literals
+
import Bcfg2.Server.Plugin.helpers
from django.db import migrations, models
diff --git a/src/lib/Bcfg2/Server/south_migrations/0001_initial.py b/src/lib/Bcfg2/Server/south_migrations/0001_initial.py
index 864c311e5..4037208a0 100644
--- a/src/lib/Bcfg2/Server/south_migrations/0001_initial.py
+++ b/src/lib/Bcfg2/Server/south_migrations/0001_initial.py
@@ -9,15 +9,15 @@ class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'MetadataClientModel'
- db.create_table(u'Server_metadataclientmodel', (
+ db.create_table('Server_metadataclientmodel', (
('hostname', self.gf('django.db.models.fields.CharField')(max_length=255, primary_key=True)),
('version', self.gf('django.db.models.fields.CharField')(max_length=31, null=True)),
))
db.send_create_signal('Server', ['MetadataClientModel'])
# Adding model 'ProbesDataModel'
- db.create_table(u'Server_probesdatamodel', (
- (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ db.create_table('Server_probesdatamodel', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('hostname', self.gf('django.db.models.fields.CharField')(max_length=255)),
('probe', self.gf('django.db.models.fields.CharField')(max_length=255)),
('timestamp', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),
@@ -26,8 +26,8 @@ class Migration(SchemaMigration):
db.send_create_signal('Server', ['ProbesDataModel'])
# Adding model 'ProbesGroupsModel'
- db.create_table(u'Server_probesgroupsmodel', (
- (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ db.create_table('Server_probesgroupsmodel', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('hostname', self.gf('django.db.models.fields.CharField')(max_length=255)),
('group', self.gf('django.db.models.fields.CharField')(max_length=255)),
))
@@ -36,13 +36,13 @@ class Migration(SchemaMigration):
def backwards(self, orm):
# Deleting model 'MetadataClientModel'
- db.delete_table(u'Server_metadataclientmodel')
+ db.delete_table('Server_metadataclientmodel')
# Deleting model 'ProbesDataModel'
- db.delete_table(u'Server_probesdatamodel')
+ db.delete_table('Server_probesdatamodel')
# Deleting model 'ProbesGroupsModel'
- db.delete_table(u'Server_probesgroupsmodel')
+ db.delete_table('Server_probesgroupsmodel')
models = {
@@ -55,7 +55,7 @@ class Migration(SchemaMigration):
'Meta': {'object_name': 'ProbesDataModel'},
'data': ('django.db.models.fields.TextField', [], {'null': 'True'}),
'hostname': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
- u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'probe': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'timestamp': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
},
@@ -63,7 +63,7 @@ class Migration(SchemaMigration):
'Meta': {'object_name': 'ProbesGroupsModel'},
'group': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'hostname': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
- u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
}
}
diff --git a/src/lib/Bcfg2/Utils.py b/src/lib/Bcfg2/Utils.py
index 4d2ddebd8..faabf9346 100644
--- a/src/lib/Bcfg2/Utils.py
+++ b/src/lib/Bcfg2/Utils.py
@@ -166,7 +166,7 @@ class ExecutorResult(object):
raise TypeError("'%s' object does not support item assignment" %
self.__class__.__name__)
- def __nonzero__(self):
+ def __bool__(self):
return self.__bool__()
def __bool__(self):
@@ -308,7 +308,7 @@ def hostnames2ranges(hostnames):
hosts[key] = [match.group(2)]
ranges = []
- for name, nums in hosts.items():
+ for name, nums in list(hosts.items()):
ranges.append(name[0] + list2range(nums) + name[1])
return ranges
@@ -318,7 +318,7 @@ def safe_input(msg):
# flush input buffer
while len(select.select([sys.stdin.fileno()], [], [], 0.0)[0]) > 0:
os.read(sys.stdin.fileno(), 4096)
- return input(msg)
+ return eval(input(msg))
def safe_module_name(prefix, module):