From e5aa6e72734738e81d1b8be51ae3bb39db50f8a3 Mon Sep 17 00:00:00 2001 From: Xingchao Yu Date: Fri, 18 Oct 2013 13:50:18 +0800 Subject: [PATCH] Fix generate conf script can't handle multistropt In case MultiStrOpt option's value is empty list, current extract_opts.py logic will ignore it. This patch aims to update func _print_opt: add the multistropt's option_name in conf even its value is empty list. This bug also affects https://bugs.launchpad.net/cinder/+bug/1240783 Closes-bug: #1241348 Change-Id: Ica1da0cd20c97a587964cb0059836d609a440145 --- etc/cinder/cinder.conf.sample | 1 + tools/conf/extract_opts.py | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/etc/cinder/cinder.conf.sample b/etc/cinder/cinder.conf.sample index 1cedb846b..451c5243d 100644 --- a/etc/cinder/cinder.conf.sample +++ b/etc/cinder/cinder.conf.sample @@ -676,6 +676,7 @@ # Driver or drivers to handle sending notifications (multi # valued) +#notification_driver= # Default notification level for outgoing notifications # (string value) diff --git a/tools/conf/extract_opts.py b/tools/conf/extract_opts.py index 73f0dcb08..141cc75d2 100644 --- a/tools/conf/extract_opts.py +++ b/tools/conf/extract_opts.py @@ -177,8 +177,11 @@ def _print_opt(opt): print('#%s=%s' % (opt_name, ','.join(opt_default))) elif opt_type == MULTISTROPT: assert(isinstance(opt_default, list)) - for default in opt_default: - print('#%s=%s' % (opt_name, default)) + if opt_default: + for default in opt_default: + print('#%s=%s' % (opt_name, default)) + else: + print('#%s=' % (opt_name)) print() except Exception: sys.stderr.write('Error in option "%s"\n' % opt_name) -- 2.45.2