Skip to content

Fix CNS logs bytes when printing HNS Endpoint #3671

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ vendor/
# Binaries
out/*
output/*
cns/service/service

# Artifacts
azure-*.json
Expand Down
13 changes: 10 additions & 3 deletions cns/hnsclient/hnsclient_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,10 @@

endpoint.IpConfigurations = append(endpoint.IpConfigurations, ipConfiguration)

logger.Printf("[Azure CNS] Configured HostNCApipaEndpoint: %+v", endpoint)
logger.Printf("[Azure CNS] Configured HostNCApipaEndpoint with ID: %s, Name: %s, Network: %s",
endpoint.Id, endpoint.Name, endpoint.HostComputeNetwork)
logger.Printf("[Azure CNS] Endpoint IpConfigurations:%v, Dns:%v, Routes:%v, MacAddress:%s, Flags:%d",
endpoint.IpConfigurations, endpoint.Dns, endpoint.Routes, endpoint.MacAddress, endpoint.Flags)

return endpoint, nil
}
Expand Down Expand Up @@ -677,10 +680,14 @@
}

if err = endpoint.Delete(); err != nil {
return fmt.Errorf("Failed to delete endpoint: %+v. Error: %v", endpoint, err)
return fmt.Errorf("Failed to delete endpoint: %s (%s). Error: %v",

Check failure on line 683 in cns/hnsclient/hnsclient_windows.go

View workflow job for this annotation

GitHub Actions / Lint (1.23.x, windows-latest)

do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf(\"Failed to delete endpoint: %s (%s). Error: %v\",\n\tendpoint.Name, endpoint.Id, err)" (err113)

Check failure on line 683 in cns/hnsclient/hnsclient_windows.go

View workflow job for this annotation

GitHub Actions / Lint (1.22.x, windows-latest)

do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf(\"Failed to delete endpoint: %s (%s). Error: %v\",\n\tendpoint.Name, endpoint.Id, err)" (err113)
endpoint.Name, endpoint.Id, err)

Check failure on line 684 in cns/hnsclient/hnsclient_windows.go

View workflow job for this annotation

GitHub Actions / Lint (1.23.x, windows-latest)

non-wrapping format verb for fmt.Errorf. Use `%w` to format errors (errorlint)

Check failure on line 684 in cns/hnsclient/hnsclient_windows.go

View workflow job for this annotation

GitHub Actions / Lint (1.22.x, windows-latest)

non-wrapping format verb for fmt.Errorf. Use `%w` to format errors (errorlint)
}

logger.Errorf("[Azure CNS] Successfully deleted endpoint: %+v", endpoint)
logger.Errorf("[Azure CNS] Successfully deleted endpoint with ID: %s, Name: %s",
endpoint.Id, endpoint.Name)
logger.Debugf("[Azure CNS] Endpoint details - IpConfigurations:%v, Dns:%v, Routes:%v, MacAddress:%s, Flags:%d",
endpoint.IpConfigurations, endpoint.Dns, endpoint.Routes, endpoint.MacAddress, endpoint.Flags)

return nil
}
Expand Down
Loading