etcdserver: add publish func

for #1094 
sure, I just personally find it a bit clearer if a `for{}` loop at the end of a function is only broken by `return`s