A fix for Lability ‘Datafile not found’ error
Issue
I have been busy automating the provision of our private Azure DevOps Agents using Packer and Lability; a more details blog post is on the way. All has been going OK on my test rig, but when came to run the automation pipeline on our main build HyperV host I got an error
> Get-VmcConfigurationData : Datafile EnvironmentsBuildAgent-VS2017BuildAgent-VS2017.psd1 NOT FOUND. Exiting
But the file was there!
I check the default Lability paths, but all these looked OK, and none pointed to my environment location on C: anyway
> Get-LabHostDefault
ConfigurationPath : D:VirtualisationConfiguration
DifferencingBVhdPath : D:VirtualisationVMVirtualHardDisks
HotfixPath : D:VirtualisationHotfix
IsoPath : D:VirtualisationISOs
ModuleCachePath : D:VirtualisationModules
ParentVhdPath : D:VirtualisationMasterVirtualHardDisks
RepositoryUri : https://server/nuget/PowerShell/package
ResourcePath : D:VirtualisationResources
ResourceShareName : Resources
DisableLocalFileCaching : False
DisableSwitchEnvironmentName : True
EnableCallStackLogging : False
DismPath : C:WindowsSystem32WindowsPowerShellv1.0ModulesDismMicrosoft.Dism.PowerShell.dll
Solution
After a bit of digging in the lability PSM files I found the problem was the call
> Get-PSFConfigValue -Fullname "VMConfig.VMConfigsPath"
This returned nothing. A check on my development system showed this should return C:VmConfigs, so I had a broken Lability install
So I tried the obvious fix, which was to set the missing value
> Set-PSFConfig -FullName "VMConfig.VMConfigsPath" -Value c:VmConfigs
And it worked, my Lability installs ran without a problem