private String discoverCredentialsHelperNotFoundMessage(String credentialHelperName) { // will do fake call to given credential helper to find out with which message // it response when there are no credentials for given hostName // hostName should be valid, but most probably not existing // IF its not enough, then should probably run 'list' command first to be sure... final String notExistentFakeHostName = "https://not.a.real.registry/url"; String credentialsNotFoundMsg = null; try { runCredentialProgram(notExistentFakeHostName, credentialHelperName); // should not reach here log.warn("Failure running docker credential helper ({}) with fake call, expected 'credentials not found' response", credentialHelperName); } catch(Exception e) { if (e instanceof InvalidResultException) { credentialsNotFoundMsg = extractCredentialProviderErrorMessage((InvalidResultException)e); } if (isBlank(credentialsNotFoundMsg)) { log.warn("Failure running docker credential helper ({}) with fake call, expected 'credentials not found' response. Exception message: {}", credentialHelperName, e.getMessage()); } else { log.debug("Got credentials not found error message from docker credential helper - {}", credentialsNotFoundMsg); } } return credentialsNotFoundMsg; }
} catch (InvalidResultException e) { final String responseErrorMsg = extractCredentialProviderErrorMessage(e);
private String discoverCredentialsHelperNotFoundMessage(String credentialHelperName) { // will do fake call to given credential helper to find out with which message // it response when there are no credentials for given hostName // hostName should be valid, but most probably not existing // IF its not enough, then should probably run 'list' command first to be sure... final String notExistentFakeHostName = "https://not.a.real.registry/url"; String credentialsNotFoundMsg = null; try { runCredentialProgram(notExistentFakeHostName, credentialHelperName); // should not reach here log.warn("Failure running docker credential helper ({}) with fake call, expected 'credentials not found' response", credentialHelperName); } catch(Exception e) { if (e instanceof InvalidResultException) { credentialsNotFoundMsg = extractCredentialProviderErrorMessage((InvalidResultException)e); } if (isBlank(credentialsNotFoundMsg)) { log.warn("Failure running docker credential helper ({}) with fake call, expected 'credentials not found' response. Exception message: {}", credentialHelperName, e.getMessage()); } else { log.debug("Got credentials not found error message from docker credential helper - {}", credentialsNotFoundMsg); } } return credentialsNotFoundMsg; }
} catch (InvalidResultException e) { final String responseErrorMsg = extractCredentialProviderErrorMessage(e);