Skip to content

Commit 1864b7c

Browse files
committed
Fix crash while trying to update with identical current and target version
Fixes #50
1 parent 732c46e commit 1864b7c

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

lib/core/framework/Get-IcingaPowerShellModuleArchive.psm1

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,14 @@ function Get-IcingaPowerShellModuleArchive()
2626

2727
if ($null -ne $CurrentVersion -And $CurrentVersion -eq $Tag) {
2828
Write-Host ([string]::Format('Your "{0}" is already up-to-date', $ModuleName));
29-
return;
29+
return @{
30+
'DownloadUrl' = $DownloadUrl;
31+
'Version' = $Tag;
32+
'Directory' = '';
33+
'Archive' = '';
34+
'ModuleRoot' = (Get-IcingaFrameworkRootPath);
35+
'Installed' = $FALSE;
36+
};
3037
}
3138
}
3239
} else {
@@ -56,5 +63,6 @@ function Get-IcingaPowerShellModuleArchive()
5663
'Directory' = $DownloadDirectory;
5764
'Archive' = $DownloadDestination;
5865
'ModuleRoot' = (Get-IcingaFrameworkRootPath);
66+
'Installed' = $TRUE;
5967
};
6068
}

lib/core/framework/Install-IcingaFrameworkPlugins.psm1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ function Install-IcingaFrameworkPlugins()
77
$RepositoryName = 'icinga-powershell-plugins';
88
$Archive = Get-IcingaPowerShellModuleArchive -DownloadUrl $PluginsUrl -ModuleName 'Icinga Plugins' -Repository $RepositoryName;
99

10+
if ($Archive.Installed -eq $FALSE) {
11+
return @{
12+
'PluginUrl' = $Archive.DownloadUrl
13+
};
14+
}
15+
1016
Write-Host ([string]::Format('Installing module into "{0}"', ($Archive.Directory)));
1117
Expand-IcingaZipArchive -Path $Archive.Archive -Destination $Archive.Directory | Out-Null;
1218

lib/core/framework/Install-IcingaFrameworkUpdate.psm1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ function Install-IcingaFrameworkUpdate()
77
$RepositoryName = 'icinga-powershell-framework';
88
$Archive = Get-IcingaPowerShellModuleArchive -DownloadUrl $FrameworkUrl -ModuleName 'Icinga Framework' -Repository $RepositoryName;
99

10+
if ($Archive.Installed -eq $FALSE) {
11+
return @{
12+
'PluginUrl' = $Archive.DownloadUrl
13+
};
14+
}
15+
1016
Write-Host ([string]::Format('Installing module into "{0}"', ($Archive.Directory)));
1117
Expand-IcingaZipArchive -Path $Archive.Archive -Destination $Archive.Directory | Out-Null;
1218

0 commit comments

Comments
 (0)