diff --git a/plugins/ports/functions.go b/plugins/ports/functions.go index b4ddd52fd..938cba1de 100644 --- a/plugins/ports/functions.go +++ b/plugins/ports/functions.go @@ -353,7 +353,7 @@ func parsePortMapString(stringPortMap string) ([]PortMap, error) { }) } - return uniquePortMaps(portMaps), nil + return portMaps, nil } // removePortMaps removes specific port mappings from an app @@ -406,8 +406,12 @@ func reusesSchemeHostPort(portMaps []PortMap) error { // setPortMaps sets the port maps for an app func setPortMaps(appName string, portMaps []PortMap) error { + if err := reusesSchemeHostPort(portMaps); err != nil { + return fmt.Errorf("Error validating port mappings: %s", err) + } + var value []string - for _, portMap := range uniquePortMaps(portMaps) { + for _, portMap := range portMaps { if portMap.AllowsPersistence() { continue } diff --git a/tests/unit/ports.bats b/tests/unit/ports.bats index e7d451ee5..6eed8f0fe 100644 --- a/tests/unit/ports.bats +++ b/tests/unit/ports.bats @@ -59,7 +59,7 @@ teardown() { echo "status: $status" assert_failure - run /bin/bash -c "dokku ports:add $TEST_APP http:12345:5003 http:12345:5004" + run /bin/bash -c "dokku ports:add $TEST_APP http:12345:5002 http:12345:5004" echo "output: $output" echo "status: $status" assert_failure