python/samba: ignore encoding errors while reading files
authorPhilipp Gesang <philipp.gesang@intra2net.com>
Tue, 12 Mar 2019 14:43:42 +0000 (15:43 +0100)
committerNoel Power <npower@samba.org>
Wed, 3 Apr 2019 11:33:38 +0000 (11:33 +0000)
Provisioning fails on C locale due to the Unicode quotes in ldif
data. Patch read_and_sub_file() to read the files as UTF-8.

Signed-off-by: Philipp Gesang <philipp.gesang@intra2net.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Wed Apr  3 11:33:38 UTC 2019 on sn-devel-144

python/samba/__init__.py

index 93240dddfbb6af0eb91b14d8c46b5f8490d765f8..d851bf3606c593de8d66a77c0c7964285f100608 100644 (file)
@@ -280,7 +280,7 @@ def read_and_sub_file(file_name, subst_vars):
     :param file_name: File to be read (typically from setup directory)
      param subst_vars: Optional variables to subsitute in the file.
     """
-    data = open(file_name, 'r').read()
+    data = open(file_name, 'r', encoding="utf-8").read()
     if subst_vars is not None:
         data = substitute_var(data, subst_vars)
         check_all_substituted(data)