common: recursive implementation of config::expand_meta … #1046

Merged
merged 4 commits into from Jan 7, 2014

Projects

None yet

2 participants

@dachary
Member
dachary commented Jan 5, 2014

Using a recursive implementation of variable expansions make it easier
to protect against loops and provide human readable messages when they
happen.

It also enables one variable to be substituted multiple times in the
same configuration option instead of just once because it is confused
with a variable expansion loop.

dachary added some commits Jan 4, 2014
@dachary dachary common: multiple variable occurence expansion test
http://tracker.ceph.com/issues/7103 refs #7103

Signed-off-by: Loic Dachary <loic@dachary.org>
5bb1545
@dachary dachary common: cosmetic inversion of tests arguments
Signed-off-by: Loic Dachary <loic@dachary.org>
87db534
@dachary dachary common: recursive implementation of config::expand_meta
Using a recursive implementation of variable expansions make it easier
to protect against loops and provide human readable messages when they
happen.

It also enables one variable to be substituted multiple times in the
same configuration option instead of just once because it is confused
with a variable expansion loop.

http://tracker.ceph.com/issues/7103 fixes: #7103

Signed-off-by: Loic Dachary <loic@dachary.org>
9485409
@dachary dachary common: unit tests for config::expand_meta
Part of the config.cc tests are in test/confutils.cc but they do not
cover meta variable expansion. Create unittest_config for config.{h,cc}
specific tests.

The test_md_config_t is made a friend of md_config_t to allow testing
private and protected methods.

test/cli/ceph-conf/show-config-value.t is used to check that the human
readable message message shows as expected when there is an expansion
loop.

Signed-off-by: Loic Dachary <loic@dachary.org>
3f34dc7
@liewegas liewegas merged commit ffc9d72 into ceph:master Jan 7, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment