Skip to content

Commit

Permalink
Merge pull request #5 from avarga77/main
Browse files Browse the repository at this point in the history
Added a folder deletion section to Add-ModulesToBlobStorage.ps1
  • Loading branch information
ykuijs authored Dec 18, 2023
2 parents 739c8c1 + 2196dd1 commit 79ac049
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- Added a folder deletion section to Add-ModulesToBlobStorage.ps1 to avoid packaging issues on self-hosted VMs.

## [0.1.5] - 2023-12-11

### Fixed
Expand Down
9 changes: 6 additions & 3 deletions source/Public/Add-ModulesToBlobStorage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,13 @@ function Add-ModulesToBlobStorage
Write-LogEntry -Message 'Downloading dependencies' -Level $script:level
$script:level++

$savePath = Join-Path -Path $env:TEMP -ChildPath 'M365DSCModules'
if ((Test-Path -Path $savePath) -eq $false) {
$null = New-Item -Path $savePath -ItemType 'Directory'
$destination = Join-Path -Path $env:TEMP -ChildPath 'M365DSCModules'
$savePath = Join-Path -Path $destination -ChildPath $m365Module.Version.ToString()
if (Test-Path -Path $savePath) {
Write-LogEntry -Message "$savePath already exists. Removing!" -Level $script:level
Remove-Item -Path $savePath -Recurse -Confirm:$false
}
$null = New-Item -Path $savePath -ItemType 'Directory'

Write-LogEntry -Message ('Saving module {0} (v{1})' -f $m365Module.Name, $m365Module.Version.ToString()) -Level $script:level
Save-Module -Name $m365Module.Name -RequiredVersion $m365Module.Version.ToString() -Path $savePath
Expand Down

0 comments on commit 79ac049

Please sign in to comment.