VOL-1437 : Fix display of devices in CLI
Renamed state field in image download proto which caused
json marshalling to fail.
other updates
- unmarshal data properly when pulling data from kv in watch
- do not update unecessarily if watch data matches data in memory
- added ofagent target to python Makefile
- fixed grpc path to update log level which interfered with getdevice
Change-Id: I4fceeb539c3325b6754efe2b68251d83b7367211
diff --git a/db/model/non_persisted_revision.go b/db/model/non_persisted_revision.go
index 765bbaf..27d3d9a 100644
--- a/db/model/non_persisted_revision.go
+++ b/db/model/non_persisted_revision.go
@@ -250,9 +250,9 @@
npr.mutex.Lock()
defer npr.mutex.Unlock()
- if npr.Config.Data != nil && npr.Config.Data == data {
+ if npr.Config.Data != nil && npr.Config.hashData(npr.Root, data) == npr.Config.Hash {
log.Debugw("stored-data-matches-latest", log.Fields{"stored": npr.Config.Data, "provided": data})
- return nil
+ return npr
}
newRev := NonPersistedRevision{}
@@ -285,10 +285,13 @@
existChildMap[child.GetHash()] = i
}
- // Identify the revisions that are not present in the existing list and add them
for _, newChild := range children {
if _, childExists := existChildMap[newChild.GetHash()]; !childExists {
+ // revision is not present in the existing list... add it
updatedRev.Children[name] = append(updatedRev.Children[name], newChild)
+ } else {
+ // replace
+ updatedRev.Children[name][existChildMap[newChild.GetHash()]] = newChild
}
}
} else {