myENA / consul-backinator

Command line Consul backup and restore utility supporting KVs, ACLs and Queries
Mozilla Public License 2.0
226 stars 22 forks source link

Unable to restore queries #36

Closed michaelgrosstarget closed 6 years ago

michaelgrosstarget commented 6 years ago

Hello,

I'm able to successfully backup kvs/acls/queries but when I try to restore it seems to only restore the kvs and acls (ignoring the queries).

consul-backinator v1.6.2 consul v0.9.3

# consul-backinator backup -file kvs.bak -acls acls.bak -queries query.bak -key [SECRET] -token [CONSUL_TOKEN]
2017/11/02 21:26:36 [Success] Backed up 1 keys from / to kvs.bak
2017/11/02 21:26:36 [Success] Backed up 3 ACL tokens from  to acls.bak
2017/11/02 21:26:36 [Success] Backed up 1 query definitions from  to query.bak
Keep your backup and signature files in a safe place.
You will need both to restore your data.
# consul-backinator restore -file kvs.bak -acls acls.bak -queries query.bak -key [SECRET] -token [CONSUL_TOKEN]
2017/11/02 21:26:59 [Success] Restored 1 keys from kvs.bak to /
2017/11/02 21:26:59 [Success] Restored 3 ACL tokens from acls.bak to

And if I try specifying only the queries to backup and restore, I'm able to successfully back them up but get an error regarding my command flags when trying to restore.

# consul-backinator backup -nokv -queries query.bak -key [SECRET] -token [CONSUL_TOKEN]
2017/11/02 21:33:41 [Success] Backed up 1 query definitions from  to query.bak
Keep your backup and signature files in a safe place.
You will need both to restore your data.
# consul-backinator restore -nokv -queries query.bak -key [SECRET] -token [CONSUL_TOKEN]
2017/11/02 21:33:54 [Error] Passing 'nokv' and an empty 'acls' file doesn't make any sense.  You should specify an 'acls' file when using the 'nokv' option.

Am I missing something in my command syntax? Or has the restore queries functionality not been fully implemented yet?

Thank you, Mike

aaronhurt commented 6 years ago

Good question, let me take a look.

aaronhurt commented 6 years ago

You're absolutely right, I added query backup but never put in the hook for the restore command even though I built a restoreQueries function. I've fixed this locally and will push it upstream shortly.

michaelgrosstarget commented 6 years ago

Thanks Aaron. Appreciate the quick response.

aaronhurt commented 6 years ago

@michaelgrosstarget let me know if that fixes the issue ... feel free to reopen if it does not.

aaronhurt commented 6 years ago

I can also roll an intermediate release if you need a binary to download.

michaelgrosstarget commented 6 years ago

Works great - thanks again Aaron!