fauxhai icon indicating copy to clipboard operation
fauxhai copied to clipboard

Fauxhai.fetch is giving JSON::ParserError: error

Open Deepak1100 opened this issue 7 years ago • 5 comments

    base::default When all attributes are default, on an amazon 2017.09 install packages
     Failure/Error: Fauxhai.fetch(host: 'xxxxx')

     JSON::ParserError:
       416: unexpected token at '-08-23T18:01:08+00:00] INFO: The plugin path /etc/chef/ohai/plugins does not exist. Skipping...
       {
         "dmi": {

         },
         "languages": {
           "perl": {
......
}
'

I think is because of the last single quote.

Installing fauxhai 5.6.0 (was 5.5.0)

Deepak1100 avatar Aug 23 '18 10:08 Deepak1100

There is no quote in the file https://raw.githubusercontent.com/chefspec/fauxhai/master/lib/fauxhai/platforms/amazon/2017.09.json so I'm not sure where that came from, are you sure that isn't just part of the error display?

coderanger avatar Aug 23 '18 11:08 coderanger

@coderanger i think you are right the last single is part of error display.(i have updated the error msg) But I have checked the JSON of ohai properties displayed in error and it is valid JSON.

Deepak1100 avatar Aug 23 '18 18:08 Deepak1100

It's pretty rare to use Fauxhai directly, and the fetch API even more rare. What's your use case? Is there possibly something wrong with the network such that it's getting back a proxy error page (which would be HTML)?

coderanger avatar Aug 23 '18 20:08 coderanger

I have using many node['ec2'] ohai attributes in my recipe which is causing the test to fail. and to mock those ec2 attributes I am fetching them from dev server. Btw this is the first time I am writing chefspec test and so just wanted to know if this is the way to mock ec2 data.

Deepak1100 avatar Aug 24 '18 06:08 Deepak1100

I got around this error by simply creating the /etc/chef/ohai/plugins directory and leaving it empty

oscar123mendoza avatar Dec 28 '18 18:12 oscar123mendoza