Merge pull request #156 from Icinga:fix/Feature-Allow-sharing-of-local-variables-with-Icinga-Shell

Feature: Allow sharing of local variables with Icinga Shell
This commit is contained in:
Lord Hepipud 2020-11-19 13:47:18 +01:00 committed by GitHub
commit 09177a0851
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

View file

@ -13,6 +13,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
### Enhancements
* [#121](https://github.com/Icinga/icinga-powershell-framework/issues/121) Adds feature allowing sharing of local variables with Icinga Shell, by using `-ArgumentList`. They can then be accessed by using `$IcingaShellArgs` with the correct array index id, following the order of items added to `-ArgumentList`
* [#136](https://github.com/Icinga/icinga-powershell-framework/pull/136) Adds support to ignore empty check packages and return `Ok` instead of `Unknown` if `-IgnoreEmptyPackage` is set on `New-IcingaCheckPackage`
* [#137](https://github.com/Icinga/icinga-powershell-framework/issues/137) Adds Cmdlet to compare a DateTime object with the current DateTime and return the offset as Integer in seconds
* [#139](https://github.com/Icinga/icinga-powershell-framework/pull/139) Add Cmdlet `Start-IcingaShellAsUser` to open an Icinga Shell as different user for testing

View file

@ -314,7 +314,8 @@ function Invoke-IcingaCommand()
[CmdletBinding()]
param (
$ScriptBlock,
[switch]$SkipHeader = $FALSE
[switch]$SkipHeader = $FALSE,
[array]$ArgumentList = @()
);
Import-LocalizedData `
@ -336,9 +337,10 @@ function Invoke-IcingaCommand()
}
powershell.exe -NoExit -Command {
$Script = $args[0];
$RootPath = $args[1];
$Version = $args[2];
$Script = $args[0];
$RootPath = $args[1];
$Version = $args[2];
$IcingaShellArgs = $args[3];
# Load our Icinga Framework
Use-Icinga;
@ -361,7 +363,7 @@ function Invoke-IcingaCommand()
return "> "
}
} -Args $ScriptBlock, $PSScriptRoot, $IcingaFrameworkData.PrivateData.Version;
} -Args $ScriptBlock, $PSScriptRoot, $IcingaFrameworkData.PrivateData.Version, $ArgumentList;
}
function Start-IcingaShellAsUser()