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

InvalidArgument gathering facts if a folder in %PATH% contains an invalid character #364

Closed
J3ronimo opened this issue Jun 2, 2022 · 1 comment · Fixed by #370
Closed

Comments

@J3ronimo
Copy link

J3ronimo commented Jun 2, 2022

I just tried to run a playbook on a machine where, inside a path in the PATH variable, there was a double-quote (") character that somehow slipped in at the end of a path. Looked something like this:

echo %PATH%

...;C:\Program Files\jdk-12.0.2\bin";...

The consequence was an uncaught error in Test-Path used here:

[WARNING]: Error when collecting facter facts: Test-Path : Illegales Zeichen im Pfad.  In Zeile:10 Zeichen:17  +
Test-Path -LiteralPath $facterPath  +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~      + CategoryInfo          :
InvalidArgument: (C:\Program File...bin"\facter.exe:String) [Test-Path], ArgumentException      + FullyQualifiedErrorId :
ItemExistsArgumentError,Microsoft.PowerShell.Commands.TestPathCommand      bei <ScriptBlock>, <Keine Datei>: Zeile 10  bei
<ScriptBlock>, <Keine Datei>: Zeile 3

Basically that says "illegal character in the path you're testing".

It's clearly an error on the target machine and should (and could) be fixed there. But nevertheless, ansible is going to run into this everytime and print this error message, which is IMHO anything from clear towards what the actual problem is.
In fact, ansible doesn't need to care at all - if the path is broken, there can't be an executable facter.exe there, so for that matter it's a NO and the loop should just continue testing with the next path.

Thx ;)

@J3ronimo J3ronimo changed the title InvalidArgument gathering facts if any folder in %PATH% is invalid InvalidArgument gathering facts if a folder in %PATH% contains an invalid character Jun 2, 2022
@jborean93
Copy link
Collaborator

Thanks for the bug report, #370 should fix this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants