Skip to content

Commit

Permalink
Remove if condition
Browse files Browse the repository at this point in the history
  • Loading branch information
simcod committed Nov 8, 2024
1 parent b5236c3 commit 5f678e1
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions cmd/metal-api/internal/service/partition-service.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,23 +207,19 @@ func (r *partitionResource) createPartition(request *restful.Request, response *

var dnsServers metal.DNSServers
reqDNSServers := requestPayload.DNSServers
if len(reqDNSServers) > 0 {
if err := ValidateDNSServers(reqDNSServers); err != nil {
r.sendError(request, response, httperrors.BadRequest(err))
return
}

dnsServers = reqDNSServers
if err := ValidateDNSServers(reqDNSServers); err != nil {
r.sendError(request, response, httperrors.BadRequest(err))
return
}
dnsServers = reqDNSServers

var ntpServers metal.NTPServers
reqNtpServers := requestPayload.NTPServers
if len(ntpServers) > 0 {
if err := ValidateNTPServers(reqNtpServers); err != nil {
r.sendError(request, response, httperrors.BadRequest(err))
}
ntpServers = reqNtpServers
if err := ValidateNTPServers(reqNtpServers); err != nil {
r.sendError(request, response, httperrors.BadRequest(err))
return
}
ntpServers = reqNtpServers

p := &metal.Partition{
Base: metal.Base{
Expand Down

0 comments on commit 5f678e1

Please sign in to comment.