Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[generate_asic_config_checksum.py] Convert to Python 3 #5783

Merged
merged 4 commits into from
Nov 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion build_debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,8 @@ EOF
sudo cp ./files/scripts/core_cleanup.py $FILESYSTEM_ROOT/usr/bin/core_cleanup.py

## Copy ASIC config checksum
python files/build_scripts/generate_asic_config_checksum.py
sudo chmod 755 files/build_scripts/generate_asic_config_checksum.py
./files/build_scripts/generate_asic_config_checksum.py
if [[ ! -f './asic_config_checksum' ]]; then
echo 'asic_config_checksum not found'
exit 1
Expand Down
8 changes: 4 additions & 4 deletions files/build_scripts/generate_asic_config_checksum.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env python
#!/usr/bin/env python3

import syslog
import os
import hashlib
import os
import syslog

SYSLOG_IDENTIFIER = 'asic_config_checksum'

Expand Down Expand Up @@ -45,7 +45,7 @@ def generate_checksum(checksum_files):
checksum = hashlib.sha1()
for checksum_file in checksum_files:
try:
with open(checksum_file, 'r') as f:
with open(checksum_file, 'rb') as f:
for chunk in iter(lambda: f.read(CHUNK_SIZE), b""):
checksum.update(chunk)
except IOError as e:
Expand Down