Skip to content

Director basket: consider centralising -C via command name CV #627

@Al2Klimov

Description

@Al2Klimov

Current Behavior

At the moment the basket defines -C (in contrast to -ExecutionPolicy, -NoLogo and -NoProfile) on every single check command, like this:

try { Use-Icinga -Minimal; } catch { Write-Output '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'; Write-Output 'Error:' $$($$_.Exception.Message)Components:rn$$( Get-Module -ListAvailable 'icinga-powershell-*' )rn'Module-Path:'rn$$($$Env:PSModulePath); exit 3; }; Exit-IcingaExecutePlugin -Command 'Invoke-IcingaCheckUsers'

However, those strings differ only minimal:

Bildschirm­foto 2023-06-01 um 11 00 23

Possible Solution

I suggest to make their only difference -the command name- a custom var set on every command and to centralise -C (next to -ExecutionPolicy etc.?), using the custom var. I.e.:

try { Use-Icinga -Minimal; } catch { Write-Output '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'; Write-Output 'Error:' $$($$_.Exception.Message)Components:rn$$( Get-Module -ListAvailable 'icinga-powershell-*' )rn'Module-Path:'rn$$($$Env:PSModulePath); exit 3; }; Exit-IcingaExecutePlugin -Command '$YourPreferedNameForCommandName$'

Context

Icinga/icinga2#9062 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions