question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Backing up binary data (Written by Hashicorp Vault) fails

See original GitHub issue

I’m getting the following when attempting to run a consulate backup on my consul cluster:

(con)[Tue Nov 03 17:25:50] ~/r/temp/consulate$ consulate --api-host 10.1.15.125 --api-port 8500 kv backup --base64 -f consul_backup.json
Traceback (most recent call last):
  File "/Users/neil1/virtualenvs/con/bin/consulate", line 9, in <module>
    load_entry_point('consulate==0.6.0', 'console_scripts', 'consulate')()
  File "build/bdist.macosx-10.11-intel/egg/consulate/cli.py", line 469, in main
  File "build/bdist.macosx-10.11-intel/egg/consulate/cli.py", line 214, in kv_backup
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/base64.py", line 53, in b64encode
    encoded = binascii.b2a_base64(s)[:-1]
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2014' in position 562: ordinal not in range(128)    

Looks like https://github.com/gmr/consulate/issues/41

Python 2.7.10 Consulate 0.6.0 (Both pip and master)

We’ve tracked the issue to Hashicorp Vault writing binary data.

Using python3.5 we instead get the error:

(test)[Tue Nov 03 17:41:37] ~/r/temp$ consulate --api-host 10.1.15.125 --api-port 8500 kv backup --base64 -f consul_backup.json
Traceback (most recent call last):
  File "/usr/local/bin/consulate", line 11, in <module>
    sys.exit(main())
  File "/Library/Python/2.7/site-packages/consulate/cli.py", line 469, in main
    KV_ACTIONS[args.action](consul, args)
  File "/Library/Python/2.7/site-packages/consulate/cli.py", line 214, in kv_backup
    records = [(k, f, base64.b64encode(v)) for k,f,v in records]
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/base64.py", line 53, in b64encode
    encoded = binascii.b2a_base64(s)[:-1]
TypeError: must be string or buffer, not None

If there’s any other information we can provide please let us know!

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
alexku-ocommented, May 26, 2016

@tyx thanks. I actually tried restore with -b earlier but it was giving me some error. I ended up just using consul-backup because we have a simple backup/restore use case and it works perfectly well for us (and the fact that our test backup/restore worked with consul-backup but not with consulate).

edit: In case it came across that way, my comment here was certainly not in any way to discredit the incredible work that’s been done on consulate. I appreciate a great deal of the work here, and am thankful.

1reaction
alexku-ocommented, May 11, 2016

@ben-nz - using -b like consulate kv backup -b worked for me (following what was suggested in https://github.com/gmr/consulate/issues/41)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error taking snapshot - Vault - HashiCorp Discuss
Sounds like the user you're running the snapshot command from doesn't have read access to the directory where vault is storing it's data....
Read more >
Repairing a Corrupted Hashicorp Vault Policy | by Garrett
Vault crashed and failed over to a standby node. What's interesting is that the new master ended up with a forked policy.
Read more >
store and retrieve files from hashicorp vault - Stack Overflow
It seems that you can specify a file with data in it to store as the value for a key in HashiCorp vault....
Read more >
Binary Backups - Enterprise features - Dgraph
Binary backups are full backups of Dgraph that are backed up directly to cloud ... for Encrypted Backups using encryption keys sitting on...
Read more >
Securely Manage Secrets with HashiCorp Vault - Alibaba Cloud
Vault stores and tightly controls access to tokens, passwords, certificates, encryption keys for protecting secrets and other sensitive data ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found