Ask Your Question
0

I need help with logoutput and \n

asked 2014-07-25 05:52:39 -0500

mcas gravatar image

Hi, i have an exec command with logoutput => true. In this Output are \n but in the lastrunreport.yaml these \n are encoded as \x5c. What can I do, to get the \n into the report. I can see that puppet translates tab stops to \t. The \n comes from a sed line to translate newlines to \n so that I have all lines in a single message. I hope someone can help me out. Thank you

agent version: 3.6.2 Debian 6.0.7 ruby 1.8.7

If you need more information please ask.

edit retag flag offensive close merge delete

Comments

Feed us with the sed and exec

3h4x gravatar image3h4x ( 2014-07-27 09:31:48 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-07-28 01:25:53 -0500

mcas gravatar image

The exec looks like this:

exec { "diff-testfile":
            command => "/root/puppet-diff.sh file1 file2",
            refreshonly => true,
            logoutput => true,
            notify => Exec["archive-testfile"],
        }

puppet-diff.sh looks like this:

#!/bin/bash

/usr/bin/diff -u $1 $2 | sed ':a;N;$!ba;s/\n/\\n/g'|sed 's/$/\\n/'

I hope this is what you need.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-07-25 05:52:39 -0500

Seen: 302 times

Last updated: Jul 28 '14