Browse Source

Fix incorrect error handling in bitseq constructor

- We must ignore key not found error when querying
  datastore for initial state.
- Regression introduced by 04bd8f67ad8bcd96e6c9ddf49745d9eea1eae7aa

Signed-off-by: Alessandro Boch <aboch@docker.com>
Alessandro Boch 10 years ago
parent
commit
8c3c747c62
1 changed files with 2 additions and 3 deletions
  1. 2 3
      libnetwork/bitseq/sequence.go

+ 2 - 3
libnetwork/bitseq/sequence.go

@@ -55,12 +55,11 @@ func NewHandle(app string, ds datastore.DataStore, id string, numElements uint32
 	h.watchForChanges()
 	h.watchForChanges()
 
 
 	// Get the initial status from the ds if present.
 	// Get the initial status from the ds if present.
-	err := h.store.GetObject(datastore.Key(h.Key()...), h)
-	if err != datastore.ErrKeyNotFound {
+	if err := h.store.GetObject(datastore.Key(h.Key()...), h); err != nil && err != datastore.ErrKeyNotFound {
 		return nil, err
 		return nil, err
 	}
 	}
 
 
-	return h, err
+	return h, nil
 }
 }
 
 
 // Sequence reresents a recurring sequence of 32 bits long bitmasks
 // Sequence reresents a recurring sequence of 32 bits long bitmasks