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

Resolve-NodeProperty does not support $false in DefaultValue parameter #130

Open
bdrans opened this issue Nov 10, 2022 · 1 comment
Open

Comments

@bdrans
Copy link

bdrans commented Nov 10, 2022

When specifying $false as the DefaultValue for Resolve-NodeProperty it is treated as if no DefaultValue was passed in. If the specified PropertyPath does not exist instead of $false being returned instead we throw the following error:
"The lookup of path '$PropertyPath' for node '$($node.Name)' returned a Null value, but Null is not specified as Default. This is not allowed."

@cibboy
Copy link

cibboy commented Feb 7, 2024

The same thing happens when passing in an empty list (@()) as DefaultValue. The issue seems to be on line 59 of file Resolve-NodeProperty.ps1, because it checks the presence of DefaultValue with a simple if (truthy values) instead of checking the presence of the key in the $PSBoundParameters dictionary. I think line 59 should be elseif ($PSBoundParameters.ContainsKey('DefaultValue')), but it depends on the original thought process for the implementation. @gaelcolas, @raandree any thoughts?

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

2 participants