Skip to content
Snippets Groups Projects
Commit 0fe4035b authored by Malte Bauch's avatar Malte Bauch
Browse files

Compare the manifest files instead of hashes

parent ec63f141
No related branches found
No related tags found
1 merge request!690Add a file storage to plugin registry
Pipeline #177964 passed
[{"id":"e2c358b3-6482-4010-b0d8-679dff73153b","path":"plugins/arista/bundled_plugin.zip","hash":"h1:+ORKoJds8/v25xH4uvd3pPqa1eIs6JXHw/Ef4HMtG6A=","manifest":{"name":"Arista","firmware":"standard","author":"goSDN-Team","version":"1.0.0"}},{"id":"d1c269a2-6482-4010-b0d8-679dff73153b","path":"plugins/openconfig/bundled_plugin.zip","hash":"h1:FpK0b9SSrly8IJMfhbgt/Q8k3f4V5tRlIEX7K9btMrI=","manifest":{"name":"Openconfig","firmware":"standard","author":"goSDN-Team","version":"1.0.0"}}]
[{"id":"e2c358b3-6482-4010-b0d8-679dff73153b","path":"plugins/arista/bundled_plugin.zip","manifest":{"name":"Arista","firmware":"standard","author":"goSDN-Team","version":"1.0.0"}},{"id":"d1c269a2-6482-4010-b0d8-679dff73153b","path":"plugins/openconfig/bundled_plugin.zip","manifest":{"name":"Openconfig","firmware":"standard","author":"goSDN-Team","version":"1.0.0"}}]
......@@ -11,7 +11,6 @@ import (
"code.fbi.h-da.de/danet/gosdn/controller/interfaces/plugin"
"code.fbi.h-da.de/danet/gosdn/controller/nucleus/util"
"github.com/google/uuid"
"golang.org/x/mod/sumdb/dirhash"
"google.golang.org/grpc"
)
......@@ -66,15 +65,9 @@ func registerPlugins() *PluginRegistry {
panic(err)
}
zipPath := filepath.Join(dirPath, util.BundledPluginName)
zipHashed, err := dirhash.HashZip(zipPath, dirhash.DefaultHash)
if err != nil {
panic(err)
}
var plugin *Plugin
for i, p := range plugins {
if p.Hash == zipHashed {
if *p.Manifest == *manifest {
plugin = p
plugins[i] = plugins[len(plugins)-1]
plugins = plugins[:len(plugins)-1]
......@@ -86,7 +79,6 @@ func registerPlugins() *PluginRegistry {
plugin = &Plugin{
ID: uuid.New(),
Path: filepath.Join(dirPath, util.BundledPluginName),
Hash: zipHashed,
Manifest: manifest,
}
}
......
......@@ -11,7 +11,6 @@ import (
type Plugin struct {
ID uuid.UUID `json:"id,omitempty"`
Path string `json:"path,omitempty"`
Hash string `json:"hash,omitempty"`
Manifest *plugin.Manifest `json:"manifest,omitempty"`
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment