From 35c061b93705dee11839a6854f639d796363fbe2 Mon Sep 17 00:00:00 2001 From: Horacio Fernandez Date: Fri, 28 Aug 2015 08:23:28 -0500 Subject: [PATCH] Adding Trim to moduleName parse --- DSCResources/RS_rsModuleZipSum/RS_rsModuleZipSum.psm1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DSCResources/RS_rsModuleZipSum/RS_rsModuleZipSum.psm1 b/DSCResources/RS_rsModuleZipSum/RS_rsModuleZipSum.psm1 index 81912aa..5dd0aab 100644 --- a/DSCResources/RS_rsModuleZipSum/RS_rsModuleZipSum.psm1 +++ b/DSCResources/RS_rsModuleZipSum/RS_rsModuleZipSum.psm1 @@ -26,7 +26,7 @@ Function Test-TargetResource { if($modules) { foreach($module in $modules) { if(Test-Path -Path $((Join-Path $modulePath -ChildPath $module), '\', $($module, '.psd1' -join '') -join '')) { - $moduleName = $($module, '_', $(((Get-Content -Path $((Join-Path $modulePath -ChildPath $module), $($module, ".psd1" -join '') -join '\')) -match "ModuleVersion") -replace 'ModuleVersion', '' -replace ' ', '' -replace '=', '' -replace "'", '' -replace '"', '') -join '') + $moduleName = $($module, '_', $(((Get-Content -Path $((Join-Path $modulePath -ChildPath $module), $($module, ".psd1" -join '') -join '\')) -match "ModuleVersion") -replace 'ModuleVersion', '' -replace ' ', '' -replace '=', '' -replace "'", '' -replace '"', '').Trim() -join '') if(Test-Path -Path $(Join-Path $destination -ChildPath $($moduleName, '.zip' -join ''))) { if($((Get-FileHash -Path $(Join-Path $destination -ChildPath $($moduleName, '.zip' -join '')) -ErrorAction SilentlyContinue).Hash) -eq $(Get-Content -Path $(Join-Path $destination -ChildPath $($moduleName, '.zip.checksum' -join '')) -ErrorAction SilentlyContinue)) { @@ -64,7 +64,7 @@ Function Set-TargetResource { if($modules) { foreach($module in $modules) { if(Test-Path -Path $((Join-Path $modulePath -ChildPath $module), '\', $($module, '.psd1' -join '') -join '')) { - $moduleName = $($module, '_', $(((Get-Content -Path $((Join-Path $modulePath -ChildPath $module), $($module, ".psd1" -join '') -join '\')) -match "ModuleVersion") -replace 'ModuleVersion', '' -replace ' ', '' -replace '=', '' -replace "'", '' -replace '"', '') -join '') + $moduleName = $($module, '_', $(((Get-Content -Path $((Join-Path $modulePath -ChildPath $module), $($module, ".psd1" -join '') -join '\')) -match "ModuleVersion") -replace 'ModuleVersion', '' -replace ' ', '' -replace '=', '' -replace "'", '' -replace '"', '').Trim() -join '') if(!(Test-Path -Path $(Join-Path $destination -ChildPath $($moduleName, '.zip' -join ''))) -or !($((Get-FileHash -Path $(Join-Path $destination -ChildPath $($moduleName, '.zip' -join '')) -ErrorAction SilentlyContinue).Hash) -eq $(Get-Content -Path $(Join-Path $destination -ChildPath $($moduleName, '.zip.checksum' -join '')) -ErrorAction SilentlyContinue))) { Remove-Item -Path $((Join-Path $destination -ChildPath $module), '*' -join '') -Force if($module -ne "PowerShellAccessControl") {