Skip to content

Commit 5aafe96

Browse files
authored
Merge pull request #8 from mcanoy/409-message
Add error message to 409 conflict. Dev deployment addition
2 parents 43f7ef3 + bb36180 commit 5aafe96

File tree

5 files changed

+8
-4
lines changed

5 files changed

+8
-4
lines changed

deployment/templates/buildconfig.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{- if .Values.development }}
1+
{{- if and .Values.development .Values.buildImage }}
22
apiVersion: build.openshift.io/v1
33
kind: BuildConfig
44
metadata:

deployment/templates/imagestream.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ metadata:
88
spec:
99
lookupPolicy:
1010
local: false
11-
{{- if not .Values.development}}
11+
{{- if not .Values.buildImage}}
1212
tags:
1313
- annotations: null
1414
from:

deployment/values-dev.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
name: lodestar-hosting
22
development: true
3+
#if using quay then you should specify the image location
4+
buildImage: true
35

46
imageName: "lodestar-hosting"
57
imageTag: "latest"

src/main/java/com/redhat/labs/lodestar/hosting/service/HostingService.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import javax.inject.Inject;
1313
import javax.transaction.Transactional;
1414
import javax.ws.rs.WebApplicationException;
15+
import javax.ws.rs.core.Response;
1516

1617
import com.google.gson.*;
1718
import com.redhat.labs.lodestar.hosting.model.*;
@@ -188,7 +189,8 @@ public String updateHosting(String engagementUuid, List<HostingEnvironment> host
188189
}
189190

190191
if(hostingEnv.getOcpSubDomain() != null && !isValidSubdomain(engagementUuid, hostingEnv.getOcpSubDomain())) {
191-
throw new WebApplicationException(409);
192+
String message = String.format("Subdomain name %s is invalid", hostingEnv.getOcpSubDomain());
193+
throw new WebApplicationException(Response.status(409).entity(Map.of("lodestarMessage", message)).build());
192194
}
193195
fillOutHostingEnvironment(hostingEnv, engagement.getUuid(), engagement.getRegion(), engagement.getProjectId());
194196
}

src/test/java/com/redhat/labs/lodestar/hosting/resource/HostingResourceTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ void testUsedSubdomainUpdateByUuid() {
6161
he.get(0).setOcpSubDomain("red-1");
6262

6363
given().contentType(ContentType.JSON).pathParam("engagementUuid", "second").body(he).put("/engagements/{engagementUuid}").then()
64-
.statusCode(409);
64+
.statusCode(409).body("lodestarMessage", equalTo("Subdomain name red-1 is invalid"));
6565
}
6666

6767
@Test

0 commit comments

Comments
 (0)