Skip to content

Commit

Permalink
fix: Update routing_rule with nil in proxy repositories if the routin…
Browse files Browse the repository at this point in the history
…g rule was removed in nexus
  • Loading branch information
anmoel authored Jun 13, 2024
1 parent cb6e05b commit 78b7295
Show file tree
Hide file tree
Showing 17 changed files with 34 additions and 0 deletions.
2 changes: 2 additions & 0 deletions internal/services/repository/resource_repository_apt_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions internal/services/repository/resource_repository_go_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions internal/services/repository/resource_repository_npm_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions internal/services/repository/resource_repository_p2_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions internal/services/repository/resource_repository_r_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions internal/services/repository/resource_repository_raw_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions internal/services/repository/resource_repository_yum_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 78b7295

Please sign in to comment.