Skip to content

Conversation

@twitchax
Copy link
Contributor

@twitchax twitchax commented Mar 21, 2018

Fices path comparison in the cleanup script on Netcore. Otherwise, module PSD1s get deleted.

Description

Checklist

Copy link
Contributor

@maddieclayton maddieclayton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix - just two more places I think the fix belongs.

$removedDlls | % { Write-Verbose "Removing $($_.Name)"; Remove-Item $_.FullName -Force }

Write-Verbose "Removing scripts and psd1 in $($RMFolder.FullName)"
if (Test-Path -Path "$($RMFolder.FullName)\StartupScripts")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add the change here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maddieclayton, I can add the fix here, but it is not required. Test-Path and Get-ChildItem will properly resolve \ and /. The problem is the string comparison when Get-ChildItem returns "/a/cool/path", and we compare it to "/a/cool\path".

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh no worries then. LGTM

$scriptName = "$($RMFolder.FullName)\StartupScripts\$($RMFolder.Name.replace('.', ''))Startup.ps1"
$scriptName = "$($RMFolder.FullName)$([IO.Path]::DirectorySeparatorChar)StartupScripts$([IO.Path]::DirectorySeparatorChar)$($RMFolder.Name.replace('.', ''))Startup.ps1"
Write-Verbose $scriptName
$removedScripts = Get-ChildItem -Path "$($RMFolder.FullName)\StartupScripts" -Filter "*.ps1" | where { $_.FullName -ne $scriptName }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

@maddieclayton maddieclayton merged commit 3514f55 into Azure:preview Mar 21, 2018
@twitchax twitchax deleted the netcore_cleanup_fix branch May 16, 2018 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants