Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extra json on mongo output causing provider 'mongodb': 783: unexpected token at '{ #680

Closed
xepa opened this issue Sep 12, 2023 · 3 comments · Fixed by #681
Closed

Extra json on mongo output causing provider 'mongodb': 783: unexpected token at '{ #680

xepa opened this issue Sep 12, 2023 · 3 comments · Fixed by #681
Labels
bug Something isn't working

Comments

@xepa
Copy link

xepa commented Sep 12, 2023

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 7.26.0
  • Ruby: 2.7.8p225
  • Distribution: ubuntu
  • Module version: master

How to reproduce (e.g Puppet code you use)

we are running this on an established mongodb instance,

What are you seeing

running any /usr/bin/mongo command cli returns an extra json line, this is related to SERVER-78540 it would seem and was fixed in 4.x and 6.x but not yet in 5.x (running 5.0.21 atm)

output of command will result in something like

{"t":{"$date":"2023-09-12T06:33:42.971Z"},"s":"I",  "c":"NETWORK",  "id":5490002, "ctx":"thread4","msg":"Started a new thread for the timer service"}
{
  "databases" : [
    {
      "name" : "admin",
      "sizeOnDisk" : NumberLong(184320),
      "empty" : false
    },
    {
      "name" : "config",
      "sizeOnDisk" : NumberLong(110592),
      "empty" : false
    },
    {
      "name" : "local",
      "sizeOnDisk" : NumberLong(81920),
      "empty" : false
    }
  ],
  "totalSize" : NumberLong(1261928448),
  "totalSizeMb" : NumberLong(1203),
  "ok" : 1
}

Error will be something like

Error: Could not prefetch mongodb_database provider 'mongodb': 783: unexpected token at '{

What behaviour did you expect instead

In my opinion this extra line should be removed in lib/puppet/util/mongodb_output.rb

@witjoh
Copy link
Contributor

witjoh commented Sep 12, 2023

/usr/bin/mongo is deprecated in favor of /usr/bin/mongosh .. And it is removed in version 6. Working on #677 which only supports mongosh, and version 4.4+ of mongodb.
But i need to finalize this PR. (like cleaning commits, get extra acceptance tests ...) Just need more hours in a day :)

@xepa
Copy link
Author

xepa commented Sep 12, 2023

This sounds like a better approach, .. I just whipped up this small fix in the mean time as it was causing the puppet run to fail. If there is anything that I could do please let me know.

@witjoh
Copy link
Contributor

witjoh commented Sep 12, 2023

I'm only testing my branch on Redhat flavours .. So in time someone testing it in Ubunto and aother flavours could help. And since version 7.0 is out .. thats also new ground to cover :)

@kenyon kenyon added the bug Something isn't working label Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants