Skip to content

Commit

Permalink
fix crash when no beta policies are generated (#7)
Browse files Browse the repository at this point in the history
Signed-off-by: Yangmin Zhu <ymzhu@google.com>
  • Loading branch information
yangminzhu authored Jul 28, 2021
1 parent 788bead commit cae7646
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ build:
@go build -ldflags="-s -w -X main.version=$(shell ./get-version.sh)" -o out/convert *.go

test:
@go test -v $(go list ./... | grep -v /e2e)
@go list ./... | grep -v /e2e | xargs go test -v

e2e:
go test -v ./e2e/...
Expand Down
4 changes: 4 additions & 0 deletions k8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ func (kc *kubeClient) convert() error {
}
}

if len(betaPolicyOutput) == 0 {
fmt.Printf("generated 0 beta policies")
return nil
}
if perNamespace != "" {
for ns, out := range betaPolicyOutput {
filename := fmt.Sprintf("%s/ns-%s.yaml", perNamespace, ns)
Expand Down

0 comments on commit cae7646

Please sign in to comment.