Skip to content
Open
Changes from 1 commit
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
8 changes: 6 additions & 2 deletions agent/backend/pktvisor/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"bytes"
"fmt"
"net/http"
"strings"

"github.com/orb-community/orb/agent/policies"
"go.uber.org/zap"
Expand Down Expand Up @@ -60,8 +61,11 @@ func (p *pktvisorBackend) RemovePolicy(data policies.PolicyData) error {
} else {
name = data.Name
}
err := p.request(fmt.Sprintf("policies/%s", name), &resp, http.MethodDelete, http.NoBody, "application/json", RemovePolicyTimeout)
if err != nil {
if err := p.request(fmt.Sprintf("policies/%s", name), &resp, http.MethodDelete, http.NoBody, "application/json", RemovePolicyTimeout); err != nil {
if strings.Contains(err.Error(), "404") {
p.logger.Warn("ignoring error from removing a policy which was not found", zap.String("policy_id", data.ID), zap.String("policy_name", name))
Comment thread
lpegoraro marked this conversation as resolved.
Outdated
return nil
}
return err
}
return nil
Expand Down