-
Notifications
You must be signed in to change notification settings - Fork 55
Enhance copy loop functionality by allowing reference() usage in copy mode
#1287
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
base: main
Are you sure you want to change the base?
Enhance copy loop functionality by allowing reference() usage in copy mode
#1287
Conversation
5d7597c to
5566b37
Compare
|
@Gijsreyn can you fix the merge conflicts? |
|
@SteveL-MSFT - I'll pick it up when I'm back. |
…ithub.com/Gijsreyn/operation-methods into PowerShellgh-1286/main/fix-reference-copy
…into PowerShellgh-1286/main/fix-reference-copy
|
@SteveL-MSFT - I tried resolving the merge conflicts, but it looks like after the SSH merge, it started failing: https://github.com/PowerShell/DSC/actions/runs/20111826751 |
|
@Gijsreyn I understand the problem and working on a fix |
|
@Gijsreyn build issue resolved, but you still have some test failures |
|
@SteveL-MSFT - oops, I think I removed too much when fixing the merge conflict. Should be good to go! |
|
|
||
| // Find the dependency in config.resources - it might be a copy loop template | ||
| // We need to find by type since the name is the template expression | ||
| if let Some(dependency_resource) = config.resources.iter().find(|r| r.resource_type == resource_type) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to handle the ase where the dependency doesn't exist?
| new_resource.properties = invoke_property_expressions(parser, context, Some(properties))?; | ||
| } | ||
| // Store copy loop context in resource tags for later use by reference() | ||
| let mut tags = new_resource.tags.clone().unwrap_or_default(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you need to keep some context information I would prefer to put it under metadata/Microsoft.DSC
PR Summary
Fixed copy loops to work with
reference()function by preserving copy context during property evaluation. ModifiedcopyIndex()andreference()to accept copy context outside Copy mode, and stored loop indices in resource tags during unrolling then restored them before evaluating properties. Tests addedPR Context
Fix #1286