-
Notifications
You must be signed in to change notification settings - Fork 59
Description
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.