-
Notifications
You must be signed in to change notification settings - Fork 55
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
is nsscache python3 compatible? #89
Comments
There's no active effort at the moment but I love pull requests.
…On Wed, 2 Oct 2019, 11:08 Sandro Tosi, ***@***.***> wrote:
travis config points to some python3 images, but if you run tests there,
they fail as the code is clearly not ready yet (print statements all over,
and other python2-isms).
is there any effort to port it to python3 anytime soon?
In Debian we're trying to phase out python2 during this development cycle.
thanks!
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#89?email_source=notifications&email_token=AAXFX6YE6FYTJPM5E74KC53QMPYBHA5CNFSM4I4QQT2KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HPAAX5Q>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAXFX63OGS3P5YC6X2NLNXTQMPYBHANCNFSM4I4QQT2A>
.
|
I modifed the the print functions, exceptions, imports, assets in test files and modified the |
I think we need to migrate to use the ldap3 library instead of python-ldap,
as the latter only works with python2 but "ldap3" claims to work with both
versions.
https://ldap3.readthedocs.io/
…On Tue, 29 Oct 2019 at 03:43, 3c2b2ff5 ***@***.***> wrote:
I modifed the the print functions, exceptions, imports, assets in test
files and modified the nss.pyand nss_tets.py and the maps.py to pass
Python 3 test.
Now I am struggling with string/byte handling for ldapsource.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#89?email_source=notifications&email_token=AAXFX632TE7FE3HIG7LYX7TQQ4JDRA5CNFSM4I4QQT2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECNSAGQ#issuecomment-547037210>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAXFX65UF5543IGPXVXSZYLQQ4JDRANCNFSM4I4QQT2A>
.
|
I thought about it a while a go. Well that means a lot of work. I found python3-ldap, isn't it the python3 version of python-ldap? |
when I run my pull request with Python 3 I get the following error, this has to do with python-ldap library I guess and how it returns the data, so either go through the code and make it Python 3 compatible, which can be very time consuming and frustrating or import to python3-ldap which is Python3 only as I understand or migrate to ldap3, which claims to do both.
|
I'm happy to go to Python3 only if that simplifies matters.
…On Tue, 29 Oct 2019 at 10:50, 3c2b2ff5 ***@***.***> wrote:
when I run my pull request
<a4f8f39>
with Python 3 I get the following error, this has to do with python-ldap
library I guess and how it returns the data, so either go through the code
and make it Python 3 compatible, which can be very time consuming and
frustrating or import to python3-ldap which is Python3 only as I understand
or migrate to ldap3, which claims to do both.
***@***.***: # python3 /usr/sbin/nsscache update -f
Traceback (most recent call last):
File "/usr/sbin/nsscache", line 34, in <module>
return_value = nsscache_app.Run(sys.argv[1:], os.environ)
File "/usr/lib/python3/dist-packages/nss_cache/app.py", line 240, in Run
retval = command_callable().Run(conf=conf, args=args)
File "/usr/lib/python3/dist-packages/nss_cache/command.py", line 230, in Run
force_lock=options.force_lock)
File "/usr/lib/python3/dist-packages/nss_cache/command.py", line 303, in UpdateMaps
force_write=force_write)
File "/usr/lib/python3/dist-packages/nss_cache/update/updater.py", line 275, in UpdateFromSource
force_write, location=None)
File "/usr/lib/python3/dist-packages/nss_cache/update/map_updater.py", line 75, in UpdateCacheFromSource
location=location)
File "/usr/lib/python3/dist-packages/nss_cache/sources/source.py", line 63, in GetMap
return self.GetPasswdMap(since)
File "/usr/lib/python3/dist-packages/nss_cache/sources/ldapsource.py", line 420, in GetPasswdMap
since=since)
File "/usr/lib/python3/dist-packages/nss_cache/sources/ldapsource.py", line 664, in GetUpdates
obj_ts = self.FromLdapToTimestamp(obj['whenChanged'][0])
File "/usr/lib/python3/dist-packages/nss_cache/sources/ldapsource.py", line 572, in FromLdapToTimestamp
t = time.strptime(ldap_ts_string, '%Y%m%d%H%M%S.0Z')
File "/usr/lib/python3.7/_strptime.py", line 571, in _strptime_time
tt = _strptime(data_string, format)[0]
File "/usr/lib/python3.7/_strptime.py", line 326, in _strptime
raise TypeError(msg.format(index, type(arg)))
TypeError: strptime() argument 0 must be str, not <class 'bytes'>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#89?email_source=notifications&email_token=AAXFX6YZQQ2C3LFJ3LTEB3DQQ53DPA5CNFSM4I4QQT2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECOYRPQ#issuecomment-547195070>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAXFX65KNC3JQQYMYNPZ3NDQQ53DPANCNFSM4I4QQT2A>
.
|
I would also suggest to go with python3 only, since Python2 EOL is in few months, so it doesn't make any sense to go through he code or use cross-version framework like six. |
Python3 represent the object data as bytes. An object looks like this:
In Python 2 this wasn't problem, since bytes are treated as strings an vise versa. Now we need to specify it all over the code, so if we keep the the byte objects, we have to decode them to string where ever needed in the code, or the other way around, which I think is the better way, especially for writing the cache, a passwd entry must be a string, other wise will end up with an empty cache. |
I made few changes to merge to Python 3 only, caching and verifying works, at least for AD. Still have 34 errors when I do the runtests. But I am on it. |
I've merged in your python3_second branch locally here and started working
on the rest of the issues.
There's a lot in the nssdb cache module about string to bytes conversions,
and a few behaviour changes in mox3, and a few actual bugs that python3 is
correctly erroring on.
Still a WIP though, but I'll merge it upstream.
…On Wed, 30 Oct 2019 at 03:05, 3c2b2ff5 ***@***.***> wrote:
I made few changes to merge to Python 3 only, caching and verifying works,
at least for AD. Still have 34 errors when I do the runtests. But I am on
it.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#89?email_source=notifications&email_token=AAXFX67RJ65U7I3REDTBXWTQRBNLNA5CNFSM4I4QQT2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECRCYOA#issuecomment-547499064>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAXFX64WRSHX5JFF6IWMQT3QRBNLNANCNFSM4I4QQT2A>
.
|
So you want to git rid of Python 2 completely and not supporting both. Its good. I am curious about the errors you will fix. |
If you want me to work on anything, just let me know. |
I could fix some nssdb errors and failures in python3_second, further more I changed some imports to import only the library needed, I removed duplicates in requirements.txt.
Now there are I hope I can get through the rest, unless you already have a fix. |
Yep I did mean that we should not keep python 2 around. Sorry if that
didn't come across correctly.
I've fixed all but two failures now which look like encoding errors in
consulsource.py.
…On Fri, 1 Nov 2019, 07:47 3c2b2ff5, ***@***.***> wrote:
I could fix some nssdb errors and failures in python3_second
<https://github.com/3c2b2ff5/nsscache/tree/python3_second>, further more
I changed some imports to import only the library needed, I removed
duplicates in requirements.txt.
Now there are FAILED (failures=2, errors=3, skipped=7)
I hope I can get through the rest, unless you already have a fix.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#89?email_source=notifications&email_token=AAXFX6YAX7KBISW5YCU3L6TQRM74VA5CNFSM4I4QQT2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECZGHPA#issuecomment-548561852>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAXFX66J5CGZFW4TTIMPIGTQRM74VANCNFSM4I4QQT2A>
.
|
I fixed one failure in
But I didn't find the fix for the groups yet |
I just pushed my last changes to python3_second |
btw if you changed the lambda expression this way:
you can pass strings in all the tests except the load bdb cache file. It seems I just pushed a cosmetic change in |
shall I make a pull request with my resent changes and you modify it accordingly to your fixes for the errors? |
Yes please!
…On Fri, 1 Nov 2019 at 10:01, 3c2b2ff5 ***@***.***> wrote:
shall I make a pull request with my resent changes ynd you modify it
accordingly to your fixes for the errors?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#89?email_source=notifications&email_token=AAXFX65X6SRLK2FYN3ILQBTQRNPUVA5CNFSM4I4QQT2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECZQDOY#issuecomment-548602299>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAXFX64XJ7C72GDCDM74SY3QRNPUVANCNFSM4I4QQT2A>
.
|
I realized that
|
As of HEAD now ./runtests.py passes on all tests in python3. There's more work to do but I think we can close this bug and tag a release. Thanks @3c2b2ff5 for your help! |
Grandiose! Please let me know if how you want to proceed and what is the next step to take. I'll be happy to help. |
I've filed a couple of new issues that I've thought of, but for now can you
just do some testing of the latest code to make sure it's working as
expected? I am assuming that we have missed something :)
…On Fri, 1 Nov 2019, 11:51 3c2b2ff5, ***@***.***> wrote:
Grandiose! Please let me know if how you want to proceed and what is the
next step to take. I'll be happy to help.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#89?email_source=notifications&email_token=AAXFX65SYBAEVXB4VLHKIVTQRN4RBA5CNFSM4I4QQT2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECZVRZA#issuecomment-548624612>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAXFX6ZO3VZ7NX6OCDBNRETQRN4RBANCNFSM4I4QQT2A>
.
|
Normally yes. I'll do next week excessive tests on ldapsource, with AD and openldap. Unfortunately I cannot test the other modules, we have multiple consul cluster running in the company but as long I don't understand the code, any approach in this direction will fail. |
That's fine, thanks! As much as you are able to do is appreciated!
…On Fri, 1 Nov 2019, 12:00 3c2b2ff5, ***@***.***> wrote:
Normally yes. I'll do next week excessive tests on ldapsource, with AD and
openldap. Unfortunately I cannot test the other modules, we have multiple
consul cluster running in the company but as long I don't understand the
code, any approach in this direction will fail.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#89?email_source=notifications&email_token=AAXFX62QR2GJFLFKNNRTTHTQRN5RFA5CNFSM4I4QQT2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECZV35I#issuecomment-548625909>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAXFX6Y5AIBONP5MTYFVIH3QRN5RFANCNFSM4I4QQT2A>
.
|
travis config points to some python3 images, but if you run tests there, they fail as the code is clearly not ready yet (print statements all over, and other python2-isms).
is there any effort to port it to python3 anytime soon?
In Debian we're trying to phase out python2 during this development cycle.
thanks!
The text was updated successfully, but these errors were encountered: