Skip to content
Browse files

Fix schema and init code

  • Loading branch information...
1 parent 92deefe commit bacb4001f42d514debe4af8c73d2eacb70ce5f89 @cloudhead cloudhead committed Oct 25, 2012
Showing with 3 additions and 16 deletions.
  1. +0 −9 schema.go
  2. +1 −1 schema_test.go
  3. +2 −6 visor.go
View
9 schema.go
@@ -48,15 +48,6 @@ func SetSchemaVersion(s Snapshot, version int) (newSnapshot Snapshot, err error)
}
func verifySchemaVersion(s Snapshot, version int) (int, error) {
- exists, _, err := s.exists(schemaPath)
- if err != nil {
- return -1, err
- }
-
- if !exists {
- return -1, ErrSchemaMism
- }
-
value, _, err := s.get(schemaPath)
if err != nil {
return -1, err
View
2 schema_test.go
@@ -37,7 +37,7 @@ func TestSchemaMissing(t *testing.T) {
s = cleanSchemaVersion(s, t)
- if _, err := VerifySchema(s); err != ErrSchemaMism {
+ if _, err := VerifySchema(s); !IsErrNoEnt(err) {
if err == nil {
t.Error("missing schema version did not error out")
} else {
View
8 visor.go
@@ -56,28 +56,24 @@ const (
type InsStatus string
func Init(s Snapshot) (rev int64, err error) {
- var s1 Snapshot
-
exists, _, err := s.conn.Exists(nextPortPath)
if err != nil {
return
}
if !exists {
- s1, err = s.set(nextPortPath, strconv.Itoa(startPort))
+ s, err = s.set(nextPortPath, strconv.Itoa(startPort))
if err != nil {
return
}
-
- return s1.Rev, err
}
s, err = SetSchemaVersion(s, SchemaVersion)
if err != nil {
return
}
- return s.conn.Rev()
+ return s.Rev, nil
}
func ClaimNextPort(s Snapshot) (port int, err error) {

0 comments on commit bacb400

Please sign in to comment.
Something went wrong with that request. Please try again.