Fix DuplicateOptError in fixed_key migration code

Fix how the key migration code loads the fixed_key config option so that
it handles DuplicateOptError.

Closes-Bug: #1747021
Change-Id: I119a12c8e80ad991f5a2916fec2ef4421039b9e9
This commit is contained in:
Alan Bishop 2018-02-02 15:37:49 +00:00
parent eee1d29e0a
commit 167dc4e1bd
1 changed files with 6 additions and 3 deletions

View File

@ -44,9 +44,12 @@ class KeyMigrator(object):
def handle_key_migration(self, volumes):
castellan_options.set_defaults(self.conf)
self.conf.import_opt(name='fixed_key',
module_str='cinder.keymgr.conf_key_mgr',
group='key_manager')
try:
self.conf.import_opt(name='fixed_key',
module_str='cinder.keymgr.conf_key_mgr',
group='key_manager')
except cfg.DuplicateOptError:
pass
fixed_key = self.conf.key_manager.fixed_key
backend = self.conf.key_manager.backend or ''