This repository was archived by the owner on Sep 12, 2024. It is now read-only.
This repository was archived by the owner on Sep 12, 2024. It is now read-only.
wrong path in deb packages #674
Open
Description
Hello!
When I try to compile to mof dsc resources under powershell 7 linux, I have following error:
ParserError: /home/graf0/test.ps1:1
Line |
1 | Configuration ExampleConfiguration
| ~~~~~~~~~~~~~~~~~~~~
| System.Management.Automation.PSArgumentException: No files matching '/etc/opt/omi/conf/dsc/configuration/BaseRegistration/BaseResource.schema.mof' were found. at
| Microsoft.PowerShell.DesiredStateConfiguration.CimDSCParser.GetFileContent(String fullFilePath) at
| Microsoft.PowerShell.DesiredStateConfiguration.CimDSCParser.ParseSchemaMof(String filePath) at
| Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache.ImportClasses(String path, Tuple`2 moduleInfo, Collection`1 errors, Boolean
| importInBoxResourcesImplicitly) at Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache.Initialize(Collection`1 errors, List`1 modulePathList) at
| Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache.LoadDefaultCimKeywords(Dictionary`2 functionsToDefine, Collection`1 errors, List`1 modulePathList,
| Boolean cacheResourcesFromMultipleModuleVersions) at Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache.LoadDefaultCimKeywords(Collection`1 errors)
| at System.Management.Automation.Language.Parser.ConfigurationStatementRule(IEnumerable`1 customAttributes, Token configurationToken)
Files are there - but on linux file names are case sensitive.
So we have:
/etc/opt/omi/conf/dsc/configuration/baseregistration/baseresource.schema.mof
Changing this to:
/etc/opt/omi/conf/dsc/configuration/BaseRegistration/BaseResource.schema.mof
seems to solve the problem.
Activity
Artalus commentedon Feb 5, 2021
Still happens with RPM at least in
omi-1.6.6-0.ssl_100.ulinux.x64.rpm
. Renaming files indeed helps.a30000931 commentedon May 12, 2021
this is still an issue with:
dsc-1.1.1-926.x86_64
had to run this:
mv /etc/opt/omi/conf/dsc/configuration/baseregistration /etc/opt/omi/conf/dsc/configuration/BaseRegistration
mv /etc/opt/omi/conf/dsc/configuration/BaseRegistration/baseresource.schema.mof /etc/opt/omi/conf/dsc/configuration/BaseRegistration/BaseResource.schema.mof
how hard is it to get case right?
sql-sith commentedon May 23, 2021
Glad to find this - I was really wondering what I was doing wrong and didn't notice the casing at all.
Another workaround is to add lower-case symbolic links that point to the mixed-case names. This seems safer to me than renaming files supplied by the vendor. As far as I can tell, you only need to link one directory and one file:
Not a big difference, but this does work for me, plus, as I already mentioned, I don't have to actually change the MS files. With my luck, I bet MS will fix this in the next release and then I'll be wondering why I can't get through the install package.
gaelcolas commentedon Jun 21, 2021
Maybe something for @anmenaga to comment on, but in PSDSCv3 the BaseResource have changed to be within the PSDSC module.
I also suspect that this was fixed in PSDSCv2.0.5, but I don't know what this OMI package is shipping.
anmenaga commentedon Jun 24, 2021
This is a de-sync between v2 DSC code in SMA dll/PowerShell and whatever is deploying lower-cased files to
/etc/opt/omi/conf/dsc/configuration
- casing is hardcoded in v2 DSC code and will break when run on lower-cased files.v2.0.5
PSDesiredStateConfiguration
module on PS Gallery ships with baseregistrations in expected case, so theoretically another workaround that should work with v2.0.5 is to setupDSC_HOME
env variable before starting configuration compilation. Something like this (assuming v2.0.5PSDesiredStateConfiguration
module is visible through$env:PSModulePath
)piotrminkina commentedon Nov 12, 2023
To work with PowerShell + DSC scripts on Ubuntu Linux, I had to do such patches, after installing OMI.
Scripts from DSC validates nicely in VSCode :)