[ARVADOS] updated: b08f16445f02a02ea9246094657e93b354999b38

git at public.curoverse.com git at public.curoverse.com
Tue May 13 14:25:50 EDT 2014


Summary of changes:
 services/keep/src/keep/keep.go | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

       via  b08f16445f02a02ea9246094657e93b354999b38 (commit)
      from  3e6368d077fa4831f93255e271a18842788183fb (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 b08f16445f02a02ea9246094657e93b354999b38
Author: Tim Pierce <twp at curoverse.com>
Date:   Tue May 13 14:25:37 2014 -0400

    2328: more 80-column fixes

diff --git a/services/keep/src/keep/keep.go b/services/keep/src/keep/keep.go
index 8219fc1..11e8ee1 100644
--- a/services/keep/src/keep/keep.go
+++ b/services/keep/src/keep/keep.go
@@ -209,7 +209,8 @@ func main() {
 	// Initialize permission TTL
 	permission_ttl = time.Duration(permission_ttl_sec) * time.Second
 
-	// If --enforce-permissions is true, we must have a permission key to continue.
+	// If --enforce-permissions is true, we must have a permission key
+	// to continue.
 	if enforce_permissions && PermissionSecret == nil {
 		log.Fatal("--enforce-permissions requires a permission key")
 	}
@@ -231,7 +232,8 @@ func main() {
 //
 func NewRESTRouter() *mux.Router {
 	rest := mux.NewRouter()
-	rest.HandleFunc(`/{hash:[0-9a-f]{32}}`, GetBlockHandler).Methods("GET", "HEAD")
+	rest.HandleFunc(
+		`/{hash:[0-9a-f]{32}}`, GetBlockHandler).Methods("GET", "HEAD")
 	rest.HandleFunc(
 		`/{hash:[0-9a-f]{32}}+A{signature:[0-9a-f]+}@{timestamp:[0-9a-f]+}`,
 		GetBlockHandler).Methods("GET", "HEAD")
@@ -259,7 +261,8 @@ func FindKeepVolumes() []string {
 		for scanner.Scan() {
 			args := strings.Fields(scanner.Text())
 			dev, mount := args[0], args[1]
-			if (dev == "tmpfs" || strings.HasPrefix(dev, "/dev/")) && mount != "/" {
+			if mount != "/" &&
+				(dev == "tmpfs" || strings.HasPrefix(dev, "/dev/")) {
 				keep := mount + "/keep"
 				if st, err := os.Stat(keep); err == nil && st.IsDir() {
 					vols = append(vols, keep)
@@ -287,9 +290,12 @@ func GetBlockHandler(w http.ResponseWriter, req *http.Request) {
 		} else if IsExpired(timestamp) {
 			http.Error(w, ExpiredError.Error(), ExpiredError.HTTPCode)
 			return
-		} else if signature != MakePermSignature(hash, GetApiToken(req), timestamp) {
-			http.Error(w, PermissionError.Error(), PermissionError.HTTPCode)
-			return
+		} else {
+			validsig := MakePermSignature(hash, GetApiToken(req), timestamp)
+			if signature != validsig {
+				http.Error(w, PermissionError.Error(), PermissionError.HTTPCode)
+				return
+			}
 		}
 	}
 
@@ -516,8 +522,8 @@ func PutBlock(block []byte, hash string) error {
 	// If we already have a block on disk under this identifier, return
 	// success (but check for MD5 collisions).
 	// The only errors that GetBlock can return are ErrCorrupt and ErrNotFound.
-	// In either case, we want to write our new (good) block to disk, so there is
-	// nothing special to do if err != nil.
+	// In either case, we want to write our new (good) block to disk,
+	// so there is nothing special to do if err != nil.
 	if oldblock, err := GetBlock(hash); err == nil {
 		if bytes.Compare(block, oldblock) == 0 {
 			return nil

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list