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

etcdctl get option for escaping unprintable bytes #10102

Closed
vorburger opened this issue Sep 18, 2018 · 6 comments
Closed

etcdctl get option for escaping unprintable bytes #10102

vorburger opened this issue Sep 18, 2018 · 6 comments

Comments

@vorburger
Copy link
Member

During local testing, I've used etcdctl ls -r just wanting to see if it "had any entries" (and perhaps like wc -l them), and realized, after some confusion, that etcdctl ls seems to just silently skip any keys with unprintable characters?

Perhaps it could instead (have an option to) print them with some sort of escaping.

See also etcd-io/jetcd#399.

@hexfusion
Copy link
Contributor

hexfusion commented Sep 18, 2018

Hi @vorburger for v3 we use something like ETCDCTL_API=3 etcdctl get --from-key '' does this output as expected? My understanding is that jetcd is the official java client for etcd v3 so this would be a more proper comparison.

@hexfusion
Copy link
Contributor

hexfusion commented Sep 18, 2018

For just keys ETCDCTL_API=3 etcdctl get --from-key '' --keys-only

vorburger added a commit to vorburger/opendaylight-etcd that referenced this issue Sep 18, 2018
@vorburger
Copy link
Member Author

@hexfusion indeed using ETCDCTL_API=3 etcdctl get --from-key '' instead of etcdctl ls -r prints all.

It's "binary" though.. but I guess one could pipe it into some suitable tool - e.g. ETCDCTL_API=3 etcdctl get --from-key '' | od -c, although that is far more verbose than some kind of simpler "KV-per-line with any non-printable characters escaped" kind of output format, as proposed in etcd-io/jetcd#399. BTW, for any external UNIX piped utility it's probably not possible to distinguish separate KVs from CR/LF bytes in keys and values.

PS: Shouldn't ETCDCTL_API=3 become the default at some point?

@vorburger vorburger changed the title etcdctl ls seems to silently skip KVs with unprintable characters, instead of showing them with some sort of escaping etcdctl get option for escaping unprintable bytes Sep 18, 2018
@hexfusion
Copy link
Contributor

PS: Shouldn't ETCDCTL_API=3 become the default at some point?

Yes sir, v3.4 #9600

vorburger added a commit to vorburger/opendaylight-etcd that referenced this issue Sep 18, 2018
@hexfusion
Copy link
Contributor

It's "binary" though.. but I guess one could pipe it into some suitable tool

We also have --hex flag. etcdctl get --from-key '' --hex

Do you have any further questions? Could you give an example of problematic data?

@vorburger
Copy link
Member Author

Let's close this (the --hex is good enough).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants