"Could not evaluate: invalid byte sequence in US-ASCII" From An Unless Command on an Exec Resource

asked 2016-08-15 18:24:08 -0600

JoshAcc gravatar image

Receiving an invalid byte sequence error message related to the unless attribute command of an exec resource. Error below:


Could not evaluate: invalid byte sequence in US-ASCII
Source:/Stage[main]/Main/Exec[demo error]
File:/etc/puppetlabs/code/environments/production/manifests/site.pp
Line:1


The manifest being used below:


# cat /etc/puppetlabs/code/environments/production/manifests/site.pp
exec { 'demo error':
command => '/bin/echo hi',
unless => '/bin/npm ls',
}


Puppetserver Version: 2016.2.0.9
Puppet Agent Version: 4.5.2

This error does not occur when running the command "puppet agent -t" directly.


The puppet agent daemon LANG variable appears to be set correctly.
# ps -ef | grep puppet
root 7611 24588 0 19:05 pts/0 00:00:00 grep --color=auto puppet
root 10269 1 0 Jul11 ? 00:01:40 /opt/puppetlabs/puppet/bin/ruby /usr/local/bin/puppet agent -d
root 27145 1 0 16:25 ? 00:00:04 /opt/puppetlabs/puppet/bin/pxp-agent --foreground
root 27223 1 0 16:25 ? 00:00:05 /opt/puppetlabs/puppet/bin/ruby /opt/puppetlabs/puppet/bin/mcollectived --config=/etc/puppetlabs/mcollective/server.cfg --pidfile=/var/run/puppetlabs/mcollective.pid --daemonize
# cat /proc/10269/environ | tr "\0" "\n" | grep LANG
LANG=en_US.UTF-8


The output from the unless command on the agent server:

# /bin/npm ls | od -c
0000000 / r o o t \n 342 224 224 342 224 200 342 224 200
0000020 ( e m p t y ) \n \n
0000031
# echo $?
0

edit retag flag offensive close merge delete