Comments (9)
[edited]
So to the comment/question: "hash table can only be added to another hash table"
Yes, that's by design, otherwise you can't really predict how it should behave...
If it's different type (broad types, i.e. Key/Name collections/Scalar/arrays of scalar), the reference object should be used...
I will now have a look at the branch you mention (just wanted to edit my comment)
from datum.
Yep, that's a bug.
from datum.
Oh, and surprise, it seems to be an issue with the cache... That's why it was so hard to consistently reproduce!
If you look closely, the RSOP are generated fine, but the compilation fails...
If you load a fresh datum structure and tries the lookup -PropertyPath 'FilesAndFolders' -Node $Node -DatumTree $Datum
it works fine...
Then try to build.ps1 (leave it to fail) and then try again that line above... it fails.
Reset the cache of the Datum module:
$m = get-module datum
&$m { $script:FileProviderDataCache = $null }
lookup -PropertyPath 'FilesAndFolders' -Node $Node -DatumTree $Datum
Now it works again...
Definitely a bug, look for the root cause, probably in the cache. Will let you know when I get an idea how to fix this...
from datum.
More specifically, it's the cache for the FileServer Role.
When it works it looks like this:
PS C:\src\DscWorkshop\DscSample> &$m { $script:FileProviderDataCache['C:\src\DscWorkshop\DscSample\DSC_ConfigData\Roles\FileServer.yml'].value.FilesAndFolders.items.ToString() }
System.Object[]
When it fails:
PS C:\src\DscWorkshop\DscSample> &$m { $script:FileProviderDataCache['C:\src\DscWorkshop\DscSample\DSC_ConfigData\Roles\FileServer.yml'].value.FilesAndFolders.items.ToString() }System.Collections.Generic.List`1[System.Object]
I wonder when this is getting "corrupted"...
Most likely, there's a Write-Output somewhere (might be implicit), that is not using -NoEnumerate
.
from datum.
I've got a quick fix for that issue (I think).
Hit me up on Skype when you're available.
from datum.
Have a look there:
https://ci.appveyor.com/project/gaelcolas/datum/builds/21791313/artifacts
Unzip in your BuildOutput\modules of your project and rebuild without a resolve-dependency.
That should fix it.
from datum.
Thanks @gaelcolas, I came up with a similar thing but did not really understand why ForEach-Object refreshed the $_ variable while .ForEach did not. do you know what happens inside of PowerShell here?
from datum.
Not really...
Even when the array was empty it was calling the Foreach method, but because there was no item, $_ did get updated with the current collection's item (should have been $null
), so it used a parent loop's $_
, being a scalar... That you can't merge with a hashtable...
Very weird, but I've seen that before. Just never bothered going down that rabbit hole... a bit of a shame as sending stuff through the pipeline has a cost and the Foreach method is meant to be faster, but those are rarely big merges so the impact should be minimal, even for big configs.
Those part are due for a re-write anyway, just not my priority for now as we discussed previously.
from datum.
If you have concerns about performance, let's use the foreach keyword instead of Foreach-Object cmdlet. This should not be much slower than .foreach.
from datum.
Related Issues (20)
- RSOP not including LcmConfig (because it's static) HOT 2
- Confusing dates in readme HOT 1
- Merging error with objects containing only one element HOT 1
- Getting a lot of warnings in Resolve-NodeProperty when Lookup is used in Composite resource HOT 3
- Datum throws warning when you use hash_array and edit data on three levels HOT 1
- Error using Datum Handler / Datum handlers cannot work with arrays
- Code Quality and Formatting
- Using an environment variable in the Datum.yml throws an error
- RSOP does not contain consolidated LcmConfig data
- Merge not working HOT 5
- Merge-DatumArray doesn't always return an array HOT 1
- Knockouts don't work for: Basetype Arrays
- Knockouts don't work for: Hashtables
- Knockouts don't work for: Hashtable Arrays
- Resolve-NodeProperty does not support $false in DefaultValue parameter HOT 1
- New-DatumStructure JSON DefinitionFile broken
- Deep structures cause warning when using Lookup or Get-DatumRsop
- Datum.yml - Specify a directory to load all files HOT 4
- ConvertTo-Datum always returns `$null` when DatumHandler returns `$false`
- Inquiry about the video mentioned in the readme section
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from datum.