Skip to content

Commit

Permalink
argument mismatch fix, undefined instance fix, correct GetClientForMa…
Browse files Browse the repository at this point in the history
…nagedCluster to GetClientForCluster
  • Loading branch information
AdamSadek committed May 14, 2024
1 parent 2a6c3c5 commit 3ce2647
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
25 changes: 15 additions & 10 deletions internal/commands/loglevel/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,19 @@ Description:
return updateDebuggingConfigurationInManaged(ctx, logSeverity, component, namespace, clusterName, clusterType)
}

instance := utils.GetAccessInstance()
dc, err := instance.GetDebuggingConfiguration(ctx)
if err != nil {
if apierrors.IsNotFound(err) {
return fmt.Errorf("DebuggingConfiguration not found")
}
return err
}

return updateDebuggingConfiguration(ctx, logSeverity, component, dc)
instance := utils.GetAccessInstance()
dc, err := instance.GetDebuggingConfiguration(ctx)
if err != nil {
if apierrors.IsNotFound(err) {
return fmt.Errorf("DebuggingConfiguration not found")
}
return err
}

cc, err := collectLogLevelConfiguration(ctx, dc) // pass dc
if err != nil {

Check failure on line 146 in internal/commands/loglevel/set.go

View workflow job for this annotation

GitHub Actions / build-static-test

cc declared and not used

Check failure on line 146 in internal/commands/loglevel/set.go

View workflow job for this annotation

GitHub Actions / build-static-test

cc declared and not used

Check failure on line 146 in internal/commands/loglevel/set.go

View workflow job for this annotation

GitHub Actions / build-ut

cc declared and not used

Check failure on line 146 in internal/commands/loglevel/set.go

View workflow job for this annotation

GitHub Actions / build-ut

cc declared and not used
return err
}

return updateLogLevelConfiguration(ctx, spec, dc) // Pass dc
}

Check failure on line 151 in internal/commands/loglevel/set.go

View workflow job for this annotation

GitHub Actions / build-static-test

undefined: spec

Check failure on line 151 in internal/commands/loglevel/set.go

View workflow job for this annotation

GitHub Actions / build-static-test

undefined: spec

Check failure on line 151 in internal/commands/loglevel/set.go

View workflow job for this annotation

GitHub Actions / build-ut

undefined: spec

Check failure on line 151 in internal/commands/loglevel/set.go

View workflow job for this annotation

GitHub Actions / build-ut

undefined: spec
3 changes: 2 additions & 1 deletion internal/commands/loglevel/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ func updateLogLevelConfiguration(
Configuration: spec,
}

instance := utils.GetAccessInstance() // Define instance
return instance.UpdateDebuggingConfiguration(ctx, dc)
}

Expand All @@ -80,7 +81,7 @@ func updateDebuggingConfigurationInManaged(
) error {
// get a client for the managed cluster using namespace, clusterName, and clusterType
instance := utils.GetAccessInstance()
client, err := instance.GetClientForCluster(namespace, clusterName, clusterType)
client, err := instance.GetClientForCluster(namespace, clusterName, clusterType) // Correct method name

Check failure on line 84 in internal/commands/loglevel/utils.go

View workflow job for this annotation

GitHub Actions / build-static-test

instance.GetClientForCluster undefined (type *utils.k8sAccess has no field or method GetClientForCluster)

Check failure on line 84 in internal/commands/loglevel/utils.go

View workflow job for this annotation

GitHub Actions / build-ut

instance.GetClientForCluster undefined (type *utils.k8sAccess has no field or method GetClientForCluster)
if err != nil {
return err
}
Expand Down

0 comments on commit 3ce2647

Please sign in to comment.