mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Fix Custodia pylint issues
See: https://pagure.io/freeipa/issue/8882 Signed-off-by: Christian Heimes <cheimes@redhat.com> Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com> Reviewed-By: Rob Crittenden <rcritten@redhat.com>
This commit is contained in:
parent
a4631b7f3f
commit
e1abfe0fb7
@ -62,7 +62,7 @@ class HTTPUnixAdapter(HTTPAdapter):
|
|||||||
DEFAULT_HEADERS = {'Content-Type': 'application/json'}
|
DEFAULT_HEADERS = {'Content-Type': 'application/json'}
|
||||||
|
|
||||||
|
|
||||||
class CustodiaHTTPClient(object):
|
class CustodiaHTTPClient:
|
||||||
timeout = None # seconds (float)
|
timeout = None # seconds (float)
|
||||||
|
|
||||||
def __init__(self, url):
|
def __init__(self, url):
|
||||||
|
@ -42,7 +42,7 @@ class SimplePathAuthz(HTTPAuthorizer):
|
|||||||
if path == '/':
|
if path == '/':
|
||||||
path = ''
|
path = ''
|
||||||
else:
|
else:
|
||||||
path, _ = os.path.split(path)
|
path, _head = os.path.split(path)
|
||||||
|
|
||||||
self.logger.debug('No path in %s matched %s', self.paths, reqpath)
|
self.logger.debug('No path in %s matched %s', self.paths, reqpath)
|
||||||
return None
|
return None
|
||||||
|
@ -492,7 +492,7 @@ class HTTPRequestHandler(BaseHTTPRequestHandler):
|
|||||||
raise HTTPError(404)
|
raise HTTPError(404)
|
||||||
|
|
||||||
|
|
||||||
class HTTPServer(object):
|
class HTTPServer:
|
||||||
handler = HTTPRequestHandler
|
handler = HTTPRequestHandler
|
||||||
|
|
||||||
def __init__(self, srvurl, config):
|
def __init__(self, srvurl, config):
|
||||||
|
@ -158,7 +158,7 @@ AUDIT_MESSAGES = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class AuditLog(object):
|
class AuditLog:
|
||||||
def __init__(self, logger):
|
def __init__(self, logger):
|
||||||
self.logger = logger
|
self.logger = logger
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ class UnallowedMessage(Exception):
|
|||||||
super(UnallowedMessage, self).__init__(message)
|
super(UnallowedMessage, self).__init__(message)
|
||||||
|
|
||||||
|
|
||||||
class MessageHandler(object):
|
class MessageHandler:
|
||||||
|
|
||||||
def __init__(self, request):
|
def __init__(self, request):
|
||||||
self.req = request
|
self.req = request
|
||||||
|
@ -14,7 +14,7 @@ key_types = {'simple': SimpleKey,
|
|||||||
'kem': KEMHandler}
|
'kem': KEMHandler}
|
||||||
|
|
||||||
|
|
||||||
class Validator(object):
|
class Validator:
|
||||||
"""Validates incoming messages."""
|
"""Validates incoming messages."""
|
||||||
|
|
||||||
def __init__(self, allowed=None):
|
def __init__(self, allowed=None):
|
||||||
|
@ -200,7 +200,7 @@ class KEMHandler(MessageHandler):
|
|||||||
return {'type': 'kem', 'value': value}
|
return {'type': 'kem', 'value': value}
|
||||||
|
|
||||||
|
|
||||||
class KEMClient(object):
|
class KEMClient:
|
||||||
|
|
||||||
def __init__(self, server_keys, client_keys):
|
def __init__(self, server_keys, client_keys):
|
||||||
self.server_keys = server_keys
|
self.server_keys = server_keys
|
||||||
|
@ -20,14 +20,14 @@ from .log import CustodiaLoggingAdapter, auditlog, getLogger
|
|||||||
logger = getLogger(__name__)
|
logger = getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class _Required(object):
|
class _Required:
|
||||||
__slots__ = ()
|
__slots__ = ()
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return 'REQUIRED'
|
return 'REQUIRED'
|
||||||
|
|
||||||
|
|
||||||
class INHERIT_GLOBAL(object): # noqa: N801
|
class INHERIT_GLOBAL: # noqa: N801
|
||||||
__slots__ = ('default',)
|
__slots__ = ('default',)
|
||||||
|
|
||||||
def __init__(self, default):
|
def __init__(self, default):
|
||||||
@ -68,7 +68,7 @@ class CSStoreDenied(CustodiaException):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class OptionHandler(object):
|
class OptionHandler:
|
||||||
"""Handler and parser for plugin options
|
"""Handler and parser for plugin options
|
||||||
"""
|
"""
|
||||||
def __init__(self, parser, section):
|
def __init__(self, parser, section):
|
||||||
@ -108,7 +108,7 @@ class OptionHandler(object):
|
|||||||
|
|
||||||
def check_surplus(self):
|
def check_surplus(self):
|
||||||
surplus = []
|
surplus = []
|
||||||
for name, _ in self.parser.items(self.section):
|
for name, _value in self.parser.items(self.section):
|
||||||
if (name not in self.seen and not
|
if (name not in self.seen and not
|
||||||
self.parser.has_option(configparser.DEFAULTSECT, name)):
|
self.parser.has_option(configparser.DEFAULTSECT, name)):
|
||||||
surplus.append(name)
|
surplus.append(name)
|
||||||
@ -190,7 +190,7 @@ class OptionHandler(object):
|
|||||||
return json.loads(value)
|
return json.loads(value)
|
||||||
|
|
||||||
|
|
||||||
class PluginOption(object):
|
class PluginOption:
|
||||||
"""Plugin option
|
"""Plugin option
|
||||||
|
|
||||||
code::
|
code::
|
||||||
@ -293,7 +293,7 @@ class CustodiaPluginMeta(abc.ABCMeta):
|
|||||||
|
|
||||||
|
|
||||||
@six.add_metaclass(CustodiaPluginMeta)
|
@six.add_metaclass(CustodiaPluginMeta)
|
||||||
class CustodiaPlugin(object):
|
class CustodiaPlugin:
|
||||||
"""Abstract base class for all Custodia plugins
|
"""Abstract base class for all Custodia plugins
|
||||||
"""
|
"""
|
||||||
_options = ()
|
_options = ()
|
||||||
|
@ -114,10 +114,9 @@ class Secrets(HTTPConsumer):
|
|||||||
for t in types:
|
for t in types:
|
||||||
if t.strip() == 'application/json':
|
if t.strip() == 'application/json':
|
||||||
binary = False
|
binary = False
|
||||||
break
|
|
||||||
elif t.strip() == 'application/octet-stream':
|
elif t.strip() == 'application/octet-stream':
|
||||||
binary = True
|
binary = True
|
||||||
if binary is True:
|
if binary:
|
||||||
response['headers'][
|
response['headers'][
|
||||||
'Content-Type'] = 'application/octet-stream'
|
'Content-Type'] = 'application/octet-stream'
|
||||||
response['output'] = b64decode(reply['value'])
|
response['output'] = b64decode(reply['value'])
|
||||||
|
@ -11,7 +11,7 @@ from ipaserver.custodia.compat import configparser
|
|||||||
from ipaserver.custodia.compat import url_escape
|
from ipaserver.custodia.compat import url_escape
|
||||||
|
|
||||||
|
|
||||||
class CustodiaConfig(object):
|
class CustodiaConfig:
|
||||||
CONFIG_SPECIALS = ['authenticators', 'authorizers', 'consumers', 'stores']
|
CONFIG_SPECIALS = ['authenticators', 'authorizers', 'consumers', 'stores']
|
||||||
|
|
||||||
DEFAULT_PATHS = [
|
DEFAULT_PATHS = [
|
||||||
@ -86,7 +86,7 @@ class CustodiaConfig(object):
|
|||||||
return configfiles
|
return configfiles
|
||||||
|
|
||||||
def makedirs(self):
|
def makedirs(self):
|
||||||
for name, _ in self.DEFAULT_PATHS:
|
for name, _path in self.DEFAULT_PATHS:
|
||||||
path = self.parser.get(u'DEFAULT', name)
|
path = self.parser.get(u'DEFAULT', name)
|
||||||
parent = os.path.dirname(path)
|
parent = os.path.dirname(path)
|
||||||
# create parents according to umask
|
# create parents according to umask
|
||||||
|
Loading…
Reference in New Issue
Block a user