Simplifications and cleanup.
This commit is contained in:
parent
95964dabcc
commit
3265f0721c
|
@ -27,10 +27,9 @@ dependencies {
|
||||||
implementation 'org.slf4j:slf4j-api:1.7.+'
|
implementation 'org.slf4j:slf4j-api:1.7.+'
|
||||||
runtimeOnly 'ch.qos.logback:logback-classic:1.+'
|
runtimeOnly 'ch.qos.logback:logback-classic:1.+'
|
||||||
|
|
||||||
testImplementation 'org.codehaus.groovy:groovy-all:3.0.5'
|
|
||||||
testImplementation('org.spockframework:spock-core:2.0-M3-groovy-3.0')
|
testImplementation('org.spockframework:spock-core:2.0-M3-groovy-3.0')
|
||||||
|
testImplementation('com.squareup.okhttp3:mockwebserver:4.9.0')
|
||||||
testImplementation("org.slf4j:slf4j-simple:1.7.+")
|
testImplementation("org.slf4j:slf4j-simple:1.7.+")
|
||||||
testImplementation('com.squareup.okhttp3:mockwebserver:4.8.0')
|
|
||||||
//implementation platform('org.testcontainers:testcontainers-bom:1.14.3') //import bom
|
//implementation platform('org.testcontainers:testcontainers-bom:1.14.3') //import bom
|
||||||
//testCompile "org.testcontainers:influxdb:1.14.3"
|
//testCompile "org.testcontainers:influxdb:1.14.3"
|
||||||
}
|
}
|
||||||
|
|
|
@ -308,27 +308,9 @@ class HmcClient {
|
||||||
* @return Response body string
|
* @return Response body string
|
||||||
*/
|
*/
|
||||||
private String getResponse(URL url) throws Exception {
|
private String getResponse(URL url) throws Exception {
|
||||||
return getResponse(url, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a Response from the HMC
|
|
||||||
* @param url to get Response from
|
|
||||||
* @param retry number of retries for this call
|
|
||||||
* @return Response body string
|
|
||||||
*/
|
|
||||||
private String getResponse(URL url, Integer retry) throws Exception {
|
|
||||||
|
|
||||||
log.debug("getResponse() - " + url.toString());
|
log.debug("getResponse() - " + url.toString());
|
||||||
|
|
||||||
if(responseErrors > 2) {
|
|
||||||
log.warn("getResponse() - retries > 2");
|
|
||||||
responseErrors = 0;
|
|
||||||
login();
|
|
||||||
return getResponse(url, retry++);
|
|
||||||
}
|
|
||||||
|
|
||||||
Request request = new Request.Builder()
|
Request request = new Request.Builder()
|
||||||
.url(url)
|
.url(url)
|
||||||
.addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8")
|
.addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8")
|
||||||
|
@ -346,12 +328,7 @@ class HmcClient {
|
||||||
log.warn("getResponse() - 401 - login and retry.");
|
log.warn("getResponse() - 401 - login and retry.");
|
||||||
authToken = null;
|
authToken = null;
|
||||||
login();
|
login();
|
||||||
return getResponse(url, retry++);
|
return null;
|
||||||
}
|
|
||||||
|
|
||||||
if(retry < 2) {
|
|
||||||
log.warn("getResponse() - Retrying due to unexpected response: " + response.code());
|
|
||||||
return getResponse(url, retry++);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
log.error("getResponse() - Unexpected response: " + response.code());
|
log.error("getResponse() - Unexpected response: " + response.code());
|
||||||
|
|
|
@ -33,8 +33,8 @@ public class Main implements Callable<Integer> {
|
||||||
|
|
||||||
private final static Logger log = LoggerFactory.getLogger(Main.class);
|
private final static Logger log = LoggerFactory.getLogger(Main.class);
|
||||||
|
|
||||||
@Option(names = { "-c", "--conf" }, description = "Configuration file [default: '/etc/hmci.toml'].")
|
@Option(names = { "-c", "--conf" }, description = "Configuration file [default: '/etc/hmci.toml'].", defaultValue = "/etc/hmci.toml", paramLabel = "<file>")
|
||||||
private String configurationFile = "/etc/hmci.toml";
|
private String configurationFile;
|
||||||
|
|
||||||
public static void main(String... args) {
|
public static void main(String... args) {
|
||||||
int exitCode = new CommandLine(new Main()).execute(args);
|
int exitCode = new CommandLine(new Main()).execute(args);
|
||||||
|
|
|
@ -49,7 +49,7 @@ class InfluxClientTest extends Specification {
|
||||||
influxClient.writeLogicalPartition(lpar)
|
influxClient.writeLogicalPartition(lpar)
|
||||||
|
|
||||||
then:
|
then:
|
||||||
lpar.metrics.systemUtil.utilSamples.first().sampleInfo.status == 2
|
lpar.metrics.systemUtil.sample.sampleInfo.status == 2
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue