[ Server ] [ Harbor ] - sync projects - 7

This commit is contained in:
zeaslity
2023-11-16 10:52:49 +08:00
parent 1132d37adf
commit a31d9318b4

View File

@@ -289,18 +289,15 @@ func (hOp *HarborOperator) SyncProjectExec(funcArgs []string) (bool, []string) {
// 在源 Harbor 中创建复制策略 // 在源 Harbor 中创建复制策略
log.Info("[Harbor Sync Project ] - Start To Sync Project !") log.Info("[Harbor Sync Project ] - Start To Sync Project !")
policies, err := targetClient.ListReplicationPolicies(ctx) policies, _ := targetClient.ListReplicationPolicies(ctx)
if err != nil { if policies != nil {
return false, []string{ for _, policy := range policies {
"[Harbor Sync Project ] - get exists replication policy failed !", if policy.Name == octopusReplicationPolicy.Name {
} err := targetClient.DeleteReplicationPolicyByID(ctx, policy.ID)
} if err != nil {
for _, policy := range policies { return false, []string{
if policy.Name == octopusReplicationPolicy.Name { "[Harbor Sync Project ] - delete exists replication policy failed !",
err := targetClient.DeleteReplicationPolicyByID(ctx, policy.ID) }
if err != nil {
return false, []string{
"[Harbor Sync Project ] - delete exists replication policy failed !",
} }
} }
} }