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
This commit is contained in:
Xingchao Yu 2013-10-18 13:50:18 +08:00
parent 8491caeba1
commit e5aa6e7273
2 changed files with 6 additions and 2 deletions

@ -676,6 +676,7 @@
# Driver or drivers to handle sending notifications (multi
# valued)
#notification_driver=
# Default notification level for outgoing notifications
# (string value)

@ -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)