mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Use explicit truncating division
In Python 3, the truncating division operator, //, is needed to get C-style "int division". https://fedorahosted.org/freeipa/ticket/5623 Reviewed-By: Jan Cholasta <jcholast@redhat.com> Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
parent
7a742391c1
commit
126d899321
@ -361,9 +361,9 @@ def _reverse_zone_name(netstr):
|
|||||||
net = netaddr.IPNetwork(netstr)
|
net = netaddr.IPNetwork(netstr)
|
||||||
items = net.ip.reverse_dns.split('.')
|
items = net.ip.reverse_dns.split('.')
|
||||||
if net.version == 4:
|
if net.version == 4:
|
||||||
return u'.'.join(items[4 - net.prefixlen / 8:])
|
return u'.'.join(items[4 - net.prefixlen // 8:])
|
||||||
elif net.version == 6:
|
elif net.version == 6:
|
||||||
return u'.'.join(items[32 - net.prefixlen / 4:])
|
return u'.'.join(items[32 - net.prefixlen // 4:])
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@ -3428,7 +3428,7 @@ class dnsrecord(LDAPObject):
|
|||||||
resolver = dns.resolver.Resolver()
|
resolver = dns.resolver.Resolver()
|
||||||
resolver.set_flags(0) # disable recursion (for NS RR checks)
|
resolver.set_flags(0) # disable recursion (for NS RR checks)
|
||||||
max_attempts = int(self.api.env['wait_for_dns'])
|
max_attempts = int(self.api.env['wait_for_dns'])
|
||||||
warn_attempts = max_attempts / 2
|
warn_attempts = max_attempts // 2
|
||||||
period = 1 # second
|
period = 1 # second
|
||||||
attempt = 0
|
attempt = 0
|
||||||
log_fn = self.log.debug
|
log_fn = self.log.debug
|
||||||
|
@ -380,11 +380,11 @@ class pwpolicy(LDAPObject):
|
|||||||
if not options.get('raw', False):
|
if not options.get('raw', False):
|
||||||
if 'krbmaxpwdlife' in entry_attrs:
|
if 'krbmaxpwdlife' in entry_attrs:
|
||||||
entry_attrs['krbmaxpwdlife'][0] = unicode(
|
entry_attrs['krbmaxpwdlife'][0] = unicode(
|
||||||
int(entry_attrs['krbmaxpwdlife'][0]) / 86400
|
int(entry_attrs['krbmaxpwdlife'][0]) // 86400
|
||||||
)
|
)
|
||||||
if 'krbminpwdlife' in entry_attrs:
|
if 'krbminpwdlife' in entry_attrs:
|
||||||
entry_attrs['krbminpwdlife'][0] = unicode(
|
entry_attrs['krbminpwdlife'][0] = unicode(
|
||||||
int(entry_attrs['krbminpwdlife'][0]) / 3600
|
int(entry_attrs['krbminpwdlife'][0]) // 3600
|
||||||
)
|
)
|
||||||
|
|
||||||
def convert_time_on_input(self, entry_attrs):
|
def convert_time_on_input(self, entry_attrs):
|
||||||
|
@ -396,7 +396,7 @@ def add_range(myapi, trustinstance, range_name, dom_sid, *keys, **options):
|
|||||||
max_id = int(max(max_uid, max_gid)[0])
|
max_id = int(max(max_uid, max_gid)[0])
|
||||||
|
|
||||||
base_id = int(info.get('msSFU30OrderNumber')[0])
|
base_id = int(info.get('msSFU30OrderNumber')[0])
|
||||||
range_size = (1 + (max_id - base_id) / DEFAULT_RANGE_SIZE)\
|
range_size = (1 + (max_id - base_id) // DEFAULT_RANGE_SIZE)\
|
||||||
* DEFAULT_RANGE_SIZE
|
* DEFAULT_RANGE_SIZE
|
||||||
|
|
||||||
# Second, options given via the CLI options take precedence to discovery
|
# Second, options given via the CLI options take precedence to discovery
|
||||||
|
@ -246,9 +246,9 @@ class XMLDecryptor(object):
|
|||||||
# Decrypt the data.
|
# Decrypt the data.
|
||||||
slot = nss.get_best_slot(mech)
|
slot = nss.get_best_slot(mech)
|
||||||
key = nss.import_sym_key(slot, mech, nss.PK11_OriginUnwrap, nss.CKA_ENCRYPT, self.__key)
|
key = nss.import_sym_key(slot, mech, nss.PK11_OriginUnwrap, nss.CKA_ENCRYPT, self.__key)
|
||||||
iv = nss.param_from_iv(mech, nss.SecItem(data[0:ivlen/8]))
|
iv = nss.param_from_iv(mech, nss.SecItem(data[0:ivlen//8]))
|
||||||
ctx = nss.create_context_by_sym_key(mech, nss.CKA_DECRYPT, key, iv)
|
ctx = nss.create_context_by_sym_key(mech, nss.CKA_DECRYPT, key, iv)
|
||||||
out = ctx.cipher_op(data[ivlen / 8:])
|
out = ctx.cipher_op(data[ivlen // 8:])
|
||||||
out += ctx.digest_final()
|
out += ctx.digest_final()
|
||||||
return out
|
return out
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ def run_repeatedly(host, command, assert_zero_rc=True, test=None,
|
|||||||
raise AssertionError("Command: {cmd} repeatedly failed {times} times, "
|
raise AssertionError("Command: {cmd} repeatedly failed {times} times, "
|
||||||
"exceeding the timeout of {timeout} seconds."
|
"exceeding the timeout of {timeout} seconds."
|
||||||
.format(cmd=' '.join(command),
|
.format(cmd=' '.join(command),
|
||||||
times=timeout / time_step,
|
times=timeout // time_step,
|
||||||
timeout=timeout))
|
timeout=timeout))
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user