diff options
| author | Damien Ciabrini <dciabrin@redhat.com> | 2019-01-17 19:06:21 +0100 |
|---|---|---|
| committer | Michele Baldessari <michele@acksyn.org> | 2019-01-18 10:37:44 +0100 |
| commit | 8344c8ea21428c5978d3c5e7ae74d6e43dd8ba95 (patch) | |
| tree | 3de122645f4015db3e0a6e35046b1a08f3a98c20 /docker/base | |
| parent | 453ad6ca43dea18a48f7baf9197ba917056813cb (diff) | |
| download | kolla-8344c8ea21428c5978d3c5e7ae74d6e43dd8ba95.tar.gz kolla-8344c8ea21428c5978d3c5e7ae74d6e43dd8ba95.zip | |
Make set_config.py compatible with both Py2 and Py3
When asserting the validity of config files, we currently
use viewkeys(), which has been removed in Python3, so a kolla
container cannot set the config with Python3 only.
"Traceback (most recent call last):",
" File \"/usr/local/bin/kolla_set_configs\", line 406, in main",
" config = load_config()",
" File \"/usr/local/bin/kolla_set_configs\", line 297, in load_config",
" validate_config(config)",
" File \"/usr/local/bin/kolla_set_configs\", line 238, in validate_config",
" if not data.viewkeys() >= required_keys:",
"AttributeError: 'dict' object has no attribute 'viewkeys'"
Use keys() instead, which is compatible with both Python2 and
Python3, and has no visible performance disadvantage and wrap it in a
set() call so that we are guranteed to compare sets.
Change-Id: I5f53c8f5a390a9df3ebb60659ebdcef41e3a9cad
Co-Authored-By: Michele Baldessari <michele@acksyn.org>
Diffstat (limited to 'docker/base')
| -rw-r--r-- | docker/base/set_configs.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/docker/base/set_configs.py b/docker/base/set_configs.py index 5533e668a..9176a510d 100644 --- a/docker/base/set_configs.py +++ b/docker/base/set_configs.py @@ -235,7 +235,7 @@ def validate_config(config): # Validate config sections for data in config.get('config_files', list()): # Verify required keys exist. - if not data.viewkeys() >= required_keys: + if not set(data.keys()) >= required_keys: message = 'Config is missing required keys: %s' % required_keys raise InvalidConfig(message) if ('owner' not in data or 'perm' not in data) \ |
