Skip to content

Commit

Permalink
fix regexp and err msg
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmasi committed Apr 11, 2024
1 parent 217cf98 commit 2a4dd0a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
/go.work.sum
**/super-linter.log
kne_cli/kne_cli
kne_cli/kne
controller/server/server
x/webhook/webhook
4 changes: 2 additions & 2 deletions controller/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import (
)

var (
kubeadmTokenRE = regexp.MustCompile("^kubeadm join (.+) --token (.+) --discovery-token-ca-cert-hash (.+)$")
kubeadmTokenRE = regexp.MustCompile(`^kubeadm join ([0-9A-Za-z\.:]+) --token ([0-9A-Za-z\.]+) --discovery-token-ca-cert-hash ([0-9A-Za-z:]+)`)

defaultKubeCfg = ""
defaultTopoBasePath = ""
Expand Down Expand Up @@ -375,7 +375,7 @@ func (s *server) ShowCluster(ctx context.Context, req *cpb.ShowClusterRequest) (
}
matches := kubeadmTokenRE.FindStringSubmatch(string(out))
if len(matches) != 4 {
return nil, status.Errorf(codes.Internal, "failed to parse kubeadm cluster token: %v", err)
return nil, status.Errorf(codes.Internal, "failed to parse kubeadm cluster token from %q (matches %v)", string(out), matches)
}
resp.ApiServerEndpoint = matches[1]
resp.Token = matches[2]
Expand Down

0 comments on commit 2a4dd0a

Please sign in to comment.