Public bug reported: Config options code like this doesn't generate output in the sample.config file:
ALL_OPTS = itertools.chain( compute_opts, resource_tracker_opts, allocation_ratio_opts ) def register_opts(conf): conf.register_opts(ALL_OPTS) def list_opts(): return {'DEFAULT': ALL_OPTS} The reason is that the generator created by "itertools.chain" doesn't get reset after getting used in "register_opts". A simple complete example: import itertools a = [1, 2] b = [3, 4] ab = itertools.chain(a, b) print("printing 'ab' for the first time") for i in ab: print(i) print("printing 'ab' for the second time") for i in ab: print(i) The combined list 'ab' won't get printed a second time. The same thing happens when the oslo.config generator wants to print the sample.config file. This means we use either: ab = list(itertools.chain(a, b)) or ab = a + b ** Affects: nova Importance: High Assignee: Markus Zoeller (markus_z) (mzoeller) Status: Confirmed ** Changed in: nova Importance: Undecided => High ** Changed in: nova Status: New => Confirmed ** Changed in: nova Assignee: (unassigned) => Markus Zoeller (markus_z) (mzoeller) -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to OpenStack Compute (nova). https://bugs.launchpad.net/bugs/1565824 Title: config option generation doesn't work with itertools.chain Status in OpenStack Compute (nova): Confirmed Bug description: Config options code like this doesn't generate output in the sample.config file: ALL_OPTS = itertools.chain( compute_opts, resource_tracker_opts, allocation_ratio_opts ) def register_opts(conf): conf.register_opts(ALL_OPTS) def list_opts(): return {'DEFAULT': ALL_OPTS} The reason is that the generator created by "itertools.chain" doesn't get reset after getting used in "register_opts". A simple complete example: import itertools a = [1, 2] b = [3, 4] ab = itertools.chain(a, b) print("printing 'ab' for the first time") for i in ab: print(i) print("printing 'ab' for the second time") for i in ab: print(i) The combined list 'ab' won't get printed a second time. The same thing happens when the oslo.config generator wants to print the sample.config file. This means we use either: ab = list(itertools.chain(a, b)) or ab = a + b To manage notifications about this bug go to: https://bugs.launchpad.net/nova/+bug/1565824/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : yahoo-eng-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp