The grpc library (at least the version on centos/rocky 10) has a limit
of 107 characters. Even a fairly short host name is going to be close
to this limit due to the UUID and service name in the path.
Because the tool doesn't do much else and it is safe, the workaround is
to chdir to into the parent dir of the socket and only pass the relative
path name of socket.
Fixes: https://tracker.ceph.com/issues/78857
Signed-off-by: John Mulligan <jmulligan@redhat.com>
f' {len(matches)} sockets found',
hints=['select clusters using the --cluster option'],
)
- return matches[0]
+ socket = matches[0]
+ # workaround for socket length issues in gRPC library. Because the path
+ # will typically include a long(ish) UUID and a possibly long service
+ # name we can changedir to the parent and only pass the file name along
+ # to grpc. This should be safe as this tool doesn't do much file system
+ # ops beyond this point.
+ os.chdir(socket.parent)
+ return socket.relative_to(socket.parent)
def _ceph_keyrings(self, searchdir: pathlib.Path) -> list[pathlib.Path]:
try: