etcdctl.sh.j2 864 B

12345678910111213141516171819202122
  1. #!/bin/bash
  2. # Sets up handy aliases for etcd, need etcdctl2 and etcdctl3 because
  3. # command flags are different between the two. Should work on stand
  4. # alone etcd hosts and master + etcd hosts too because we use the peer keys.
  5. etcdctl2() {
  6. cmd="ETCDCTL_API=2 etcdctl --cert-file {{ etcd_peer_cert_file }} --key-file {{ etcd_peer_key_file }} --ca-file {{ etcd_peer_ca_file }} -C https://`hostname`:2379 ${@}"
  7. if [[ -f /usr/local/bin/master-exec ]]; then
  8. /usr/local/bin/master-exec etcd etcd /bin/sh -c "$cmd"
  9. else
  10. /bin/sh -c "$cmd"
  11. fi
  12. }
  13. etcdctl3() {
  14. cmd="ETCDCTL_API=3 etcdctl --cert {{ etcd_peer_cert_file }} --key {{ etcd_peer_key_file }} --cacert {{ etcd_peer_ca_file }} --endpoints https://`hostname`:2379 ${@}"
  15. if [[ -f /usr/local/bin/master-exec ]]; then
  16. /usr/local/bin/master-exec etcd etcd /bin/sh -c "$cmd"
  17. else
  18. /bin/sh -c "$cmd"
  19. fi
  20. }