mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2026-02-03 04:09:29 -05:00
Merge pull request #631 from Al2Klimov/central-C
Get-IcingaCheckCommandConfig: move -C from every single command to template
This commit is contained in:
commit
c7eeab8dea
2 changed files with 12 additions and 7 deletions
|
|
@ -20,6 +20,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
|
|||
|
||||
### Enhancements
|
||||
|
||||
* [#631](https://github.com/Icinga/icinga-powershell-framework/pull/631) Deduplicates `-C try { Use-Icinga ...` boilerplate by adding it to the `PowerShell Base` template and removing it from every single command
|
||||
* [#679](https://github.com/Icinga/icinga-powershell-framework/pull/679) Adds a new data provider for fetching process information of Windows systems, while sorting all objects based on a process name and their process id
|
||||
* [#688](https://github.com/Icinga/icinga-powershell-framework/pull/688) Adds new handling to add scheduled tasks in Windows for interacting with Icinga for Windows core functionality as well as an auto renewal task for the Icinga for Windows certificate generation
|
||||
|
||||
|
|
|
|||
|
|
@ -69,6 +69,8 @@
|
|||
.NOTES
|
||||
#>
|
||||
|
||||
[string]$PsBaseCArg = [string]::Format('try {{ Use-Icinga -Minimal; }} catch {{ Write-Output {0}The Icinga PowerShell Framework is either not installed on the system or not configured properly. Please check https://icinga.com/docs/windows for further details{0}; Write-Output {0}Error:{0} $$($$_.Exception.Message)Components:`r`n$$( Get-Module -ListAvailable {0}icinga-powershell-*{0} )`r`n{0}Module-Path:{0}`r`n$$($$Env:PSModulePath); exit 3; }}; Exit-IcingaExecutePlugin -Command {0}$ifw_api_command${0} ', "'");
|
||||
|
||||
function Get-IcingaCheckCommandConfig()
|
||||
{
|
||||
param(
|
||||
|
|
@ -114,6 +116,10 @@ function Get-IcingaCheckCommandConfig()
|
|||
'order' = '-1';
|
||||
'value' = '$IcingaPowerShellBase_String_ExecutionPolicy$';
|
||||
};
|
||||
'-C' = @{
|
||||
'order' = '0';
|
||||
'value' = $PsBaseCArg;
|
||||
};
|
||||
};
|
||||
'command' = 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe';
|
||||
'disabled' = $FALSE;
|
||||
|
|
@ -201,13 +207,7 @@ function Get-IcingaCheckCommandConfig()
|
|||
# Add command Structure
|
||||
$Basket.Command.Add(
|
||||
$check, @{
|
||||
'arguments' = @{
|
||||
# Set the Command handling for every check command
|
||||
'-C' = @{
|
||||
'value' = [string]::Format('try {{ Use-Icinga -Minimal; }} catch {{ Write-Output {1}The Icinga PowerShell Framework is either not installed on the system or not configured properly. Please check https://icinga.com/docs/windows for further details{1}; Write-Output {1}Error:{1} $$($$_.Exception.Message)Components:`r`n$$( Get-Module -ListAvailable {1}icinga-powershell-*{1} )`r`n{1}Module-Path:{1}`r`n$$($$Env:PSModulePath); exit 3; }}; Exit-IcingaExecutePlugin -Command {1}{0}{1} ', $check, "'");
|
||||
'order' = '0';
|
||||
};
|
||||
}
|
||||
'arguments' = @{ }
|
||||
'fields' = @();
|
||||
'imports' = @( 'PowerShell Base' );
|
||||
'object_name' = $check;
|
||||
|
|
@ -694,6 +694,10 @@ function Write-IcingaPlainConfigurationFiles()
|
|||
$PowerShellBase += [string]::Format(' ]{0}', (New-IcingaNewLine));
|
||||
$PowerShellBase += [string]::Format(' timeout = 3m{0}', (New-IcingaNewLine));
|
||||
$PowerShellBase += [string]::Format(' arguments += {{{0}', (New-IcingaNewLine));
|
||||
$PowerShellBase += [string]::Format(' "-C" = {{{0}', (New-IcingaNewLine));
|
||||
$PowerShellBase += [string]::Format(' order = 0{0}', (New-IcingaNewLine));
|
||||
$PowerShellBase += [string]::Format(' value = "{0}"{1}', $PsBaseCArg, (New-IcingaNewLine));
|
||||
$PowerShellBase += [string]::Format(' }}{0}', (New-IcingaNewLine));
|
||||
$PowerShellBase += [string]::Format(' "-ExecutionPolicy" = {{{0}', (New-IcingaNewLine));
|
||||
$PowerShellBase += [string]::Format(' order = -1{0}', (New-IcingaNewLine));
|
||||
$PowerShellBase += [string]::Format(' value = "$IcingaPowerShellBase_String_ExecutionPolicy$"{0}', (New-IcingaNewLine));
|
||||
|
|
|
|||
Loading…
Reference in a new issue