Skip to content

Commit c923788

Browse files
ZhaohuiSmannytaheri
authored andcommitted
Revert "Fix loganalyzer.py UnicodeDecodeError (sonic-net#6524)" (sonic-net#6577)
This reverts commit 94ac4a0.
1 parent 39b8489 commit c923788

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

ansible/library/extract_log.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ def extract_lines(directory, filename, target_string):
9393
path = os.path.join(directory, filename)
9494
file = None
9595
if 'gz' in path:
96-
file = gzip.open(path, mode='rt', errors='ignore')
96+
file = gzip.open(path, mode='rt')
9797
else:
98-
file = open(path, errors='ignore')
98+
file = open(path)
9999
result = None
100100
with file:
101101
# This might be a gunzip file or logrotate issue, there has
@@ -238,7 +238,7 @@ def combine_logs_and_save(directory, filenames, start_string, target_string, tar
238238
do_copy = False
239239
line_processed = 0
240240
line_copied = 0
241-
with open(target_filename, 'w', errors='ignore') as fp:
241+
with open(target_filename, 'w') as fp:
242242
for filename in reversed(filenames):
243243
path = os.path.join(directory, filename)
244244
dt = datetime.datetime.fromtimestamp(os.path.getctime(path))
@@ -247,9 +247,9 @@ def combine_logs_and_save(directory, filenames, start_string, target_string, tar
247247
"extract_log combine_logs from file {} create time {}, size {}".format(path, dt, sz))
248248
file = None
249249
if 'gz' in path:
250-
file = gzip.open(path, mode='rt', errors='ignore')
250+
file = gzip.open(path, mode='rt')
251251
else:
252-
file = open(path, errors='ignore')
252+
file = open(path)
253253

254254
with file:
255255
for line in file:

0 commit comments

Comments
 (0)