This is an automated email from the ASF dual-hosted git repository.
ocket8888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git
The following commit(s) were added to refs/heads/master by this push:
new a30bbcb TO Postinstall: Check if hashlib.scrypt() exists before
calling it (#6286)
a30bbcb is described below
commit a30bbcb1ca71c443586cfe50672717238522eb1d
Author: Zach Hoffman <[email protected]>
AuthorDate: Wed Oct 20 18:40:46 2021 +0000
TO Postinstall: Check if hashlib.scrypt() exists before calling it (#6286)
---
CHANGELOG.md | 1 +
traffic_ops/install/bin/_postinstall.py | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6784a37..c4b3e3b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -19,6 +19,7 @@ The format is based on [Keep a
Changelog](http://keepachangelog.com/en/1.0.0/).
- [#6255](https://github.com/apache/trafficcontrol/issues/6255) - Unreadable
Prod Mode CDN Notifications in Traffic Portal
- [#6259](https://github.com/apache/trafficcontrol/issues/6259) - Traffic
Portal No Longer Allows Spaces in Server Object "Router Port Name"
- [#6175](https://github.com/apache/trafficcontrol/issues/6175) - POST request
to /api/4.0/phys_locations accepts mismatch values for regionName.
+- [#6283](https://github.com/apache/trafficcontrol/issues/6283) - The Traffic
Ops Postinstall script will work in CentOS 7, even if Python 3 is installed
### Changed
- Updated `t3c` to request less unnecessary deliveryservice-server assignment
and invalidation jobs data via new query params supported by Traffic Ops
diff --git a/traffic_ops/install/bin/_postinstall.py
b/traffic_ops/install/bin/_postinstall.py
index 01a2b4e..35a770e 100755
--- a/traffic_ops/install/bin/_postinstall.py
+++ b/traffic_ops/install/bin/_postinstall.py
@@ -429,7 +429,7 @@ def hash_pass(passwd): # type: (str) -> str
p_val = 1
dklen = 64
salt = os.urandom(dklen)
- if sys.version_info.major >= 3:
+ if sys.version_info.major >= 3 and hasattr(hashlib, 'scrypt'): # Python
2.7 and CentOS 7's Python 3.6 do not include hashlib.scrypt()
hashed = hashlib.scrypt(passwd.encode(), salt=salt, n=n,
r=r_val, p=p_val, dklen=dklen)
else:
hashed = Scrypt(password=passwd.encode(), salt=salt,
cost_factor=n, block_size_factor=r_val, parallelization_factor=p_val,
key_length=dklen).derive()