Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3 support #394

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,12 @@ matrix:
apt:
packages: [*build_deps_optional, python-gamin, python-selinux]

- python: "3.5"
- python: "3.9"
env: WITH_OPTIONAL_DEPS=yes
addons:
apt:
packages: *build_deps_optional

allow_failures:
- python: "3.5"

fast_finish: true

before_install:
Expand Down
4 changes: 2 additions & 2 deletions src/lib/Bcfg2/Client/Tools/SELinux.py
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ def all_records(self):
self._all[mod] = (version, 1)

# get other (disabled) modules from the filesystem
for mod in self._all_records_from_filesystem().keys():
for mod in self._all_records_from_filesystem():
if mod not in self._all:
self._all[mod] = ('', 0)
else:
Expand Down Expand Up @@ -902,7 +902,7 @@ def FindExtra(self):
specified = [self._key(e)
for e in self.tool.getSupportedEntries()]
rv = []
for module in self._all_records_from_filesystem().keys():
for module in self._all_records_from_filesystem():
if module not in specified:
rv.append(self.key2entry(module))
return rv
2 changes: 1 addition & 1 deletion src/lib/Bcfg2/Server/Core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1072,7 +1072,7 @@ def listMethods(self, address): # pylint: disable=W0613
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 self._get_rmi()
if self.check_acls(address, m)])
return methods

Expand Down
2 changes: 1 addition & 1 deletion src/lib/Bcfg2/Server/Lint/Validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def get_filelists(self):
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 self.filesets:
if '/**/' in path:
if self.files is not None:
self.filelists[path] = self.list_matching_files(path)
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Bcfg2/Server/MultiprocessingCore.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ def _get_rmi(self):
"%s.%s" % (pname, childname)

rmi = BuiltinCore._get_rmi(self)
for method in rmi.keys():
for method in rmi:
if method in child_rmi:
rmi[method] = self._child_rmi_wrapper(method,
rmi[method],
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Bcfg2/Server/Plugin/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1743,7 +1743,7 @@ def _current_data(self):
and ``unknown`` for all callable values.
"""
rv = dict()
for key in self._getters.keys():
for key in self._getters:
if callable(self._getters[key]):
rv[key] = 'unknown'
else:
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Bcfg2/Server/Plugins/PuppetENC.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def __init__(self, core):
def _run_encs(self, metadata):
""" Run all Puppet ENCs """
cache = dict(groups=[], params=dict())
for enc in self.entries.keys():
for enc in self.entries:
epath = os.path.join(self.data, enc)
self.debug_log("PuppetENC: Running ENC %s for %s" %
(enc, metadata.hostname))
Expand Down
4 changes: 2 additions & 2 deletions src/lib/Bcfg2/Server/Plugins/TemplateHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ def __init__(self, name, core):
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)) + ["path"]

def HandleEvent(self, event=None):
""" HandleEvent is called whenever the FAM registers an event.
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Bcfg2/Server/Plugins/Trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ def async_run(self, args):
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 self.entries:
npath = os.path.join(self.data, notifier)
self.async_run([npath] + args)
4 changes: 4 additions & 0 deletions testsuite/pylintrc.conf
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ persistent=no
# usually to register additional checkers.
load-plugins=ext.exception_messages,ext.ssl_protocols,ext.pylint_compat

# A comma-separated list of package or module names from where C extensions may
# be loaded. Extensions are loading into the active Python interpreter and may
# run arbitrary code
extension-pkg-whitelist=lxml,posix1e

[MESSAGES CONTROL]

Expand Down