revert changes to etcd systemd drop-in unit
[Service]
-# from the instructions found here:
-# https://coreos.com/etcd/docs/latest/etcd-live-cluster-reconfiguration.html#replace-a-failed-etcd-member-on-coreos-container-linux
+# The current registration procedure for a new member is through a token.
+# Removing the member directory on each app restart causes the instance to
+# fail because it expects the registered token and the instance provides a new
+# one.
-# remove previously created proxy directory
-# ExecStartPre=/usr/bin/rm -rf /var/lib/etcd/proxy
-
-# NOTE: use this option if you would like to re-add broken etcd member into cluster
-# Don't forget to make a backup before
-ExecStartPre=/usr/bin/rm -rf /var/lib/etcd/member /var/lib/etcd/proxy
+# The line below makes sure that if the proxy and member dirs exist
+# simultaneously, the member dir is removed so the instance can start. The
+# default behavior is to fail if both dirs exist.
+# If the etcd member is broken this should be fixed manually by removing both
+# directories and restarting the application.
++ExecStartPre=/bin/bash -c "if [[ -d /var/lib/etcd/proxy ]] && [[ -d /var/lib/etcd/member ]]; then rm -rf /var/lib/etcd/member; fi"
\ No newline at end of file
