From 205033d25ff54d56c25260ee75636189450a5c7c Mon Sep 17 00:00:00 2001 From: Gyu-Ho Lee Date: Fri, 12 Feb 2016 16:37:04 -0800 Subject: [PATCH] etcd-agent: ignore error when no file to rename Fixes https://github.com/coreos/etcd/issues/4512. When cluster fails before creation of log or data directory the file does not exist and cannot be renamed. This skips such error because there's no need to store empty logs in failure_archive. --- tools/functional-tester/etcd-agent/agent.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/functional-tester/etcd-agent/agent.go b/tools/functional-tester/etcd-agent/agent.go index 40935096c..b0b701031 100644 --- a/tools/functional-tester/etcd-agent/agent.go +++ b/tools/functional-tester/etcd-agent/agent.go @@ -194,7 +194,14 @@ func archiveLogAndDataDir(log string, datadir string) error { return err } if err := os.Rename(log, path.Join(dir, log)); err != nil { - return err + if !os.IsNotExist(err) { + return err + } } - return os.Rename(datadir, path.Join(dir, datadir)) + if err := os.Rename(datadir, path.Join(dir, datadir)); err != nil { + if !os.IsNotExist(err) { + return err + } + } + return nil }