Applying code changes

Even with yesterday’s release we’re faced with errors in the Hyper-V plugin (possibly related to using storage spaces described here Powershell Errors on Hyper-V Hosts running Windows Storage Spaces · Issue #75 · Icinga/icinga-powershell-hyperv · GitHub)

It’s pretty easy to catch the error and debug further when editing the compiled module as the error refers to the line numbers there.

In order to contribute and prepare a PR, I am wondering how can I recreate the compiled version? I looked at the developer guide, would I have to use Publish-IcingaForWindowsComponent?

Hi @adn77,
I am not sure whether I do understand your question. There is no “real” compiled version, since Powershell is a interpreted language runtime.
However you might be thinking to the “CodeCache” (all code files concatenated together to make loading faster, afaik), which you can regenerate with Write-IcingaFrameworkCodeCache.

Hi @lorenz,
thanks for your response, it helped me to get on the right track :slightly_smiling_face:
Write-IcingaFrameworkCodeCache works for the framework, I had been looking at “compiling” plugin code and found the answer in Write-IcingaForWindowsComponentCompilationFile. Turns out the shipped code contains a placeholder file in the .\compiled directory of the plugin module. This gets overwritten by a concatenated version of all psm1 files of the modul on first run.

In case somebody needs to do this, place your shell in the .\compiled directory (!) of the module and run:

Write-IcingaForWindowsComponentCompilationFile -CompiledFilePath .\compiled\icinga-powershell-hyperv.ifw_compilation.psm1

The name of the psm1 file has to match the already existing cache file.