Don't fail if pg_hba/pg_ident contain comment lines (#2888)

yaml parser interprets such lines as null and stores it as None into the
array of the parsed values, which can not be handled by write() function
and crashes the whole bootstrap process.
Even though it is not the proper value, it won't hurt if we just ignore it instead of failing completely.
This commit is contained in:
Polina Bungina
2023-09-27 15:57:09 +02:00
committed by GitHub
parent 27915984b4
commit aaac6f6fb0
+3 -2
View File
@@ -244,9 +244,10 @@ class ConfigWriter(object):
self._fd.write(line)
self._fd.write('\n')
def writelines(self, lines: List[str]) -> None:
def writelines(self, lines: List[Optional[str]]) -> None:
for line in lines:
self.writeline(line)
if isinstance(line, str):
self.writeline(line)
@staticmethod
def escape(value: Any) -> str: # Escape (by doubling) any single quotes or backslashes in given string