sensu / sensu-puppet

Sensu Puppet module.
https://github.com/sensu/sensu-puppet
MIT License
165 stars 290 forks source link

Puppet Agent Fails Due to invalid multibyte char (US-ASCII) #1235

Closed mvsm closed 4 years ago

mvsm commented 4 years ago

Description of problem

When using this module on Debian Servers with UTF-8 locales set, errors are raised regarding characters not present in UTF-8 charset.

Expected Behavior

Puppet run finishes without errors

Current Behavior

During the puppet run, the catalog is not compiled due to an error from non-UTF-8 characters.

Info: Using configured environment 'feature_add_sensugo' Info: Retrieving pluginfacts Info: Retrieving plugin Info: Loading facts Error: Could not retrieve catalog from remote server: Error 500 on SERVER: {"message":"Server Error: Evaluation Error: Error while evaluating a Type-Name, Could not autoload puppet/type/sensu_user: /etc/puppetlabs/code/environments/feature_add_sensugo/modules/sensu/lib/puppet/type/sensu_user.rb:85: invalid multibyte char (US-ASCII) at /etc/puppetlabs/code/environments/feature_add_sensugo/modules/sensu/manifests/backend/tessen.pp:20:7 on node rtesrv5.reliant","issue_kind":"RUNTIME_ERROR","stacktrace":["Warning: The 'stacktrace' property is deprecated and will be removed in a future version of Puppet. For security reasons, stacktraces are not returned with Puppet HTTP Error responses."]} Warning: Not using cache on failed catalog Error: Could not retrieve catalog; skipping run

Steps to Reproduce

  1. Puppet Server on a Debian machine configured with the module and LANG=en_US.UTF-8 as the system locale.
  2. Generate types (it will show errors regarding the chars not in UTF-8)
  3. Execute puppet agent on a debian node.

Command used and debugging output

Master based puppet setup.

Platform and version information

Anything else to add that you think will be helpful?

Possible Solution: Remove char ’ from the code.

Links: https://github.com/sensu/sensu-puppet/blob/1b83daf0787faf9d09059adec0fb13097bedcca0/lib/puppet/type/sensu_filter.rb#L67 https://github.com/sensu/sensu-puppet/blob/1b83daf0787faf9d09059adec0fb13097bedcca0/lib/puppet/type/sensu_hook.rb#L65 https://github.com/sensu/sensu-puppet/blob/1b83daf0787faf9d09059adec0fb13097bedcca0/lib/puppet/type/sensu_user.rb#L89

treydock commented 4 years ago

The fix is simple but FYI that we don't officially support Puppet 4, only Puppet >= 5.0.0. I think Puppet 4 is also EOL. I'd recommend updating your Puppet install.

mvsm commented 4 years ago

Thanks for the advice, we are migrating but it is a work in progress. Regardless, I did a PR with the fix. Thanks for the fast reply btw.