use of com.blackducksoftware.integration.phonehome.PhoneHomeClient in project hub-docker-inspector by blackducksoftware.
the class HubClient method phoneHomeNoHubConnection.
private void phoneHomeNoHubConnection(final String dockerEngineVersion) {
try {
final IntLogger intLogger = new Slf4jIntLogger(logger);
final ProxyInfo proxyInfo = new ProxyInfo(config.getHubProxyHost(), Integer.parseInt(config.getHubProxyPort()), new Credentials(config.getHubProxyUsername(), config.getHubProxyPassword()), null, null, null);
final boolean alwaysTrustServerCertificate = config.isHubAlwaysTrustCert();
final PhoneHomeClient phClient = new PhoneHomeClient(intLogger, 15, proxyInfo, alwaysTrustServerCertificate);
final Map<String, String> infoMap = new HashMap<>();
infoMap.put("blackDuckName", BlackDuckName.HUB.getName());
infoMap.put("blackDuckVersion", "None");
infoMap.put("thirdPartyName", THIRD_PARTY_NAME_DOCKER);
infoMap.put("thirdPartyVersion", dockerEngineVersion);
infoMap.put("pluginVersion", programVersion.getProgramVersion());
if (!StringUtils.isBlank(config.getCallerName())) {
infoMap.put(PHONE_HOME_METADATA_NAME_CALLER_NAME, config.getCallerName());
}
if (!StringUtils.isBlank(config.getCallerVersion())) {
infoMap.put(PHONE_HOME_METADATA_NAME_CALLER_VERSION, config.getCallerVersion());
}
final PhoneHomeRequestBody phoneHomeRequestBody = new PhoneHomeRequestBody("None", "Integrations", infoMap);
phClient.postPhoneHomeRequest(phoneHomeRequestBody, new CIEnvironmentVariables());
} catch (final Throwable t) {
logger.debug(String.format("Unable to phone home: %s", t.getMessage()));
}
}
Aggregations