Browse Source

Fix py3 issue on fernet-manage and update-endpoint

fernet-manage:
 - filter used to return a list on python2 but on python3 it returns
 an iterator which has no len method
 - Coherce the keys var into a list so we can run len on it on both
 versions

update-endpoint:
 - ConfigParser is called configparser on python3
 - try/catch and import the proper configparser

Change-Id: I8296074f4d20e47afe0c7aea41bf21999685aecd
Itxaka 1 month ago
parent
commit
e136b0d822

+ 4
- 1
keystone/templates/bin/_endpoint-update.py.tpl View File

@@ -17,7 +17,10 @@ limitations under the License.
17 17
 #!/usr/bin/env python
18 18
 import os
19 19
 import sys
20
-import ConfigParser
20
+try:
21
+    import ConfigParser
22
+except ImportError:
23
+    import configparser as ConfigParser
21 24
 import logging
22 25
 from sqlalchemy import create_engine
23 26
 

+ 1
- 1
keystone/templates/bin/_fernet-manage.py.tpl View File

@@ -91,7 +91,7 @@ def read_from_files():
91 91
     for key in keys:
92 92
         with open(FERNET_DIR + key, 'r') as f:
93 93
             data[key] = f.read()
94
-    if len(keys):
94
+    if len(list(keys)):
95 95
         LOG.debug("Keys read from files: %s", keys)
96 96
     else:
97 97
         LOG.warn("No keys were read from files.")

Loading…
Cancel
Save