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

Invoke-PSRule -InputPath treats input as file unless it ends with [System.IO.Path]::DirectorySeparatorChar #1842

Open
o-l-a-v opened this issue May 29, 2024 · 0 comments
Labels
bug Something isn't working feature: input Issues that affect input

Comments

@o-l-a-v
Copy link

o-l-a-v commented May 29, 2024

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

@BernieWhite BernieWhite added bug Something isn't working feature: input Issues that affect input labels May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feature: input Issues that affect input
Projects
None yet
Development

No branches or pull requests

2 participants