Support --plugin parameter in Fission CLI (#1111)

* Added support for --plugin parameter in Fission CLI

This fixes the issue that renaming fission  to fission-XYZ would cause a fork bomb, due to the CLI recursively calling itself to discover plugins.
This commit is contained in:
Erwin van Eyk
2019-03-20 00:15:29 +08:00
committed by Ta-Ching Chen
parent cdcc6fb3ab
commit adceee1be0
2 changed files with 34 additions and 2 deletions
+4 -1
View File
@@ -163,11 +163,14 @@ func fetchPluginMetadata(pluginPath string) (*Metadata, error) {
if err != nil {
return nil, err
}
// Parse metadata if possible
pluginName := strings.TrimPrefix(path.Base(pluginPath), Prefix)
md := &Metadata{}
err = json.Unmarshal(buf.Bytes(), md)
if err != nil {
// If metadata could not be retrieved, or if no name was provided, use the filename of the binary
if err != nil || len(md.Name) == 0 {
md.Name = pluginName
}
md.Path = pluginPath