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:
committed by
Ta-Ching Chen
parent
cdcc6fb3ab
commit
adceee1be0
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user