Open StCyr opened 6 months ago
This is problematic when you run etcdctl with cron and you want to receive a mail from the cronjob only when an error occured.
I agree with you on the stderr aspect. If you're interested in some workaround to make the admin live easier, etcdutl snapshot status <file of previously taken snapshot>
adheres to that better.
Just picking some random invalid file:
$ etcdutl snapshot status 5ac.snap >/dev/null Error: invalid database $ echo $? 130
It will also not output any info logs on success:
$ etcdutl snapshot status ddump/member/snap/db >/dev/null $ echo $? 0
That's what we do in our backup scripts in OpenShift at least, take a snapshot, then gate the success on the status output.
cc @moficodes
etcdctl
commands?Now, #17510 is aiming to address the issue for all of the etcdctl
commands. I suggest reaching a conclusion on what we want to do here before we move forward with the PR.
Bug report criteria
What happened?
I run
etcdctl --endpoints=https://[127.0.0.1]:2379 --cacert=/etc/kubernetes/pki/etcd/ca.crt --cert=/etc/kubernetes/pki/etcd/server.crt --key=/etc/kubernetes/pki/etcd/server.key snapshot save /var/lib/etcd/backups/etcd-$(date +"%Y-%m-%d").db >/dev/null
I get this:
What did you expect to happen?
I was expecting no output
How can we reproduce it (as minimally and precisely as possible)?
run
etcdctl --endpoints=https://[127.0.0.1]:2379 --cacert=/etc/kubernetes/pki/etcd/ca.crt --cert=/etc/kubernetes/pki/etcd/server.crt --key=/etc/kubernetes/pki/etcd/server.key snapshot save /var/lib/etcd/backups/etcd-$(date +"%Y-%m-%d").db >/dev/null
Anything else we need to know?
This is problematic because in order to have a quiet run I need to run:
etcdctl --endpoints=https://[127.0.0.1]:2379 --cacert=/etc/kubernetes/pki/etcd/ca.crt --cert=/etc/kubernetes/pki/etcd/server.crt --key=/etc/kubernetes/pki/etcd/server.key snapshot save /var/lib/etcd/backups/etcd-$(date +"%Y-%m-%d").db >/dev/null 2>&1
which will suppress error messages too.
I believe programs should adhere to the following:
Now, etcdctl does the following:
This is problematic when you run etcdctl with cron and you want to receive a mail from the cronjob only when an error occured.
Etcd version (please run commands below)
Etcd configuration (command line flags or environment variables)
Etcd debug information (please run commands below, feel free to obfuscate the IP address or FQDN in the output)
Relevant log output
No response