Skip to content
This repository was archived by the owner on Nov 24, 2025. It is now read-only.
This repository was archived by the owner on Nov 24, 2025. It is now read-only.

TO Postinstall: AttributeError: module 'hashlib' has no attribute 'scrypt' #6285

@zrhoffman

Description

@zrhoffman

This Bug Report affects these Traffic Control components:

  • Traffic Ops - Postinstall

Current behavior:

Python Postinstall fails on CentOS 7 if Python 3 is installed (but succeeds if Python 3 is not installed, because it will use Python 2).

Originally reported by @rsidhaarth in the first draft of #6236.

Expected behavior:

the Python Postinstall script should succeed on CentOS 7, with or without Python 3.

Steps to reproduce:

<<'DOCKER_COMMANDS' docker run --rm -iv$(pwd):/opt -w/opt centos:7 bash
yum -y install python3 &&
<<'PYTHON_COMMANDS' PYTHONPATH=traffic_ops/install/bin python3
import _postinstall
print(_postinstall.hash_pass('mysecretpassword'))
PYTHON_COMMANDS
DOCKER_COMMANDS

Output:

[...]
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
  File "/opt/traffic_ops/install/bin/_postinstall.py", line 433, in hash_pass
    hashed = hashlib.scrypt(passwd.encode(), salt=salt, n=n, r=r_val, p=p_val, dklen=dklen)
AttributeError: module 'hashlib' has no attribute 'scrypt'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Traffic Opsrelated to Traffic Opsbugsomething isn't working as intendedinstallrelated to the installation process

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions