goharbor / goharbor/harbor-cli
[bug]: replication policies update prints unexpected output before performing the update
- Dominant language
- Go
- Stars
- 163
- Forks
- 211
- Avg merge
- 1m
- Merged PRs (30d)
- 1
Description
## Description
The `harbor replication policies update` command prints an additional stdout message before calling the update API:
```text
Updated policy replicate deletion:
```
This output is produced unconditionally before `api.UpdateReplicationPolicy()` is invoked and is separate from the command's intended success or error messages.
## Steps to Reproduce
1. Run the replication policy update command:
```bash
harbor replication policies update
```
2. Complete the update flow.
3. Observe that the following line is printed before the update completes:
```text
Updated policy replicate deletion:
```
## Expected Behavior
The command should only print its intended success or error messages.
## Actual Behavior
An additional line containing the internal `ReplicateDeletion` value is printed before the update is attempted.
## Environment
- OS: Windows 10
- Harbor CLI: Latest `main` branch
- Go version: go1.26.4 windows/amd64
## Additional Context
The output originates from the following statement in:
`cmd/harbor/root/replication/policies/update.go`
```go
fmt.Println("Updated policy replicate deletion:", createView.ReplicateDeletion)
```
Removing this statement would eliminate the unexpected output while leaving the update logic unchanged.
Contributor guide
Research direction
Start in cmd/harbor/root/replication/policies/update.go and inspect the fmt.Println statement that exposes createView.ReplicateDeletion before api.UpdateReplicationPolicy() runs. Verify the command retains its intended success and error messages without the extra stdout line, while leaving the update logic unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 90/100