File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed
Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -398,10 +398,12 @@ func (vm VM) GetResourceActionDiscovery(obj *unstructured.Unstructured) ([]strin
398398 // Fetch predefined Lua scripts
399399 discoveryKey := fmt .Sprintf ("%s/actions/" , key )
400400 discoveryScript , err := vm .getPredefinedLuaScripts (discoveryKey , actionDiscoveryScriptFile )
401-
402- // Ignore the error if the script does not exist.
403- var doesNotExistErr * ScriptDoesNotExistError
404- if err != nil && ! errors .As (err , & doesNotExistErr ) {
401+ if err != nil {
402+ var doesNotExistErr * ScriptDoesNotExistError
403+ if errors .As (err , & doesNotExistErr ) {
404+ // No worries, just return what we have.
405+ return discoveryScripts , nil
406+ }
405407 return nil , fmt .Errorf ("error while fetching predefined lua scripts: %w" , err )
406408 }
407409
Original file line number Diff line number Diff line change @@ -325,7 +325,7 @@ func TestGetResourceActionDiscoveryNoPredefined(t *testing.T) {
325325 vm := VM {}
326326 discoveryLua , err := vm .GetResourceActionDiscovery (testObj )
327327 require .NoError (t , err )
328- assert .Equal (t , "" , discoveryLua [ 0 ] )
328+ assert .Empty (t , discoveryLua )
329329}
330330
331331func TestGetResourceActionDiscoveryWithOverride (t * testing.T ) {
You can’t perform that action at this time.
0 commit comments