Skip to content
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

sshkey map fails to import #110

Open
KMTMark opened this issue Sep 9, 2020 · 4 comments
Open

sshkey map fails to import #110

KMTMark opened this issue Sep 9, 2020 · 4 comments

Comments

@KMTMark
Copy link

KMTMark commented Sep 9, 2020

It appears due to now using python3 the section that imports the sshkey map fails:

Traceback (most recent call last):
File "/usr/sbin/nsscache", line 32, in
return_value = nsscache_app.Run(sys.argv[1:], os.environ)
File "/usr/lib/python3/dist-packages/nss_cache/app.py", line 248, in Run
retval = command_callable().Run(conf=conf, args=args)
File "/usr/lib/python3/dist-packages/nss_cache/command.py", line 236, in Run
return self.UpdateMaps(conf,
File "/usr/lib/python3/dist-packages/nss_cache/command.py", line 316, in UpdateMaps
retval = updater.UpdateFromSource(source,
File "/usr/lib/python3/dist-packages/nss_cache/update/updater.py", line 281, in UpdateFromSource
return self.UpdateCacheFromSource(cache,
File "/usr/lib/python3/dist-packages/nss_cache/update/map_updater.py", line 80, in UpdateCacheFromSource
return_val += self.FullUpdateFromMap(cache, source_map, force_write)
File "/usr/lib/python3/dist-packages/nss_cache/update/map_updater.py", line 146, in FullUpdateFromMap
return_val = cache.WriteMap(map_data=new_map)
File "/usr/lib/python3/dist-packages/nss_cache/caches/caches.py", line 219, in WriteMap
entries_written = self.Write(writable_map)
File "/usr/lib/python3/dist-packages/nss_cache/caches/files.py", line 224, in Write
write_offset += self._WriteData(self.temp_cache_file, entry)
File "/usr/lib/python3/dist-packages/nss_cache/caches/files.py", line 320, in _WriteData
target.write(sshkey_entry + '\n')
File "/usr/lib/python3.8/tempfile.py", line 613, in func_wrapper
return func(*args, **kwargs)
TypeError: a bytes-like object is required, not 'str'

To get around this we have locally amended line 317 in the files.py to:

target.write(sshkey_entry.encode() + b'\n')

Which matches the format used by the other map sections of the file and it will then run OK and update the cache without error.

@rolnas
Copy link

rolnas commented Sep 16, 2020

Same problem with netgroup and automount maps.

@mboutolleau
Copy link
Contributor

This issue seems to be fixed by #111.

@jorhett
Copy link

jorhett commented Jan 16, 2021

which remains unreleased and thus unavailable in any repos

@jorhett
Copy link

jorhett commented Apr 13, 2021

Okay, it's out in .4x releases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants