Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

Commit 9e156c4

Browse files
committed
Only get module manifest if it exists
1 parent 52604cf commit 9e156c4

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

Modules/OperationValidation/OperationValidation.psm1

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -296,11 +296,21 @@ param (
296296
$moduleName = Split-Path -Path $module -Leaf
297297
$manifestFile = Get-ChildItem -Path $module -Filter "$moduleName.psd1"
298298
if (-not $manifestFile) {
299-
# We may be in a "version" directory so get the actual module name from the parent directory
300-
$parent = (Split-Path -Path $module -Parent).Name
301-
$manifestFile = Get-ChildItem -Path $module -Filter "$parent.psd1"
299+
if ($moduleName -as [version]) {
300+
# We are in a "version" directory so get the actual module name from the parent directory
301+
$parent = (Split-Path -Path $module -Parent).Name
302+
$manifestFile = Get-ChildItem -Path $module -Filter "$parent.psd1"
303+
}
304+
}
305+
306+
# Some OVF modules might not have a manifest (.psd1) file.
307+
if ($manifestFile) {
308+
$manifest = Test-ModuleManifest -Path $manifestFile.FullName -Verbose:$false
309+
}
310+
else
311+
{
312+
$manifest = $null
302313
}
303-
$manifest = Test-ModuleManifest -Path $manifestFile.FullName -Verbose:$false
304314

305315
if ( test-path -path $diagnosticsDir )
306316
{
@@ -333,7 +343,7 @@ param (
333343
Type = $dir
334344
Name = $testName
335345
ModuleName = $Module
336-
Version = [version]$manifest.Version
346+
Version = if ($manifest.Version) { [version]$manifest.Version } else { $null }
337347
Parameters = $parameters
338348
}
339349
New-OperationValidationInfo @modInfoParams

0 commit comments

Comments
 (0)