File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed
pkg/cmd/grafana-cli/services Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -33,11 +33,23 @@ func ListAllPlugins(repoUrl string) (m.PluginRepo, error) {
33
33
}
34
34
35
35
func ReadPlugin (pluginDir , pluginName string ) (m.InstalledPlugin , error ) {
36
- pluginDataPath := path .Join (pluginDir , pluginName , "plugin.json" )
37
- pluginData , _ := IoHelper .ReadFile (pluginDataPath )
36
+ distPluginDataPath := path .Join (pluginDir , pluginName , "dist" , "plugin.json" )
37
+
38
+ var data []byte
39
+ var err error
40
+ data , err = IoHelper .ReadFile (distPluginDataPath )
41
+
42
+ if err != nil {
43
+ pluginDataPath := path .Join (pluginDir , pluginName , "plugin.json" )
44
+ data , err = IoHelper .ReadFile (pluginDataPath )
45
+
46
+ if err != nil {
47
+ return m.InstalledPlugin {}, errors .New ("Could not find dist/plugin.json or plugin.json on " + pluginName + " in " + pluginDir )
48
+ }
49
+ }
38
50
39
51
res := m.InstalledPlugin {}
40
- json .Unmarshal (pluginData , & res )
52
+ json .Unmarshal (data , & res )
41
53
42
54
if res .Info .Version == "" {
43
55
res .Info .Version = "0.0.0"
You can’t perform that action at this time.
0 commit comments