#63 set_option() argument must be str, not bytes in dirsrv open
Closed: Fixed 6 years ago Opened 6 years ago by firstyear.

During the change to TLS external auth, binds in lib389 for python3 are broken due to a str vs bytes issue.


Metadata Update from @firstyear:
- Custom field Review Status adjusted to review

6 years ago

The fix is okay, but we have other str/byte failures too for Python 3 (more than a half from all CI tests). If you plan to deal with them later, you have my 'ack' for this change.

The faliures are like this:

lib389/tests/agreement_test.py::test_create FAILED

============================FAILURES ==================================
____________________________________________ test_create ___________________________________________

topology = <lib389.tests.agreement_test.TopologyReplication object at 0x7fac16595128>

def test_create(topology):
    """Test to create a replica agreement and initialize the consumer.
    Test on a unknown suffix
    """

    topology.master.log.info("\n\n##############\n## CREATE\n##############\n")
    properties = {RA_NAME: ('meTo_%s:%d' % (topology.consumer.host,
                                            topology.consumer.port)),
                  RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
                  RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
                  RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
                  RA_TRANSPORT_PROT: defaultProperties[REPLICATION_TRANSPORT]}
    repl_agreement = topology.master.agreement.create(
        suffix=SUFFIX, host=topology.consumer.host,
        port=topology.consumer.port, properties=properties)
    topology.master.log.debug("%s created" % repl_agreement)
>       topology.master.agreement.init(SUFFIX, HOST_CONSUMER, PORT_CONSUMER)

lib389/tests/agreement_test.py:107:
 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
lib389/agreement.py:649: in init
    self.conn.modify_s(entry.dn, mod)
lib389/__init__.py:162: in inner
    return f(*args, **kwargs)
/usr/lib64/python3.5/site-packages/ldap/ldapobject.py:571: in modify_s
    return self.modify_ext_s(dn,modlist,None,None)
lib389/__init__.py:162: in inner
    return f(*args, **kwargs)
/usr/lib64/python3.5/site-packages/ldap/ldapobject.py:543: in modify_ext_s
    msgid = self.modify_ext(dn,modlist,serverctrls,clientctrls)
lib389/__init__.py:162: in inner
    return f(*args, **kwargs)
/usr/lib64/python3.5/site-packages/ldap/ldapobject.py:540: in modify_ext
    return self._ldap_call(self._l.modify_ext,dn,modlist,RequestControlTuples(serverctrls),RequestControlTuples(clientctrls))
lib389/__init__.py:162: in inner
    return f(*args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <lib389.DirSrv object at 0x7fac16615668>, func = <built-in method modify_ext of LDAP object at 0x7fac165dbf08>
args = ('cn=meTo_localhost:50389,cn=replica,cn=dc\\3Dexample\\2Cdc\\3Dcom,cn=mapping tree,cn=config', [(0, 'nsds5BeginReplicaRefresh', 'start')], None, None), kwargs = {}
diagnostic_message_success = None

def _ldap_call(self,func,*args,**kwargs):
  """
    Wrapper method mainly for serializing calls into OpenLDAP libs
    and trace logs
    """
  self._ldap_object_lock.acquire()
  if __debug__:
    if self._trace_level>=1:
      self._trace_file.write('*** %s %s - %s\n%s\n' % (
        repr(self),
        self._uri,
        '.'.join((self.__class__.__name__,func.__name__)),
        pprint.pformat((args,kwargs))
      ))
      if self._trace_level>=9:
        traceback.print_stack(limit=self._trace_stack_limit,file=self._trace_file)
  diagnostic_message_success = None
  try:
    try:
>         result = func(*args,**kwargs)
E         TypeError: ('expected a byte string in the list', 's')

/usr/lib64/python3.5/site-packages/ldap/ldapobject.py:265: TypeError

I wasn't planning on, but I'll make a second patch to fix this too :)

Metadata Update from @spichugi:
- Custom field Review Status adjusted to ack (was: review)

6 years ago

The change looks good. But we have a lot more failures though.
On both, Python 3 and Python 2...

commit ffa0af5
commit 5335246

Git push messed up and didn't take the reworded commit, but thanks :)

I'll work on more of the py2/py3 test issues shortly.

Metadata Update from @firstyear:
- Issue close_status updated to: Fixed
- Issue status updated to: Closed (was: Open)

6 years ago

Login to comment on this ticket.

Metadata