Error "invalid byte sequence in US-ASCII" en Puppet | Algo de Linux

viernes, 30 de junio de 2017

Error "invalid byte sequence in US-ASCII" en Puppet

En nuestros centros utilizamos puppetmaster con passenger y apache.

Probablemente alguno de vosotros haya visto el siguiente error en alguna ocasión: "invalid byte sequence in US-ASCII". Pues bien, una manera de evitarlo, es forzar que el puppetmaster utilice UTF-8.

Para ello, editamos el archivo /usr/share/puppet/rack/puppetmasterd/ y le añadimos la siguiente línea:

Encoding.default_external = Encoding::UTF_8

A continuación podéis ver el fichero /usr/share/puppet/rack/puppetmasterd/ de mi puppetmaster:
# a, for use with every rack-compatible webserver.
# SSL needs to be handled outside this, though.

# if puppet is not in your RUBYLIB:
# $LOAD_PATH.unshift('/opt/puppet/lib')

$0 = "master"

# if you want debugging:
# ARGV << "--debug"

ARGV << "--rack"

# Rack applications typically don't start as root.  Set --confdir and --vardir
# to prevent reading configuration from ~puppet/.puppet/puppet.conf and writing
# to ~puppet/.puppet
ARGV << "--confdir" << "/etc/puppet"
ARGV << "--vardir"  << "/var/lib/puppet"

# NOTE: it's unfortunate that we have to use the "CommandLine" class
#  here to launch the app, but it contains some initialization logic
#  (such as triggering the parsing of the config file) that is very
#  important.  We should do something less nasty here when we've
#  gotten our API and settings initialization logic cleaned up.
# Also note that the "$0 = master" line up near the top here is
#  the magic that allows the CommandLine class to know that it's
#  supposed to be running master.
# --cprice 2012-05-22

require 'puppet/util/command_line'
# we're usually running inside a {} block,
# therefore we need to call run *here*.

Encoding.default_external = Encoding::UTF_8
Publicado por primera vez en

No hay comentarios: