saltstack / pepper

A library and stand-alone CLI tools to access a salt-api instance
Other
247 stars 124 forks source link

Sometimes .peppercache gets corrupted #128

Closed vitaliyf closed 6 years ago

vitaliyf commented 6 years ago

We noticed that sometimes ~/.peppercache gets corrupted, and running pepper results in:

Unable to load login token from /home/username/.peppercache Extra data: line 1 column 250 - line 1 column 260 (char 249 - 259)

It looks like this is because new, shorter contents are written on top of old, longer file. I haven't quite caught how this happens (I suspect it may be if you run pepper multiple time simultaneously) but likely we should just delete .peppercache if it's corrupt.

Corrupt file looks something like:

{"perms": [".*", "@wheel", "@runner", "@jobs", "@runner", {"redacted.example.com":
["test.*", "state.*"]}], "start": 1521040976.116944, "token": "0b271bfredacted",
"expire": 1521084176.116946, "user": "some.user", "eauth": "pam"}e.user",
"eauth": "pam"}