From 3de3d710449065f5d995cd780500b0e5c8bc2cb6 Mon Sep 17 00:00:00 2001 From: David Stanek Date: Thu, 4 Aug 2016 14:35:20 +0000 Subject: [PATCH] Make hash_algorithms order deterministic hashlib.algorithms_guaranteed is a set so the order is not guaranteed. This means that the order could be different every time 'tox -e genconfig' is run. Change-Id: Iaa46604fccb382f174836fa6e248abf0bd7c3674 --- keystone/conf/token.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/keystone/conf/token.py b/keystone/conf/token.py index 1a47b3d38d..2c72d6b868 100644 --- a/keystone/conf/token.py +++ b/keystone/conf/token.py @@ -125,11 +125,12 @@ request for a scoped token to avoid re-scoping altogether. """)) # This attribute only exists in Python 2.7.8+ or 3.2+ -hash_algorithm_choices = getattr(hashlib, 'algorithms_guaranteed', None) +hash_choices = getattr(hashlib, 'algorithms_guaranteed', None) +hash_choices = sorted(hash_choices) if hash_choices else None hash_algorithm = cfg.StrOpt( 'hash_algorithm', default='md5', - choices=hash_algorithm_choices, + choices=hash_choices, deprecated_for_removal=True, deprecated_reason=constants._DEPRECATE_PKI_MSG, help=utils.fmt("""