Skip to content

Commit

Permalink
user switch object to get annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
pau-hedgehog authored and Frostman committed Dec 12, 2024
1 parent d62c18e commit c5c0e80
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions pkg/hhfctl/switch.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,21 +238,7 @@ func GetSerialInfo(sw *wiringapi.Switch) string {
return ""
}

func GetPowerInfo(ctx context.Context, swName string) map[string]string {
kube, err := kubeutil.NewClient(ctx, "", wiringapi.SchemeBuilder)
if err != nil {
fmt.Println("\tError creating kube client %w", err)

return nil
}

sw := &wiringapi.Switch{}
if err := kube.Get(ctx, client.ObjectKey{Name: swName, Namespace: metav1.NamespaceDefault}, sw); err != nil {
fmt.Printf("\tError getting switch %s: %v\n", swName, err)

return nil
}

func GetPowerInfo(sw *wiringapi.Switch) map[string]string {
powerInfo := make(map[string]string)
if annotations := sw.GetAnnotations(); annotations != nil {
for key, value := range annotations {
Expand Down

0 comments on commit c5c0e80

Please sign in to comment.