Project

General

Profile

Actions

Support #19261

closed

unexpected token JSON parse error when reading Puppet environment

Added by Iain Buclaw about 7 years ago. Updated over 6 years ago.

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

Description

From web UI:

Error: ERF12-4115 [ProxyAPI::ProxyException]: Unable to get classes from Puppet for production ([RestClient::NotAcceptable]: 406 Not Acceptable) for proxy https://eu-40.sociomantic.com:8443/puppet

From proxy logs:

E, [2017-04-12T19:27:15.695451 ] ERROR -- : Failed to show puppet classes: 795: unexpected token at '�
��line�file�Y/etc/puppetlabs/code/environments/production/modules...'

There's more in the string, but it's all encoded in this manner, so I cannot see where "795" (line? character?) is supposed to be. But it for sure looks like a JSON parser error.

Actions #1

Updated by Iain Buclaw about 7 years ago

Iain Buclaw wrote:

From proxy logs:

E, [2017-04-12T19:27:15.695451 ] ERROR -- : Failed to show puppet classes: 795: unexpected token at '�
��line�file�Y/etc/puppetlabs/code/environments/production/modules...'

I've just noticed this a little earlier in the day in the same proxy log.

D, [2017-04-12T13:49:09.812987 ] DEBUG -- : signed puppet certificate for newhost
I, [2017-04-12T13:49:09.813669 ] INFO -- : 2a01:4f8:160:442f::2 - - [12/Apr/2017:13:49:09 +0000] "POST /puppet/ca/newhost HTTP/1.1" 200 - 1.2936

D, [2017-04-12T13:49:09.814577 ] DEBUG -- : close: 1234:123:123:1234::2:60380
D, [2017-04-12T13:49:10.258590 ] DEBUG -- : accept: 1234:123:123:1234::2:60382
D, [2017-04-12T13:49:10.261276 ] DEBUG -- : Rack::Handler::WEBrick is invoked.
D, [2017-04-12T13:49:10.261670 ] DEBUG -- : verifying remote client 1234:123:123:1234::2 against trusted_hosts ["foreman"]
E, [2017-04-12T13:49:10.263716 ] ERROR -- : "\xDC" from ASCII-8BIT to UTF-8
D, [2017-04-12T13:49:10.263744 ] DEBUG -- : "\xDC" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError)

Actions #2

Updated by Iain Buclaw about 7 years ago

Iain Buclaw wrote:

Iain Buclaw wrote:

From proxy logs:

E, [2017-04-12T19:27:15.695451 ] ERROR -- : Failed to show puppet classes: 795: unexpected token at '�
��line�file�Y/etc/puppetlabs/code/environments/production/modules...'

I've just noticed this a little earlier in the day in the same proxy log.

D, [2017-04-12T13:49:09.812987 ] DEBUG -- : signed puppet certificate for newhost
I, [2017-04-12T13:49:09.813669 ] INFO -- : 2a01:4f8:160:442f::2 - - [12/Apr/2017:13:49:09 +0000] "POST /puppet/ca/newhost HTTP/1.1" 200 - 1.2936

D, [2017-04-12T13:49:09.814577 ] DEBUG -- : close: 1234:123:123:1234::2:60380
D, [2017-04-12T13:49:10.258590 ] DEBUG -- : accept: 1234:123:123:1234::2:60382
D, [2017-04-12T13:49:10.261276 ] DEBUG -- : Rack::Handler::WEBrick is invoked.
D, [2017-04-12T13:49:10.261670 ] DEBUG -- : verifying remote client 1234:123:123:1234::2 against trusted_hosts ["foreman"]
E, [2017-04-12T13:49:10.263716 ] ERROR -- : "\xDC" from ASCII-8BIT to UTF-8
D, [2017-04-12T13:49:10.263744 ] DEBUG -- : "\xDC" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError)

Sadly, deleting the host does not fix the problem

Actions #3

Updated by Dominic Cleal about 7 years ago

  • Project changed from Foreman to Smart Proxy
  • Subject changed from [JSON::ParserError] Error: ERF12-4115 [ProxyAPI::ProxyException]: Unable to get classes from Puppet for production to unexpected token JSON parse error when reading Puppet environment
  • Category set to Puppet

Which version of Puppet is the server running? If 4.4 or higher, it would be useful to see the original JSON by calling the Puppet Server's environment_classes API, else if 4.0-4.3, the resource_types API.

Actions #4

Updated by Anonymous about 7 years ago

Also, which versions of smart-proxy and ruby are you using?

Actions #5

Updated by Iain Buclaw about 7 years ago

Dominic Cleal wrote:

Which version of Puppet is the server running? If 4.4 or higher, it would be useful to see the original JSON by calling the Puppet Server's environment_classes API, else if 4.0-4.3, the resource_types API.

  1. puppet --version
    4.10.0
Actions #6

Updated by Iain Buclaw about 7 years ago

Dmitri Dolguikh wrote:

Also, which versions of smart-proxy and ruby are you using?

Using Foreman-proxy 1.14.3

  1. ruby --version
    ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]
Actions #7

Updated by Anonymous about 7 years ago

Any chance you could call puppet api directly using curl or something similar? The url you need is https://puppet.host:8140/puppet/v3/environment_classes?environment=environment_name".

Actions #8

Updated by Iain Buclaw about 7 years ago

Dmitri Dolguikh wrote:

Any chance you could call puppet api directly using curl or something similar? The url you need is https://puppet.host:8140/puppet/v3/environment_classes?environment=environment_name".

Yes, the outputted JSON is over 300k characters long, so I'll refrain from posting here, but at least I have something to debug locally. I'll let you know if I find the trouble spot.

Actions #9

Updated by Anonymous over 6 years ago

  • Tracker changed from Bug to Support
  • Status changed from New to Closed

This appears to be an issue with one of the puppet classes, not puppet or smart-proxy themselves. I'm closing the issue, please re-open or create a new should you see it again.

Actions

Also available in: Atom PDF