Closed dennisl68-castra closed 3 years ago
Have you tried this change? Can the schema still be String
for the property?
Yes, you can keep it is as string and just check if it also is a legitimate ip address using the try-catch suggestion. Mind though, legitimate IP-adresses can also be entered as integers and partial addresses according to [System.Net.IpAddress].
So maybe it's not that a useful addition?
In that case there is always regx...
Since the schema mof is string there will not be possible to assert that it is a correct IP address on compiling the MOF. I don't think it is possible to have another type that can check this in the schema mof during compile time. 🤔
If it just a matter of asserting that the IP address is valid during runtime then we can use https://github.com/dsccommunity/DscResource.Common#assert-ipaddress
Ah, I see.
Details of the scenario you tried and the problem that is occurring
When entering a non IP address in
FailoverClusterIPAddress
as 'a.b.c.d' orFailoverClusterIgnoreNetwork
as 'a.b.c.d/y', no check is done before generating the MOF if it's of type [ipaddress]This will make DSC Set fail.
Verbose logs showing the problem
PowerShell DSC resource MSFT_xCluster failed to execute Set-TargetResource functionality with error message: The specified IP address 'x.x.x.x/y' is invalid.
Suggested solution to the issue
Force ip-strings to be typed as [ipaddress]
Line 137-139
or Line 199-204...
The DSC configuration that is used to reproduce the issue (as detailed as possible)
The operating system the target node is running
Version and build of PowerShell the target node is running
Version of the DSC module that was used