0

I am trying to create a sensu stash using the cli as such:

sensu cli stash create silence/client

This then gives me a json file to create the stash, I put in my requirements as such:

{
  "path": "silence/client",
  "Content-Type": "application/json",
  "content": {
    "reason": "reason here",
    "source": "uchiwa",
    "timestamp": 1493220469
  }
}

But when i save the file i get this error:

JSON::ParserError: A JSON text must at least contain two octets!

I am not too familiar with json, what does this mean?

zorro1224
  • 73
  • 2
  • 9
  • I just ran this without issues. Which versions of Sensu and sensu-cli are you using? I tested running `Sensu` version `0.12.3` and `sensu-cli` version `0.6.3.2`. The command: `$ sensu-cli stash create "silence/testing"` This prompts for a JSON input, for which I added: `{ "path": "silence/jstest", "Content-Type": "application/json", "content": { "reason": "testing", "source": "uchiwa", "timestamp": 1494331612 } }` And this worked without issue. – vase May 09 '17 at 12:07

1 Answers1

0

As per this question's answer, your json file may have been empty or malformed somehow.

Currently, if you create an empty or malformed json file for a stash, you get the following output from sensu-cli:

sensu-cli stash create 'silence/test'
The stash you created has invalid JSON.
Rebeca Maia
  • 438
  • 4
  • 16