mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
py3: ipautil: open tempfiles in text mode
Code in ipautlis works with text, so tempfiles should be open in textmode otherwise TypeErrors are raised https://fedorahosted.org/freeipa/ticket/4985 Reviewed-By: Christian Heimes <cheimes@redhat.com> Reviewed-By: Jan Cholasta <jcholast@redhat.com>
This commit is contained in:
@@ -1020,7 +1020,7 @@ $)''', re.VERBOSE)
|
||||
orig_stat = os.stat(filepath)
|
||||
old_values = dict()
|
||||
temp_filename = None
|
||||
with tempfile.NamedTemporaryFile(delete=False) as new_config:
|
||||
with tempfile.NamedTemporaryFile(mode="w", delete=False) as new_config:
|
||||
temp_filename = new_config.name
|
||||
with open(filepath, 'r') as f:
|
||||
for line in f:
|
||||
@@ -1106,7 +1106,7 @@ $)''', re.VERBOSE)
|
||||
orig_stat = os.stat(filepath)
|
||||
old_values = dict()
|
||||
temp_filename = None
|
||||
with tempfile.NamedTemporaryFile(delete=False) as new_config:
|
||||
with tempfile.NamedTemporaryFile(mode='w', delete=False) as new_config:
|
||||
temp_filename = new_config.name
|
||||
with open(filepath, 'r') as f:
|
||||
in_section = False
|
||||
|
||||
Reference in New Issue
Block a user