slapos/recipe/slapconfiguration: Move post-expand-parameter-dict actions to __init__
The reason is: in the next patch we'll want to adjust fetched parameter_dict with SR defaults, but since currently _expandParameterDict(), besides expanding itself, also stores result to options - we cannot do that after - options is not a plain dict - it is buildout own dictionary-like class https://lab.nexedi.com/nexedi/slapos.buildout/blob/d5deb01f/src/zc/buildout/buildout.py#L1377 which on __setitem__ not stores a reference to value, but somehow copies value inside https://lab.nexedi.com/nexedi/slapos.buildout/blob/d5deb01f/src/zc/buildout/buildout.py#L1540 so e.g. after the following: parameter_dict = {'aaa': 'bbb'} options['configuration'] = parameter_dict parameter_dict['ccc'] = 'ddd' parameter_dict is {'aaa': 'bbb', 'ccc': 'ddd'} and options['configuration'] is {'aaa': 'bbb' } # no 'ccc' key ~~~~ So let's rework the code so that _expandParameterDict() only expands the dict and we do (future) postprocessing and options['configuration'] setting in the main driver code. P.S. isn't it even more logical now? /cc @vpelletier, @alain.takoudjou
Showing
Please register or sign in to comment