Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xWebVirtualDirectory: Fails to create directory under application #533

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

- Changes to xWebVirtualDirectory
- Update on how Virtual directory are tested to correct the issue ([issue #331](https://github.com/PowerShell/xWebAdministration/issues/331)).
- Changes to xWebAdministration
- Resolved custom Script Analyzer rules that was added to the test framework.
- Moved change log from README.md to a separate CHANGELOG.md ([issue #446](https://github.com/PowerShell/xWebAdministration/issues/446)).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,16 @@ function Get-TargetResource

Assert-Module

if ($null -eq $WebApplication -OR $WebApplication.Length -eq 0)
{
$virtualDirectoryName = $Name
}
else {
$virtualDirectoryName = "/$($WebApplication)/$($Name)"
}
$virtualDirectory = Get-WebVirtualDirectory -Site $Website `
-Name $Name `
-Application $WebApplication
-Name $virtualDirectoryName `
-Application ""

$PhysicalPath = ''
$Ensure = 'Absent'
Expand Down Expand Up @@ -111,9 +118,16 @@ function Set-TargetResource

if ($Ensure -eq 'Present')
{
if ($null -eq $WebApplication -OR $WebApplication.Length -eq 0)
{
$virtualDirectoryName = $Name
}
else {
$virtualDirectoryName = "/$($WebApplication)/$($Name)"
}
$virtualDirectory = Get-WebVirtualDirectory -Site $Website `
-Name $Name `
-Application $WebApplication
-Name $virtualDirectoryName `
-Application ""
if ($virtualDirectory.count -eq 0)
{
Write-Verbose -Message ($LocalizedData.VerboseSetTargetCreateVirtualDirectory -f $Name)
Expand Down Expand Up @@ -186,9 +200,16 @@ function Test-TargetResource

Assert-Module

if ($null -eq $WebApplication -OR $WebApplication.Length -eq 0)
{
$virtualDirectoryName = $Name
}
else {
$virtualDirectoryName = "/$($WebApplication)/$($Name)"
}
$virtualDirectory = Get-WebVirtualDirectory -Site $Website `
-Name $Name `
-Application $WebApplication
-Name $virtualDirectoryName `
-Application ""

if ($virtualDirectory.Count -eq 1 -and $Ensure -eq 'Present')
{
Expand Down