[ARVADOS] updated: 51c1390ce92353a4fcf1adfe3643729eff5d6a8a

git at public.curoverse.com git at public.curoverse.com
Wed Apr 16 13:44:28 EDT 2014


Summary of changes:
 services/keep/keep.go |   25 +++++++++++++++++--------
 1 files changed, 17 insertions(+), 8 deletions(-)

       via  51c1390ce92353a4fcf1adfe3643729eff5d6a8a (commit)
      from  b346f8754f5d4840ad80aa97bd910f3a6844b413 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 51c1390ce92353a4fcf1adfe3643729eff5d6a8a
Author: Tim Pierce <twp at curoverse.com>
Date:   Wed Apr 16 13:45:22 2014 -0400

    Check that specified Keep volumes actually exist.
    
    Incorporates code review for #2449. Refs #2561.

diff --git a/services/keep/keep.go b/services/keep/keep.go
index 91cddcb..74c3b15 100644
--- a/services/keep/keep.go
+++ b/services/keep/keep.go
@@ -88,29 +88,38 @@ func main() {
 	//    by looking at currently mounted filesystems for /keep top-level
 	//    directories.
 
-	var listen, keepvols string
+	var listen, volumearg string
 	flag.StringVar(&listen, "listen", DEFAULT_ADDR,
 		"interface on which to listen for requests, in the format ipaddr:port. e.g. -listen=10.0.1.24:8000. Use -listen=:port to listen on all network interfaces.")
-	flag.StringVar(&keepvols, "volumes", "",
+	flag.StringVar(&volumearg, "volumes", "",
 		"Comma-separated list of directories to use for Keep volumes, e.g. -volumes=/var/keep1,/var/keep2. If empty or not supplied, Keep will scan mounted filesystems for volumes with a /keep top-level directory.")
 	flag.Parse()
 
 	// Look for local keep volumes.
-	if keepvols == "" {
+	var keepvols []string
+	if volumearg == "" {
 		// TODO(twp): decide whether this is desirable default behavior.
 		// In production we may want to require the admin to specify
 		// Keep volumes explicitly.
-		KeepVolumes = FindKeepVolumes()
+		keepvols = FindKeepVolumes()
 	} else {
-		KeepVolumes = strings.Split(keepvols, ",")
+		keepvols = strings.Split(volumearg, ",")
+	}
+
+	// Check that the specified volumes actually exist.
+	KeepVolumes = []string(nil)
+	for _, v := range keepvols {
+		if _, err := os.Stat(v); err == nil {
+			log.Println("adding Keep volume:", v)
+			KeepVolumes = append(KeepVolumes, v)
+		} else {
+			log.Printf("bad Keep volume: %s\n", err)
+		}
 	}
 
 	if len(KeepVolumes) == 0 {
 		log.Fatal("could not find any keep volumes")
 	}
-	for _, v := range KeepVolumes {
-		log.Println("keep volume:", v)
-	}
 
 	// Set up REST handlers.
 	//

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list