mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-27 15:54:03 +02:00
Agent: support PowerShell 2.x, fix 32bit issues
PowerShell Agent Kickstart for Windows: Fixed install dir detection on 32bit Windows and added support for PowerShell 2.x
This commit is contained in:
parent
7895023498
commit
ac3e541317
@ -276,20 +276,18 @@ function Icinga2AgentModule {
|
|||||||
if (-Not $this.config('agent_version')) {
|
if (-Not $this.config('agent_version')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$WebStatusCode = 0;
|
|
||||||
$url = $this.config('download_url') + $this.getProperty('install_msi_package');
|
$url = $this.config('download_url') + $this.getProperty('install_msi_package');
|
||||||
$this.info('Downloading Icinga 2 Agent Binary from ' + $url + ' ...');
|
$this.info('Downloading Icinga 2 Agent Binary from ' + $url + ' ...');
|
||||||
$execptionMsg = '';
|
|
||||||
Try {
|
|
||||||
$WebStatusCode = Invoke-WebRequest -UseBasicParsing -Method Head -Uri "$url"
|
|
||||||
|
|
||||||
if ($WebStatusCode.StatusCode -eq 200) {
|
Try {
|
||||||
Invoke-WebRequest "$url" -OutFile $this.getInstallerPath();
|
$client = new-object System.Net.WebClient;
|
||||||
} else {
|
$client.DownloadFile($url, $this.getInstallerPath());
|
||||||
throw 'Failed to download Icinga 2 Agent Installer from URL';
|
|
||||||
|
if (-Not $this.installerExists()) {
|
||||||
|
throw 'Unable to locate downloaded Icinga 2 Agent installer file from ' + $url + '. Download destination: ' + $this.getInstallerPath();
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
throw 'Unable to download Icinga 2 Agent from ' + $url + '. Error: ' + $_.Exception.Message;
|
throw 'Unable to download Icinga 2 Agent from ' + $url + '. Please ensure the link does exist and access is possible. Error: ' + $_.Exception.Message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -382,7 +380,7 @@ function Icinga2AgentModule {
|
|||||||
$architecture = '';
|
$architecture = '';
|
||||||
$icingaInstallerName = '';
|
$icingaInstallerName = '';
|
||||||
if ([IntPtr]::Size -eq 4) {
|
if ([IntPtr]::Size -eq 4) {
|
||||||
$defaultInstallDir = ${Env:ProgramFiles(x86)} + "\ICINGA2";
|
$defaultInstallDir = ${Env:ProgramFiles} + "\ICINGA2";
|
||||||
$architecture = "x86";
|
$architecture = "x86";
|
||||||
$regPath = 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*';
|
$regPath = 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*';
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user