|
23 | 23 | import javax.annotation.Nonnull;
|
24 | 24 | import javax.servlet.ServletException;
|
25 | 25 |
|
26 |
| -import hudson.model.Environment; |
27 |
| -import jenkins.model.JenkinsLocationConfiguration; |
28 | 26 | import org.apache.commons.codec.binary.Base64;
|
29 | 27 | import org.apache.commons.lang.StringUtils;
|
30 | 28 | import org.kohsuke.stapler.DataBoundConstructor;
|
|
61 | 59 | import io.fabric8.kubernetes.client.KubernetesClient;
|
62 | 60 | import io.fabric8.kubernetes.client.KubernetesClientException;
|
63 | 61 | import jenkins.model.Jenkins;
|
| 62 | +import jenkins.model.JenkinsLocationConfiguration; |
64 | 63 |
|
65 | 64 | /**
|
66 | 65 | * Kubernetes cloud provider.
|
@@ -184,7 +183,6 @@ public String getServerUrl() {
|
184 | 183 |
|
185 | 184 | @DataBoundSetter
|
186 | 185 | public void setServerUrl(@Nonnull String serverUrl) {
|
187 |
| - Preconditions.checkArgument(!StringUtils.isBlank(serverUrl)); |
188 | 186 | this.serverUrl = serverUrl;
|
189 | 187 | }
|
190 | 188 |
|
@@ -512,16 +510,17 @@ public FormValidation doTestConnection(@QueryParameter String name, @QueryParame
|
512 | 510 | Util.fixEmpty(serverCertificate), Util.fixEmpty(credentialsId), skipTlsVerify,
|
513 | 511 | connectionTimeout, readTimeout).createClient();
|
514 | 512 |
|
| 513 | + // test listing pods |
515 | 514 | client.pods().list();
|
516 |
| - return FormValidation.ok("Connection successful"); |
| 515 | + return FormValidation.ok("Connection test successful"); |
517 | 516 | } catch (KubernetesClientException e) {
|
518 |
| - LOGGER.log(Level.FINE, String.format("Error connecting to %s", serverUrl), e); |
519 |
| - return FormValidation.error("Error connecting to %s: %s", serverUrl, e.getCause() == null |
| 517 | + LOGGER.log(Level.FINE, String.format("Error testing connection %s", serverUrl), e); |
| 518 | + return FormValidation.error("Error testing connection %s: %s", serverUrl, e.getCause() == null |
520 | 519 | ? e.getMessage()
|
521 | 520 | : String.format("%s: %s", e.getCause().getClass().getName(), e.getCause().getMessage()));
|
522 | 521 | } catch (Exception e) {
|
523 |
| - LOGGER.log(Level.FINE, String.format("Error connecting to %s", serverUrl), e); |
524 |
| - return FormValidation.error("Error connecting to %s: %s", serverUrl, e.getMessage()); |
| 522 | + LOGGER.log(Level.FINE, String.format("Error testing connection %s", serverUrl), e); |
| 523 | + return FormValidation.error("Error testing connection %s: %s", serverUrl, e.getMessage()); |
525 | 524 | }
|
526 | 525 | }
|
527 | 526 |
|
|
0 commit comments