nsscache icon indicating copy to clipboard operation
nsscache copied to clipboard

sshkey map fails to import

Open KMTMark opened this issue 5 years ago • 4 comments

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.

KMTMark avatar Sep 09 '20 11:09 KMTMark

Same problem with netgroup and automount maps.

rolnas avatar Sep 16 '20 08:09 rolnas

This issue seems to be fixed by #111.

mboutolleau avatar Jan 13 '21 17:01 mboutolleau

which remains unreleased and thus unavailable in any repos

jorhett avatar Jan 16 '21 22:01 jorhett

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

jorhett avatar Apr 13 '21 20:04 jorhett