提交 930f6308 编写于 作者: O Oleg Nenashev

[JENKINS-34705] - Prevent hanging of InstallationWizard if internet check is skipped (#2328)

上级 d3b61b9c
......@@ -197,6 +197,12 @@ public class UpdateCenter extends AbstractModelObject implements Saveable, OnMas
* Connection status has not started yet.
*/
PRECHECK,
/**
* Connection status check has been skipped.
* As example, it may happen if there is no connection check URL defined for the site.
* @since TODO
*/
SKIPPED,
/**
* Connection status is being checked at this time.
*/
......@@ -1378,6 +1384,10 @@ public class UpdateCenter extends AbstractModelObject implements Saveable, OnMas
connectionStates.put(ConnectionStatus.INTERNET, ConnectionStatus.OK);
}
});
} else {
LOGGER.log(WARNING, "Update site '{0}' does not declare the connection check URL. "
+ "Skipping the network availability check.", site.getId());
connectionStates.put(ConnectionStatus.INTERNET, ConnectionStatus.SKIPPED);
}
connectionStates.put(ConnectionStatus.UPDATE_SITE, ConnectionStatus.CHECKING);
......
......@@ -341,9 +341,11 @@ public class UpdateSite {
}
/**
* Returns an "always up" server for Internet connectivity testing, or null if we are going to skip the test.
* Gets a URL for the Internet connection check.
* @return an "always up" server for Internet connectivity testing, or {@code null} if we are going to skip the test.
*/
@Exported
@CheckForNull
public String getConnectionCheckUrl() {
Data dt = getData();
if(dt==null) return "http://www.google.com/";
......
......@@ -200,12 +200,17 @@ exports.testConnectivity = function(siteId, handler) {
handler(false, true, response.message);
}
// Define statuses, which need additional check iteration via async job on the Jenkins master
// Statuses like "OK" or "SKIPPED" are considered as fine.
var uncheckedStatuses = ['PRECHECK', 'CHECKING', 'UNCHECKED'];
if(uncheckedStatuses.indexOf(response.data.updatesite) >= 0 || uncheckedStatuses.indexOf(response.data.internet) >= 0) {
setTimeout(testConnectivity, 100);
}
else {
if(response.status !== 'ok' || response.data.updatesite !== 'OK' || response.data.internet !== 'OK') {
// Update site should be always reachable, but we do not require the internet connection
// if it's explicitly skipped by the update center
if(response.status !== 'ok' || response.data.updatesite !== 'OK' ||
(response.data.internet !== 'OK' && response.data.internet !== 'SKIPPED')) {
// no connectivity, but not fatal
handler(false, false);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册