Merge pull request #363 from ceph/wip-10089

drop default os_type of 'ubuntu' in teuthology-suite
This commit is contained in:
Zack Cerza 2014-11-19 10:53:57 -07:00
commit 28c90f147b
3 changed files with 21 additions and 3 deletions

View File

@ -41,7 +41,6 @@ Standard arguments:
Machine type [default: {default_machine_type}]
-d <distro>, --distro <distro>
Distribution to run against
[default: ubuntu]
--suite-branch <suite_branch>
Use this suite branch instead of the ceph branch
--suite-dir <suite_dir> Use this alternative directory as-is when

View File

@ -626,7 +626,9 @@ class Placeholder(object):
def substitute_placeholders(input_dict, values_dict):
"""
Replace any Placeholder instances with values named in values_dict.
Replace any Placeholder instances with values named in values_dict. In the
case of None values, the key is omitted from the result.
Searches through nested dicts.
:param input_dict: A dict which may contain one or more Placeholder
@ -639,10 +641,13 @@ def substitute_placeholders(input_dict, values_dict):
input_dict = copy.deepcopy(input_dict)
def _substitute(input_dict, values_dict):
for (key, value) in input_dict.iteritems():
for key, value in input_dict.items():
if isinstance(value, dict):
_substitute(value, values_dict)
elif isinstance(value, Placeholder):
if values_dict[value.name] is None:
del input_dict[key]
continue
# If there is a Placeholder without a corresponding entry in
# values_dict, we will hit a KeyError - we want this.
input_dict[key] = values_dict[value.name]

View File

@ -52,3 +52,17 @@ class TestSuiteOffline(object):
assert isinstance(
suite.dict_templ['overrides']['admin_socket']['branch'],
suite.Placeholder)
def test_null_placeholders_dropped(self):
input_dict = dict(
suite='suite',
suite_branch='suite_branch',
ceph_branch='ceph_branch',
ceph_hash='ceph_hash',
teuthology_branch='teuthology_branch',
machine_type='machine_type',
distro=None,
)
output_dict = suite.substitute_placeholders(suite.dict_templ,
input_dict)
assert 'os_type' not in output_dict