Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameter expansion does not work across merged lists #13

Closed
madduck opened this issue Dec 1, 2013 · 0 comments
Closed

Parameter expansion does not work across merged lists #13

madduck opened this issue Dec 1, 2013 · 0 comments

Comments

@madduck
Copy link
Owner

madduck commented Dec 1, 2013

Comment to self: if two lists are merged (extended), and those lists use RefValues, then expansion (interpolation) won't work. The reason is that the DictPath includes the list indices, e.g. apt_repos:0:uri and those indices start at 0 for every list. Now, when two lists are merged, the reference to the base RefValue (in Parameters._occurrences) is overwritten by the RefValue of the mergee, causing it to not get expanded later.

DictPath is a gross hack, and I wish I didn't need it. One way around it would be to teach the output drivers to translate RefValue instances into their values once resolved. If that were the case, then we'd only need a list of RefValues, not a mapping between RefValues and their path, which is used to replace the with the value once interpolated.

Another solution might be to let list extension augment the indices in the DictPaths.

madduck added a commit that referenced this issue Dec 2, 2013
This was easier than thought. The problem:

   If two lists are merged (extended), and those lists use RefValues,
   then expansion (interpolation) won't work. The reason is that the
   DictPath includes the list indices, e.g. apt_repos:0:uri and those
   indices start at 0 for every list. Now, when two lists are merged,
   the reference to the base RefValue (in Parameters._occurrences) is
   overwritten by the RefValue of the mergee, causing it to not get
   expanded later.

Instead of just updating self._occurrences, we can populate it as we
update scalars, and on extending lists, we can add an offset to the
index in the path of the mergee.

Still: DictPath should go. One day…

Closes: #13
Signed-off-by: martin f. krafft <madduck@madduck.net>
@madduck madduck closed this as completed Dec 2, 2013
madduck added a commit that referenced this issue Dec 2, 2013
This was easier than thought. The problem:

   If two lists are merged (extended), and those lists use RefValues,
   then expansion (interpolation) won't work. The reason is that the
   DictPath includes the list indices, e.g. apt_repos:0:uri and those
   indices start at 0 for every list. Now, when two lists are merged,
   the reference to the base RefValue (in Parameters._occurrences) is
   overwritten by the RefValue of the mergee, causing it to not get
   expanded later.

Instead of just updating self._occurrences, we can populate it as we
update scalars, and on extending lists, we can add an offset to the
index in the path of the mergee.

Still: DictPath should go. One day…

Closes: #13
Signed-off-by: martin f. krafft <madduck@madduck.net>
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant