Project

General

Profile

Actions

Support #12276

closed

backslash in hash smart variable value craches puppet

Added by Brice Sauvajon over 8 years ago. Updated about 7 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Triaged:
Fixed in Releases:
Found in Releases:

Description

Hi

I've got a hash which defines sudoers entry. The command contains a : so it must be despacialized for sudo. My hash looks like this :

command:
- "/usr/bin/php app/console cron\\:run"

But when I run puppet on the client I've got the error :

Could not retrieve catalog from remote server: Error 400 on SERVER: Failed when searching for node lyldsvi33.intranet.atih.sante.fr: Could not load external node results for lyldsvi33.intranet.atih.sante.fr: (<unknown>): found unknown escape character :(58) while scanning a double-quoted scalar at line 574 column 50

Which matches the first backslash of my string.

Actions #1

Updated by Dominic Cleal over 8 years ago

  • Status changed from New to Feedback

Try adding another level of escaping:

command:
- "/usr/bin/php app/console cron\\\\:run" 

Testing on the console, YAML is able to parse that and what ought to be passed through to Puppet is then the string:

/usr/bin/php app/console cron\:run
Actions #2

Updated by Brice Sauvajon over 8 years ago

Thanks,

tried it but still the same error which points to the first backslash.

I watched the output of the node.rb with your suggestion and saw only one backslash, so I added two more backslashes and now it works !
So my hash has become :

command:
- "/usr/bin/php app/console cron\\\\\\:run"

Seems strange, but works ok, thanks a lot!

Actions #3

Updated by Anonymous about 7 years ago

  • Tracker changed from Bug to Support
  • Status changed from Feedback to Resolved
Actions

Also available in: Atom PDF