From 4a2269280673d26ff7cf20b5154860835fb4e4dc Mon Sep 17 00:00:00 2001 From: Michael Persson Date: Mon, 21 Sep 2015 16:23:59 +0200 Subject: [PATCH] Added delete flag for etcd-import --- src/github.com/mickep76/etcd-import/etcd-import.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/github.com/mickep76/etcd-import/etcd-import.go b/src/github.com/mickep76/etcd-import/etcd-import.go index 282e2e1..7a3e25b 100644 --- a/src/github.com/mickep76/etcd-import/etcd-import.go +++ b/src/github.com/mickep76/etcd-import/etcd-import.go @@ -25,6 +25,7 @@ func main() { // Options. version := flag.Bool("version", false, "Version") + delete := flag.Bool("delete", false, "Delete entry before import") node := flag.String("node", "", "Etcd node") port := flag.String("port", "2379", "Etcd port") dir := flag.String("dir", "/", "Etcd directory") @@ -74,6 +75,10 @@ func main() { log.Fatal("No input provided") } + if *delete { + client.Delete(strings.TrimRight(*dir, "/"), true) + } + if err = etcdmap.Create(client, strings.TrimRight(*dir, "/"), reflect.ValueOf(m)); err != nil { log.Fatal(err.Error()) }