mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-28 16:24:05 +02:00
Icinga2Agent.psm1: a few upstream improvements
This commit is contained in:
parent
160a630c5c
commit
cff76236d8
@ -281,7 +281,7 @@ function Icinga2AgentModule {
|
|||||||
$this.info('Downloading Icinga 2 Agent Binary from ' + $url + ' ...');
|
$this.info('Downloading Icinga 2 Agent Binary from ' + $url + ' ...');
|
||||||
$execptionMsg = '';
|
$execptionMsg = '';
|
||||||
Try {
|
Try {
|
||||||
$WebStatusCode = Invoke-WebRequest -Method Head -Uri "$url"
|
$WebStatusCode = Invoke-WebRequest -UseBasicParsing -Method Head -Uri "$url"
|
||||||
|
|
||||||
if ($WebStatusCode.StatusCode -eq 200) {
|
if ($WebStatusCode.StatusCode -eq 200) {
|
||||||
Invoke-WebRequest "$url" -OutFile $this.getInstallerPath();
|
Invoke-WebRequest "$url" -OutFile $this.getInstallerPath();
|
||||||
@ -495,6 +495,7 @@ function Icinga2AgentModule {
|
|||||||
$this.info('Flushing content of ' + $this.getApiDirectory());
|
$this.info('Flushing content of ' + $this.getApiDirectory());
|
||||||
$folder = New-Object -ComObject Scripting.FileSystemObject;
|
$folder = New-Object -ComObject Scripting.FileSystemObject;
|
||||||
$folder.DeleteFolder($this.getApiDirectory());
|
$folder.DeleteFolder($this.getApiDirectory());
|
||||||
|
$this.setProperty('require_restart', 'true');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -862,10 +863,11 @@ object ApiListener "api" {
|
|||||||
$this.generateIcingaConfiguration();
|
$this.generateIcingaConfiguration();
|
||||||
$this.applyPossibleConfigChanges();
|
$this.applyPossibleConfigChanges();
|
||||||
|
|
||||||
|
if ($this.shouldFlushIcingaApiDirectory()) {
|
||||||
|
$this.flushIcingaApiDirectory();
|
||||||
|
}
|
||||||
|
|
||||||
if ($this.madeChanges()) {
|
if ($this.madeChanges()) {
|
||||||
if ($this.shouldFlushIcingaApiDirectory()) {
|
|
||||||
$this.flushIcingaApiDirectory();
|
|
||||||
}
|
|
||||||
$this.restartAgent();
|
$this.restartAgent();
|
||||||
} else {
|
} else {
|
||||||
$this.info('No changes detected.');
|
$this.info('No changes detected.');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user