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

Health Check preserving JSON Escape Characters. #1875

Closed
wstaples opened this issue Mar 24, 2016 · 2 comments
Closed

Health Check preserving JSON Escape Characters. #1875

wstaples opened this issue Mar 24, 2016 · 2 comments
Labels
theme/health-checks Health Check functionality type/bug Feature does not function as expected

Comments

@wstaples
Copy link

Consul Version

0.6.4

Platform

Windows Server 2012 R2 64-Bit

Actual Behavior

scripts or programs launched by health checks that require double quoted parameters are receiving the backslash character for escaped double quotes. \"

Expected Behavior

The script or program should receive a double quote with no backslash

Steps to reproduce

I have a health check that executes a batch file which needs a double quoted parameter. In order to create valid json I have to use backslashs to escape the double quotes.

{
  "check": {
    "script": "C:\\Program^ Files\\consul\\conf.d\\test.bat \"check-freespace.ps1\" \"-drive c\"",
    "interval": "10s",
    "name": "Check Freespace on System Drive40"
  }
}

Unexpectedly the batch file is receiving the backslash. \"check-freespace.ps1\"
when it should be receiving "check-freespace.ps1"

For a batch file I can easily remove the extra characters but for commands like:
"script": "PowerShell -File \"some file with a space in the name\""

Its a bit more difficult.

Versions Affected

0.6.x, 0.5.2
I tried all of the 6.x versions in both 32 and 64 bit as well as version 0.5.2 and they were all affected.

Platforms Affected

I believe this is a windows only issue as I was not able to recreated it on CentOS or Ubuntu

@slackpad slackpad added the type/bug Feature does not function as expected label Apr 5, 2016
@wintergren
Copy link

Have the same problem..

@futuralogic
Copy link

Same issue, but also on Windows 2008 R2. Instead of calling a batch file, we're calling Powershell directly.

PowerShell -ExecutionPolicy Bypass -NoProfile -File service_check.ps1 \"Message Queuing\"

@slackpad slackpad added this to the 0.7.4 milestone Nov 22, 2016
@slackpad slackpad removed this from the Triaged milestone Apr 18, 2017
@slackpad slackpad added the theme/health-checks Health Check functionality label May 25, 2017
mprokop pushed a commit to ENEXSA/fork-consul that referenced this issue Jul 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme/health-checks Health Check functionality type/bug Feature does not function as expected
Projects
None yet
Development

No branches or pull requests

4 participants