From 78b7295cd99d81983518576835889fa391b74e36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20M=C3=B6ller?= Date: Thu, 13 Jun 2024 16:59:07 +0200 Subject: [PATCH] fix: Update routing_rule with nil in proxy repositories if the routing rule was removed in nexus --- internal/services/repository/resource_repository_apt_proxy.go | 2 ++ internal/services/repository/resource_repository_bower_proxy.go | 2 ++ .../services/repository/resource_repository_cocoapods_proxy.go | 2 ++ internal/services/repository/resource_repository_conan_proxy.go | 2 ++ internal/services/repository/resource_repository_conda_proxy.go | 2 ++ .../services/repository/resource_repository_docker_proxy.go | 2 ++ internal/services/repository/resource_repository_go_proxy.go | 2 ++ internal/services/repository/resource_repository_helm_proxy.go | 2 ++ internal/services/repository/resource_repository_maven_proxy.go | 2 ++ internal/services/repository/resource_repository_npm_proxy.go | 2 ++ internal/services/repository/resource_repository_nuget_proxy.go | 2 ++ internal/services/repository/resource_repository_p2_proxy.go | 2 ++ internal/services/repository/resource_repository_pypi_proxy.go | 2 ++ internal/services/repository/resource_repository_r_proxy.go | 2 ++ internal/services/repository/resource_repository_raw_proxy.go | 2 ++ .../services/repository/resource_repository_rubygems_proxy.go | 2 ++ internal/services/repository/resource_repository_yum_proxy.go | 2 ++ 17 files changed, 34 insertions(+) diff --git a/internal/services/repository/resource_repository_apt_proxy.go b/internal/services/repository/resource_repository_apt_proxy.go index 671e350c..09b97ffc 100644 --- a/internal/services/repository/resource_repository_apt_proxy.go +++ b/internal/services/repository/resource_repository_apt_proxy.go @@ -132,6 +132,8 @@ func setAptProxyRepositoryToResourceData(repo *repository.AptProxyRepository, re resourceData.Set("routing_rule", repo.RoutingRuleName) } else if repo.RoutingRule != nil { resourceData.Set("routing_rule", repo.RoutingRule) + } else if repo.RoutingRuleName == nil && repo.RoutingRule == nil { + resourceData.Set("routing_rule", nil) } if err := resourceData.Set("storage", flattenStorage(&repo.Storage)); err != nil { diff --git a/internal/services/repository/resource_repository_bower_proxy.go b/internal/services/repository/resource_repository_bower_proxy.go index 1bfbd53f..bf39d727 100644 --- a/internal/services/repository/resource_repository_bower_proxy.go +++ b/internal/services/repository/resource_repository_bower_proxy.go @@ -124,6 +124,8 @@ func setBowerProxyRepositoryToResourceData(repo *repository.BowerProxyRepository resourceData.Set("routing_rule", repo.RoutingRuleName) } else if repo.RoutingRule != nil { resourceData.Set("routing_rule", repo.RoutingRule) + } else if repo.RoutingRuleName == nil && repo.RoutingRule == nil { + resourceData.Set("routing_rule", nil) } if err := resourceData.Set("storage", flattenStorage(&repo.Storage)); err != nil { diff --git a/internal/services/repository/resource_repository_cocoapods_proxy.go b/internal/services/repository/resource_repository_cocoapods_proxy.go index ed9b15c9..5bb463f6 100644 --- a/internal/services/repository/resource_repository_cocoapods_proxy.go +++ b/internal/services/repository/resource_repository_cocoapods_proxy.go @@ -115,6 +115,8 @@ func setCocoapodsProxyRepositoryToResourceData(repo *repository.CocoapodsProxyRe resourceData.Set("routing_rule", repo.RoutingRuleName) } else if repo.RoutingRule != nil { resourceData.Set("routing_rule", repo.RoutingRule) + } else if repo.RoutingRuleName == nil && repo.RoutingRule == nil { + resourceData.Set("routing_rule", nil) } if err := resourceData.Set("storage", flattenStorage(&repo.Storage)); err != nil { diff --git a/internal/services/repository/resource_repository_conan_proxy.go b/internal/services/repository/resource_repository_conan_proxy.go index 5093f385..2cbcd6e9 100644 --- a/internal/services/repository/resource_repository_conan_proxy.go +++ b/internal/services/repository/resource_repository_conan_proxy.go @@ -115,6 +115,8 @@ func setConanProxyRepositoryToResourceData(repo *repository.ConanProxyRepository resourceData.Set("routing_rule", repo.RoutingRuleName) } else if repo.RoutingRule != nil { resourceData.Set("routing_rule", repo.RoutingRule) + } else if repo.RoutingRuleName == nil && repo.RoutingRule == nil { + resourceData.Set("routing_rule", nil) } if err := resourceData.Set("storage", flattenStorage(&repo.Storage)); err != nil { diff --git a/internal/services/repository/resource_repository_conda_proxy.go b/internal/services/repository/resource_repository_conda_proxy.go index 99eb84e4..9304dd1a 100644 --- a/internal/services/repository/resource_repository_conda_proxy.go +++ b/internal/services/repository/resource_repository_conda_proxy.go @@ -115,6 +115,8 @@ func setCondaProxyRepositoryToResourceData(repo *repository.CondaProxyRepository resourceData.Set("routing_rule", repo.RoutingRuleName) } else if repo.RoutingRule != nil { resourceData.Set("routing_rule", repo.RoutingRule) + } else if repo.RoutingRuleName == nil && repo.RoutingRule == nil { + resourceData.Set("routing_rule", nil) } if err := resourceData.Set("storage", flattenStorage(&repo.Storage)); err != nil { diff --git a/internal/services/repository/resource_repository_docker_proxy.go b/internal/services/repository/resource_repository_docker_proxy.go index 5fff0668..fe657637 100644 --- a/internal/services/repository/resource_repository_docker_proxy.go +++ b/internal/services/repository/resource_repository_docker_proxy.go @@ -182,6 +182,8 @@ func setDockerProxyRepositoryToResourceData(repo *repository.DockerProxyReposito resourceData.Set("routing_rule", repo.RoutingRuleName) } else if repo.RoutingRule != nil { resourceData.Set("routing_rule", repo.RoutingRule) + } else if repo.RoutingRuleName == nil && repo.RoutingRule == nil { + resourceData.Set("routing_rule", nil) } if err := resourceData.Set("storage", flattenStorage(&repo.Storage)); err != nil { diff --git a/internal/services/repository/resource_repository_go_proxy.go b/internal/services/repository/resource_repository_go_proxy.go index 0c91f404..59dd5e41 100644 --- a/internal/services/repository/resource_repository_go_proxy.go +++ b/internal/services/repository/resource_repository_go_proxy.go @@ -115,6 +115,8 @@ func setGoProxyRepositoryToResourceData(repo *repository.GoProxyRepository, reso resourceData.Set("routing_rule", repo.RoutingRuleName) } else if repo.RoutingRule != nil { resourceData.Set("routing_rule", repo.RoutingRule) + } else if repo.RoutingRuleName == nil && repo.RoutingRule == nil { + resourceData.Set("routing_rule", nil) } if err := resourceData.Set("storage", flattenStorage(&repo.Storage)); err != nil { diff --git a/internal/services/repository/resource_repository_helm_proxy.go b/internal/services/repository/resource_repository_helm_proxy.go index 26e51f90..0de57cf8 100644 --- a/internal/services/repository/resource_repository_helm_proxy.go +++ b/internal/services/repository/resource_repository_helm_proxy.go @@ -115,6 +115,8 @@ func setHelmProxyRepositoryToResourceData(repo *repository.HelmProxyRepository, resourceData.Set("routing_rule", repo.RoutingRuleName) } else if repo.RoutingRule != nil { resourceData.Set("routing_rule", repo.RoutingRule) + } else if repo.RoutingRuleName == nil && repo.RoutingRule == nil { + resourceData.Set("routing_rule", nil) } if err := resourceData.Set("storage", flattenStorage(&repo.Storage)); err != nil { diff --git a/internal/services/repository/resource_repository_maven_proxy.go b/internal/services/repository/resource_repository_maven_proxy.go index c0acf17e..0b3e56c3 100644 --- a/internal/services/repository/resource_repository_maven_proxy.go +++ b/internal/services/repository/resource_repository_maven_proxy.go @@ -132,6 +132,8 @@ func setMavenProxyRepositoryToResourceData(repo *repository.MavenProxyRepository resourceData.Set("routing_rule", repo.RoutingRuleName) } else if repo.RoutingRule != nil { resourceData.Set("routing_rule", repo.RoutingRule) + } else if repo.RoutingRuleName == nil && repo.RoutingRule == nil { + resourceData.Set("routing_rule", nil) } if err := resourceData.Set("maven", flattenMaven(&repo.Maven)); err != nil { diff --git a/internal/services/repository/resource_repository_npm_proxy.go b/internal/services/repository/resource_repository_npm_proxy.go index 31c65eba..ae1e0b86 100644 --- a/internal/services/repository/resource_repository_npm_proxy.go +++ b/internal/services/repository/resource_repository_npm_proxy.go @@ -132,6 +132,8 @@ func setNpmProxyRepositoryToResourceData(repo *repository.NpmProxyRepository, re resourceData.Set("routing_rule", repo.RoutingRuleName) } else if repo.RoutingRule != nil { resourceData.Set("routing_rule", repo.RoutingRule) + } else if repo.RoutingRuleName == nil && repo.RoutingRule == nil { + resourceData.Set("routing_rule", nil) } if err := resourceData.Set("storage", flattenStorage(&repo.Storage)); err != nil { diff --git a/internal/services/repository/resource_repository_nuget_proxy.go b/internal/services/repository/resource_repository_nuget_proxy.go index 7a7e97f3..91b2a5a1 100644 --- a/internal/services/repository/resource_repository_nuget_proxy.go +++ b/internal/services/repository/resource_repository_nuget_proxy.go @@ -130,6 +130,8 @@ func setNugetProxyRepositoryToResourceData(repo *repository.NugetProxyRepository resourceData.Set("routing_rule", repo.RoutingRuleName) } else if repo.RoutingRule != nil { resourceData.Set("routing_rule", repo.RoutingRule) + } else if repo.RoutingRuleName == nil && repo.RoutingRule == nil { + resourceData.Set("routing_rule", nil) } if err := resourceData.Set("storage", flattenStorage(&repo.Storage)); err != nil { diff --git a/internal/services/repository/resource_repository_p2_proxy.go b/internal/services/repository/resource_repository_p2_proxy.go index 9d91ac88..e71b8d77 100644 --- a/internal/services/repository/resource_repository_p2_proxy.go +++ b/internal/services/repository/resource_repository_p2_proxy.go @@ -115,6 +115,8 @@ func setP2ProxyRepositoryToResourceData(repo *repository.P2ProxyRepository, reso resourceData.Set("routing_rule", repo.RoutingRuleName) } else if repo.RoutingRule != nil { resourceData.Set("routing_rule", repo.RoutingRule) + } else if repo.RoutingRuleName == nil && repo.RoutingRule == nil { + resourceData.Set("routing_rule", nil) } if err := resourceData.Set("storage", flattenStorage(&repo.Storage)); err != nil { diff --git a/internal/services/repository/resource_repository_pypi_proxy.go b/internal/services/repository/resource_repository_pypi_proxy.go index 70b061ee..76318647 100644 --- a/internal/services/repository/resource_repository_pypi_proxy.go +++ b/internal/services/repository/resource_repository_pypi_proxy.go @@ -115,6 +115,8 @@ func setPypiProxyRepositoryToResourceData(repo *repository.PypiProxyRepository, resourceData.Set("routing_rule", repo.RoutingRuleName) } else if repo.RoutingRule != nil { resourceData.Set("routing_rule", repo.RoutingRule) + } else if repo.RoutingRuleName == nil && repo.RoutingRule == nil { + resourceData.Set("routing_rule", nil) } if err := resourceData.Set("storage", flattenStorage(&repo.Storage)); err != nil { diff --git a/internal/services/repository/resource_repository_r_proxy.go b/internal/services/repository/resource_repository_r_proxy.go index 72ceba43..b3f18272 100644 --- a/internal/services/repository/resource_repository_r_proxy.go +++ b/internal/services/repository/resource_repository_r_proxy.go @@ -115,6 +115,8 @@ func setRProxyRepositoryToResourceData(repo *repository.RProxyRepository, resour resourceData.Set("routing_rule", repo.RoutingRuleName) } else if repo.RoutingRule != nil { resourceData.Set("routing_rule", repo.RoutingRule) + } else if repo.RoutingRuleName == nil && repo.RoutingRule == nil { + resourceData.Set("routing_rule", nil) } if err := resourceData.Set("storage", flattenStorage(&repo.Storage)); err != nil { diff --git a/internal/services/repository/resource_repository_raw_proxy.go b/internal/services/repository/resource_repository_raw_proxy.go index 6b1321c2..c17a8fb0 100644 --- a/internal/services/repository/resource_repository_raw_proxy.go +++ b/internal/services/repository/resource_repository_raw_proxy.go @@ -115,6 +115,8 @@ func setRawProxyRepositoryToResourceData(repo *repository.RawProxyRepository, re resourceData.Set("routing_rule", repo.RoutingRuleName) } else if repo.RoutingRule != nil { resourceData.Set("routing_rule", repo.RoutingRule) + } else if repo.RoutingRuleName == nil && repo.RoutingRule == nil { + resourceData.Set("routing_rule", nil) } if err := resourceData.Set("storage", flattenStorage(&repo.Storage)); err != nil { diff --git a/internal/services/repository/resource_repository_rubygems_proxy.go b/internal/services/repository/resource_repository_rubygems_proxy.go index 841e9f9d..5b88f2ce 100644 --- a/internal/services/repository/resource_repository_rubygems_proxy.go +++ b/internal/services/repository/resource_repository_rubygems_proxy.go @@ -115,6 +115,8 @@ func setRubygemsProxyRepositoryToResourceData(repo *repository.RubyGemsProxyRepo resourceData.Set("routing_rule", repo.RoutingRuleName) } else if repo.RoutingRule != nil { resourceData.Set("routing_rule", repo.RoutingRule) + } else if repo.RoutingRuleName == nil && repo.RoutingRule == nil { + resourceData.Set("routing_rule", nil) } if err := resourceData.Set("storage", flattenStorage(&repo.Storage)); err != nil { diff --git a/internal/services/repository/resource_repository_yum_proxy.go b/internal/services/repository/resource_repository_yum_proxy.go index 237750e5..e0b6a326 100644 --- a/internal/services/repository/resource_repository_yum_proxy.go +++ b/internal/services/repository/resource_repository_yum_proxy.go @@ -129,6 +129,8 @@ func setYumProxyRepositoryToResourceData(repo *repository.YumProxyRepository, re resourceData.Set("routing_rule", repo.RoutingRuleName) } else if repo.RoutingRule != nil { resourceData.Set("routing_rule", repo.RoutingRule) + } else if repo.RoutingRuleName == nil && repo.RoutingRule == nil { + resourceData.Set("routing_rule", nil) } if err := resourceData.Set("storage", flattenStorage(&repo.Storage)); err != nil {