Description of the issue
Invoke-PSRule -InputPath seems to treat input as file unless it ends with [System.IO.Path]::DirectorySeparatorChar.
To Reproduce
Inside C:\Users\olav.birkeland\some\directory I have two Bicep compiled files:
main.bicep
prod.bicepparam
Invoke-PSRule -InputPath 'C:\Users\olav.birkeland\some\directory' -Module 'PSRule.Rules.Azure' -Format 'File' -Outcome 'Fail','Error' -OutputFormat 'None' -Debug
Gives DEBUG: Target failed If precondition. Without debug it gives no output. While:
Invoke-PSRule -InputPath 'C:\Users\olav.birkeland\some\directory\' -Module 'PSRule.Rules.Azure' -Format 'File' -Outcome 'Fail','Error'
gives
RuleName Outcome Recommendation
-------- ------- --------------
Azure.Template.UseDescriptions Fail Specify descriptions for each resource in the template.
Expected behaviour
Detect whether -InputPath is a file or a directory. For instance [System.IO.File]::Exist('C:\Users\olav.birkeland\some\directory') returns $false.
Error output
Module in use and version:
- PSRule v2.9.0
- PSRule.Rules.Azure v1.36.0
Captured output from $PSVersionTable:
Name Value
---- -----
PSVersion 7.4.2
PSEdition Core
GitCommitId 7.4.2
OS Microsoft Windows 10.0.22631
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Additional context
Description of the issue
Invoke-PSRule -InputPathseems to treat input as file unless it ends with[System.IO.Path]::DirectorySeparatorChar.To Reproduce
Inside
C:\Users\olav.birkeland\some\directoryI have two Bicep compiled files:main.bicepprod.bicepparamGives
DEBUG: Target failed If precondition. Without debug it gives no output. While:gives
Expected behaviour
Detect whether
-InputPathis a file or a directory. For instance[System.IO.File]::Exist('C:\Users\olav.birkeland\some\directory')returns$false.Error output
Module in use and version:
Captured output from
$PSVersionTable:Additional context