mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-20 23:00:35 -05:00
Merge pull request #382 from Icinga:fix/repository_hash_generator
Fix: Repository Hash generator Fixes the hash generator for the repository hash, which always returned the same hash.
This commit is contained in:
commit
fedc34bbb2
2 changed files with 14 additions and 3 deletions
|
|
@ -15,6 +15,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
|
||||||
|
|
||||||
* [#375](https://github.com/Icinga/icinga-powershell-framework/pull/375) Fixes exception on last message printed during `Uninstall-IcingaForWindows`, because the prior used function is no longer present at this point
|
* [#375](https://github.com/Icinga/icinga-powershell-framework/pull/375) Fixes exception on last message printed during `Uninstall-IcingaForWindows`, because the prior used function is no longer present at this point
|
||||||
* [#376](https://github.com/Icinga/icinga-powershell-framework/pull/376) Fixes IMC error handling on invalid JSON for installation command/file
|
* [#376](https://github.com/Icinga/icinga-powershell-framework/pull/376) Fixes IMC error handling on invalid JSON for installation command/file
|
||||||
|
* [#381](https://github.com/Icinga/icinga-powershell-framework/issues/381) Fixes Repository Hash generator for new repositories, which always returned the same hash regardless of the files inside
|
||||||
|
|
||||||
## 1.6.1 (2021-09-15)
|
## 1.6.1 (2021-09-15)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,20 @@ function Get-IcingaRepositoryHash()
|
||||||
}
|
}
|
||||||
|
|
||||||
$RepositoryFolder = Get-ChildItem -Path $Path -Recurse;
|
$RepositoryFolder = Get-ChildItem -Path $Path -Recurse;
|
||||||
[array]$FileHashes = @();
|
$FileHashes = New-Object -TypeName 'System.Text.StringBuilder';
|
||||||
|
|
||||||
foreach ($entry in $RepositoryFolder) {
|
foreach ($entry in $RepositoryFolder) {
|
||||||
$FileHashes += (Get-FileHash -Path $entry.FullName -Algorithm SHA256).Hash;
|
$FileHash = (Get-FileHash -Path $entry.FullName -Algorithm SHA256).Hash;
|
||||||
|
|
||||||
|
if ([string]::IsNullOrEmpty($FileHash)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($FileHashes.Length -ne 0) {
|
||||||
|
$FileHashes.Append('+') | Out-Null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$FileHashes.Append($FileHash) | Out-Null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$HashAlgorithm = [System.Security.Cryptography.HashAlgorithm]::Create('SHA256');
|
$HashAlgorithm = [System.Security.Cryptography.HashAlgorithm]::Create('SHA256');
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue