DNSSEC: Reformat lines to address PEP8 violations

Signed-off-by: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
This commit is contained in:
Christian Heimes
2017-12-15 16:33:50 +01:00
parent 6a54146bc0
commit f39d855af4
4 changed files with 24 additions and 12 deletions

View File

@@ -58,7 +58,10 @@ class BINDMgr(object):
def time_ldap2bindfmt(self, str_val):
if isinstance(str_val, bytes):
str_val = str_val.decode('utf-8')
dt = datetime.strptime(str_val, ipalib.constants.LDAP_GENERALIZED_TIME_FORMAT)
dt = datetime.strptime(
str_val,
ipalib.constants.LDAP_GENERALIZED_TIME_FORMAT
)
return dt.strftime(time_bindfmt).encode('utf-8')
def dates2params(self, ldap_attrs):

View File

@@ -47,7 +47,11 @@ class KeySyncer(SyncReplConsumer):
Given set of attributes has to have exactly one supported object class.
"""
supported_objclasses = {b'idnszone', b'idnsseckey', b'ipk11publickey'}
present_objclasses = set([o.lower() for o in attrs[OBJCLASS_ATTR]]).intersection(supported_objclasses)
present_objclasses = set(
o.lower() for o in attrs[OBJCLASS_ATTR]
).intersection(
supported_objclasses
)
assert len(present_objclasses) == 1, attrs[OBJCLASS_ATTR]
return present_objclasses.pop()

View File

@@ -299,13 +299,16 @@ class LdapKeyDB(AbstractHSM):
for attr in default_attrs:
key.setdefault(attr, default_attrs[attr])
assert 'ipk11id' in key, 'key is missing ipk11Id in %s' % key.entry.dn
assert 'ipk11id' in key, \
'key is missing ipk11Id in %s' % key.entry.dn
key_id = key['ipk11id']
assert key_id not in keys, \
'duplicate ipk11Id=0x%s in "%s" and "%s"' % \
(str_hexlify(key_id), key.entry.dn, keys[key_id].entry.dn)
assert 'ipk11label' in key, 'key "%s" is missing ipk11Label' % key.entry.dn
assert 'objectclass' in key.entry, 'key "%s" is missing objectClass attribute' % key.entry.dn
assert 'ipk11label' in key, \
'key "%s" is missing ipk11Label' % key.entry.dn
assert 'objectclass' in key.entry, \
'key "%s" is missing objectClass attribute' % key.entry.dn
keys[key_id] = key
@@ -399,12 +402,13 @@ class LdapKeyDB(AbstractHSM):
for key in keys.values():
prefix = 'dnssec-master'
assert key['ipk11label'] == prefix, \
'secret key dn="%s" ipk11id=0x%s ipk11label="%s" with ipk11UnWrap = TRUE does not have '\
'"%s" key label' % (
'secret key dn="%s" ipk11id=0x%s ipk11label="%s" with ' \
'ipk11UnWrap = TRUE does not have "%s" key label' % (
key.entry.dn,
str_hexlify(key['ipk11id']),
str(key['ipk11label']),
prefix)
prefix
)
self.cache_masterkeys = keys
return keys

View File

@@ -18,7 +18,6 @@ from ipaserver.dnssec.abshsm import (attrs_name2id, attrs_id2name, AbstractHSM,
from ipaserver.dnssec.ldapkeydb import str_hexlify
private_key_api_params = set(["label", "id", "data", "unwrapping_key",
"wrapping_mech", "key_type", "cka_always_authenticate", "cka_copyable",
"cka_decrypt", "cka_derive", "cka_extractable", "cka_modifiable",
@@ -139,9 +138,11 @@ class LocalHSM(AbstractHSM):
for key in keys.values():
prefix = 'dnssec-master'
assert key['ipk11label'] == prefix, \
'secret key ipk11id=0x%s ipk11label="%s" with ipk11UnWrap = TRUE does not have '\
'"%s" key label' % (str_hexlify(key['ipk11id']),
str(key['ipk11label']), prefix)
'secret key ipk11id=0x%s ipk11label="%s" with ipk11UnWrap ' \
'= TRUE does not have "%s" key label' % (
str_hexlify(key['ipk11id']),
str(key['ipk11label']), prefix
)
return keys