Skip to content

Commit 46a046a

Browse files
authored
Merge pull request #168 from Icinga:feature/support_new_director_selfservice_arguments
Feature: Adds support for new Director SelfService config arguments Adds support for new Icinga Director SelfService config arguments which will now ensure the wizard will run without asking questions by using the Icinga Director configuration (requires Icinga Director 1.8 or later)
2 parents 7a509cc + 0257ace commit 46a046a

File tree

3 files changed

+108
-81
lines changed

3 files changed

+108
-81
lines changed

doc/31-Changelog.md

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
2727
* [#162](https://github.com/Icinga/icinga-powershell-framework/pull/162) Adds feature to test the length of plugin custom variables during config generation and throws error in case the total length is bigger than 64 digits, as imports into the Icinga Director by using baskets is not possible otherwise
2828
* [#163](https://github.com/Icinga/icinga-powershell-framework/pull/163) Adds native support for writing Icinga 2 configuration for plugins and allows to easy publish new configurations for modules with the new Cmdlet `Publish-IcingaPluginConfiguration`
2929
* [#164](https://github.com/Icinga/icinga-powershell-framework/pull/164) Adds `exit` after calling `icinga` on Windows Terminal integration to ensure the shell will close in case the Icinga shell is closed
30+
* [#168](https://github.com/Icinga/icinga-powershell-framework/pull/168) Adds support for new Icinga Director SelfService config arguments which will now ensure the wizard will run without asking questions by using the Icinga Director configuration (requires Icinga Director 1.8 or later)
3031

3132
### Bugfixes
3233

lib/core/icingaagent/misc/Convert-IcingaDirectorSelfServiceArguments.psm1

+22-16
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,28 @@ function Convert-IcingaDirectorSelfServiceArguments()
99
}
1010

1111
[hashtable]$DirectorArguments = @{
12-
PackageSource = $JsonInput.download_url;
13-
AgentVersion = $JsonInput.agent_version;
14-
CAPort = $JsonInput.agent_listen_port;
15-
AllowVersionChanges = $JsonInput.allow_updates;
16-
GlobalZones = $JsonInput.global_zones;
17-
ParentZone = $JsonInput.parent_zone;
18-
#CAEndpoint = $JsonInput.ca_server;
19-
Endpoints = $JsonInput.parent_endpoints;
20-
AddFirewallRule = $JsonInput.agent_add_firewall_rule;
21-
AcceptConnections = $JsonInput.agent_add_firewall_rule;
22-
ServiceUser = $JsonInput.icinga_service_user;
23-
IcingaMaster = $JsonInput.IcingaMaster;
24-
UpdateAgent = $TRUE;
25-
AddDirectorGlobal = $FALSE;
26-
AddGlobalTemplates = $FALSE;
27-
RunInstaller = $TRUE;
12+
PackageSource = $JsonInput.download_url;
13+
AgentVersion = $JsonInput.agent_version;
14+
CAPort = $JsonInput.agent_listen_port;
15+
AllowVersionChanges = $JsonInput.allow_updates;
16+
GlobalZones = $JsonInput.global_zones;
17+
ParentZone = $JsonInput.parent_zone;
18+
#CAEndpoint = $JsonInput.ca_server;
19+
Endpoints = $JsonInput.parent_endpoints;
20+
AddFirewallRule = $JsonInput.agent_add_firewall_rule;
21+
AcceptConnections = $JsonInput.agent_add_firewall_rule;
22+
ServiceUser = $JsonInput.icinga_service_user;
23+
IcingaMaster = $JsonInput.IcingaMaster;
24+
InstallFrameworkService = $JsonInput.install_framework_service;
25+
ServiceDirectory = $JsonInput.framework_service_directory;
26+
FrameworkServiceUrl = $JsonInput.framework_service_url;
27+
InstallFrameworkPlugins = $JsonInput.install_framework_plugins;
28+
PluginsUrl = $JsonInput.framework_plugins_url;
29+
ConvertEndpointIPConfig = $JsonInput.resolve_parent_host;
30+
UpdateAgent = $TRUE;
31+
AddDirectorGlobal = $FALSE;
32+
AddGlobalTemplates = $FALSE;
33+
RunInstaller = $TRUE;
2834
};
2935

3036
# Use NetworkService as default if nothing was transmitted by Director

lib/core/icingaagent/misc/Start-IcingaAgentInstallWizard.psm1

+85-65
Original file line numberDiff line numberDiff line change
@@ -68,75 +68,95 @@ function Start-IcingaAgentInstallWizard()
6868
$DirectorUrl = $Result.Value;
6969
$InstallerArguments = $Result.Args;
7070
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'SelfServiceAPIKey' -Value $SelfServiceAPIKey -InstallerArguments $InstallerArguments -Default $null;
71+
7172
if ([string]::IsNullOrEmpty($Result.Value) -eq $FALSE) {
7273
$SelfServiceAPIKey = $Result.Value;
7374
$InstallerArguments = $Result.Args;
7475
}
75-
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'Ticket' -Value $Ticket -InstallerArguments $InstallerArguments;
76-
$Ticket = $Result.Value;
77-
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'PackageSource' -Value $PackageSource -InstallerArguments $InstallerArguments;
78-
$PackageSource = $Result.Value;
79-
$InstallerArguments = $Result.Args;
80-
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'AgentVersion' -Value $AgentVersion -InstallerArguments $InstallerArguments;
81-
$AgentVersion = $Result.Value;
82-
$InstallerArguments = $Result.Args;
83-
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'InstallDir' -Value $InstallDir -InstallerArguments $InstallerArguments;
84-
$InstallDir = $Result.Value;
85-
$InstallerArguments = $Result.Args;
86-
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'CAPort' -Value $CAPort -InstallerArguments $InstallerArguments;
87-
$CAPort = $Result.Value;
88-
$InstallerArguments = $Result.Args;
89-
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'AllowVersionChanges' -Value $AllowVersionChanges -InstallerArguments $InstallerArguments;
90-
$AllowVersionChanges = $Result.Value;
91-
$InstallerArguments = $Result.Args;
92-
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'GlobalZones' -Value $GlobalZones -InstallerArguments $InstallerArguments;
93-
$GlobalZones = $Result.Value;
94-
$InstallerArguments = $Result.Args;
95-
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'ParentZone' -Value $ParentZone -InstallerArguments $InstallerArguments;
96-
$ParentZone = $Result.Value;
97-
$InstallerArguments = $Result.Args;
98-
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'CAEndpoint' -Value $CAEndpoint -InstallerArguments $InstallerArguments;
99-
$CAEndpoint = $Result.Value;
100-
$InstallerArguments = $Result.Args;
101-
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'Endpoints' -Value $Endpoints -InstallerArguments $InstallerArguments;
102-
$Endpoints = $Result.Value;
103-
$InstallerArguments = $Result.Args;
104-
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'AddFirewallRule' -Value $AddFirewallRule -InstallerArguments $InstallerArguments;
105-
$AddFirewallRule = $Result.Value;
106-
$InstallerArguments = $Result.Args;
107-
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'AcceptConnections' -Value $AcceptConnections -InstallerArguments $InstallerArguments;
108-
$AcceptConnections = $Result.Value;
109-
$InstallerArguments = $Result.Args;
110-
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'ServiceUser' -Value $ServiceUser -InstallerArguments $InstallerArguments;
111-
$ServiceUser = $Result.Value;
112-
$InstallerArguments = $Result.Args;
113-
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'UpdateAgent' -Value $UpdateAgent -InstallerArguments $InstallerArguments;
114-
$UpdateAgent = $Result.Value;
115-
$InstallerArguments = $Result.Args;
116-
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'AddDirectorGlobal' -Value $AddDirectorGlobal -InstallerArguments $InstallerArguments;
117-
$AddDirectorGlobal = $Result.Value;
118-
$InstallerArguments = $Result.Args;
119-
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'AddGlobalTemplates' -Value $AddGlobalTemplates -InstallerArguments $InstallerArguments;
120-
$AddGlobalTemplates = $Result.Value;
121-
$InstallerArguments = $Result.Args;
122-
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'LowerCase' -Value $LowerCase -Default $FALSE -InstallerArguments $InstallerArguments;
123-
$LowerCase = $Result.Value;
124-
$InstallerArguments = $Result.Args;
125-
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'UpperCase' -Value $UpperCase -Default $FALSE -InstallerArguments $InstallerArguments;
126-
$UpperCase = $Result.Value;
127-
$InstallerArguments = $Result.Args;
128-
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'AutoUseFQDN' -Value $AutoUseFQDN -Default $FALSE -InstallerArguments $InstallerArguments;
129-
$AutoUseFQDN = $Result.Value;
130-
$InstallerArguments = $Result.Args;
131-
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'AutoUseHostname' -Value $AutoUseHostname -Default $FALSE -InstallerArguments $InstallerArguments;
132-
$AutoUseHostname = $Result.Value;
133-
$InstallerArguments = $Result.Args;
134-
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'EndpointConnections' -Value $EndpointConnections -InstallerArguments $InstallerArguments;
135-
$EndpointConnections = $Result.Value;
136-
$InstallerArguments = $Result.Args;
137-
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'OverrideDirectorVars' -Value $OverrideDirectorVars -InstallerArguments $InstallerArguments;
138-
$OverrideDirectorVars = $Result.Value;
139-
$InstallerArguments = $Result.Args;
76+
77+
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'Ticket' -Value $Ticket -InstallerArguments $InstallerArguments;
78+
$Ticket = $Result.Value;
79+
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'PackageSource' -Value $PackageSource -InstallerArguments $InstallerArguments;
80+
$PackageSource = $Result.Value;
81+
$InstallerArguments = $Result.Args;
82+
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'AgentVersion' -Value $AgentVersion -InstallerArguments $InstallerArguments;
83+
$AgentVersion = $Result.Value;
84+
$InstallerArguments = $Result.Args;
85+
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'InstallDir' -Value $InstallDir -InstallerArguments $InstallerArguments;
86+
$InstallDir = $Result.Value;
87+
$InstallerArguments = $Result.Args;
88+
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'CAPort' -Value $CAPort -InstallerArguments $InstallerArguments;
89+
$CAPort = $Result.Value;
90+
$InstallerArguments = $Result.Args;
91+
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'AllowVersionChanges' -Value $AllowVersionChanges -InstallerArguments $InstallerArguments;
92+
$AllowVersionChanges = $Result.Value;
93+
$InstallerArguments = $Result.Args;
94+
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'GlobalZones' -Value $GlobalZones -InstallerArguments $InstallerArguments;
95+
$GlobalZones = $Result.Value;
96+
$InstallerArguments = $Result.Args;
97+
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'ParentZone' -Value $ParentZone -InstallerArguments $InstallerArguments;
98+
$ParentZone = $Result.Value;
99+
$InstallerArguments = $Result.Args;
100+
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'CAEndpoint' -Value $CAEndpoint -InstallerArguments $InstallerArguments;
101+
$CAEndpoint = $Result.Value;
102+
$InstallerArguments = $Result.Args;
103+
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'Endpoints' -Value $Endpoints -InstallerArguments $InstallerArguments;
104+
$Endpoints = $Result.Value;
105+
$InstallerArguments = $Result.Args;
106+
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'AddFirewallRule' -Value $AddFirewallRule -InstallerArguments $InstallerArguments;
107+
$AddFirewallRule = $Result.Value;
108+
$InstallerArguments = $Result.Args;
109+
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'AcceptConnections' -Value $AcceptConnections -InstallerArguments $InstallerArguments;
110+
$AcceptConnections = $Result.Value;
111+
$InstallerArguments = $Result.Args;
112+
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'ServiceUser' -Value $ServiceUser -InstallerArguments $InstallerArguments;
113+
$ServiceUser = $Result.Value;
114+
$InstallerArguments = $Result.Args;
115+
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'UpdateAgent' -Value $UpdateAgent -InstallerArguments $InstallerArguments;
116+
$UpdateAgent = $Result.Value;
117+
$InstallerArguments = $Result.Args;
118+
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'AddDirectorGlobal' -Value $AddDirectorGlobal -InstallerArguments $InstallerArguments;
119+
$AddDirectorGlobal = $Result.Value;
120+
$InstallerArguments = $Result.Args;
121+
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'AddGlobalTemplates' -Value $AddGlobalTemplates -InstallerArguments $InstallerArguments;
122+
$AddGlobalTemplates = $Result.Value;
123+
$InstallerArguments = $Result.Args;
124+
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'LowerCase' -Value $LowerCase -Default $FALSE -InstallerArguments $InstallerArguments;
125+
$LowerCase = $Result.Value;
126+
$InstallerArguments = $Result.Args;
127+
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'UpperCase' -Value $UpperCase -Default $FALSE -InstallerArguments $InstallerArguments;
128+
$UpperCase = $Result.Value;
129+
$InstallerArguments = $Result.Args;
130+
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'AutoUseFQDN' -Value $AutoUseFQDN -Default $FALSE -InstallerArguments $InstallerArguments;
131+
$AutoUseFQDN = $Result.Value;
132+
$InstallerArguments = $Result.Args;
133+
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'AutoUseHostname' -Value $AutoUseHostname -Default $FALSE -InstallerArguments $InstallerArguments;
134+
$AutoUseHostname = $Result.Value;
135+
$InstallerArguments = $Result.Args;
136+
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'EndpointConnections' -Value $EndpointConnections -InstallerArguments $InstallerArguments;
137+
$EndpointConnections = $Result.Value;
138+
$InstallerArguments = $Result.Args;
139+
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'OverrideDirectorVars' -Value $OverrideDirectorVars -InstallerArguments $InstallerArguments;
140+
$OverrideDirectorVars = $Result.Value;
141+
$InstallerArguments = $Result.Args;
142+
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'InstallFrameworkService' -Value $InstallFrameworkService -InstallerArguments $InstallerArguments;
143+
$InstallFrameworkService = $Result.Value;
144+
$InstallerArguments = $Result.Args;
145+
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'ServiceDirectory' -Value $ServiceDirectory -InstallerArguments $InstallerArguments;
146+
$ServiceDirectory = $Result.Value;
147+
$InstallerArguments = $Result.Args;
148+
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'FrameworkServiceUrl' -Value $FrameworkServiceUrl -InstallerArguments $InstallerArguments;
149+
$FrameworkServiceUrl = $Result.Value;
150+
$InstallerArguments = $Result.Args;
151+
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'InstallFrameworkPlugins' -Value $InstallFrameworkPlugins -InstallerArguments $InstallerArguments;
152+
$InstallFrameworkPlugins = $Result.Value;
153+
$InstallerArguments = $Result.Args;
154+
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'PluginsUrl' -Value $PluginsUrl -InstallerArguments $InstallerArguments;
155+
$PluginsUrl = $Result.Value;
156+
$InstallerArguments = $Result.Args;
157+
$Result = Set-IcingaWizardArgument -DirectorArgs $DirectorArgs -WizardArg 'ConvertEndpointIPConfig' -Value $ConvertEndpointIPConfig -InstallerArguments $InstallerArguments;
158+
$ConvertEndpointIPConfig = $Result.Value;
159+
$InstallerArguments = $Result.Args;
140160
}
141161
}
142162

0 commit comments

Comments
 (0)