Skip to content

Commit bfbc361

Browse files
committed
che eclipse-che#6306: Using default config for OpenShiftClient creation if no properties specified
Signed-off-by: Ilya Buziuk <ibuziuk@redhat.com>
1 parent 524d603 commit bfbc361

3 files changed

Lines changed: 13 additions & 6 deletions

File tree

assembly/assembly-wsmaster-war/src/main/webapp/WEB-INF/classes/codenvy/che.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ che.predefined.stacks.reload_on_start=false
393393
che.infra.openshift.master_url=
394394
che.infra.openshift.username=
395395
che.infra.openshift.password=
396-
che.infra.openshift.trust_certs=false
396+
che.infra.openshift.trust_certs=
397397

398398
che.infra.openshift.machine_start_timeout_min=5
399399

infrastructures/openshift/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@
9090
<groupId>org.eclipse.che.core</groupId>
9191
<artifactId>che-core-api-workspace-shared</artifactId>
9292
</dependency>
93+
<dependency>
94+
<groupId>org.eclipse.che.core</groupId>
95+
<artifactId>che-core-commons-annotations</artifactId>
96+
</dependency>
9397
<dependency>
9498
<groupId>org.eclipse.che.core</groupId>
9599
<artifactId>che-core-commons-lang</artifactId>

infrastructures/openshift/src/main/java/org/eclipse/che/workspace/infrastructure/openshift/OpenShiftClientFactory.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,18 @@
1717
import io.fabric8.openshift.client.OpenShiftClient;
1818
import javax.inject.Inject;
1919
import javax.inject.Named;
20+
import org.eclipse.che.commons.annotation.Nullable;
2021

2122
/** @author Sergii Leshchenko */
2223
public class OpenShiftClientFactory {
2324
private final Config config;
2425

2526
@Inject
2627
public OpenShiftClientFactory(
27-
@Named("che.infra.openshift.master_url") String masterUrl,
28-
@Named("che.infra.openshift.username") String username,
29-
@Named("che.infra.openshift.password") String password,
30-
@Named("che.infra.openshift.trust_certs") boolean doTrustCerts) {
28+
@Nullable @Named("che.infra.openshift.master_url") String masterUrl,
29+
@Nullable @Named("che.infra.openshift.username") String username,
30+
@Nullable @Named("che.infra.openshift.password") String password,
31+
@Nullable @Named("che.infra.openshift.trust_certs") Boolean doTrustCerts) {
3132
config = new Config();
3233
if (!isNullOrEmpty(masterUrl)) {
3334
config.setMasterUrl(masterUrl);
@@ -41,7 +42,9 @@ public OpenShiftClientFactory(
4142
config.setPassword(password);
4243
}
4344

44-
config.setTrustCerts(doTrustCerts);
45+
if (doTrustCerts != null) {
46+
config.setTrustCerts(doTrustCerts);
47+
}
4548
}
4649

4750
public OpenShiftClient create() {

0 commit comments

Comments
 (0)