提交 7319b679 编写于 作者: K Keith Zantow 提交者: Oleg Nenashev

JENKINS-34708 - UpdateCenter.EnableJob not properly setting status (#2365)

* JENKINS-34708 - UpdateCenter.EnableJob not properly setting status

* Restore if (status instanceof Pending)
上级 b6897e65
......@@ -1502,23 +1502,40 @@ public class UpdateCenter extends AbstractModelObject implements Saveable, OnMas
@Override
public void run() {
try {
plugin.getInstalled().enable();
} catch (IOException e) {
LOGGER.log(Level.SEVERE, "Failed to enable " + plugin.getDisplayName(), e);
error = e;
}
if (dynamicLoad) {
try {
// remove the existing, disabled inactive plugin to force a new one to load
pm.dynamicLoad(getDestination(), true);
} catch (Exception e) {
LOGGER.log(Level.SEVERE, "Failed to dynamically load " + plugin.getDisplayName(), e);
error = e;
requiresRestart = true;
PluginWrapper installed = plugin.getInstalled();
synchronized(installed) {
if (!installed.isEnabled()) {
try {
installed.enable();
} catch (IOException e) {
LOGGER.log(Level.SEVERE, "Failed to enable " + plugin.getDisplayName(), e);
error = e;
status = new Failure(e);
}
if (dynamicLoad) {
try {
// remove the existing, disabled inactive plugin to force a new one to load
pm.dynamicLoad(getDestination(), true);
} catch (Exception e) {
LOGGER.log(Level.SEVERE, "Failed to dynamically load " + plugin.getDisplayName(), e);
error = e;
requiresRestart = true;
status = new Failure(e);
}
} else {
requiresRestart = true;
}
}
}
} else {
} catch(Throwable e) {
LOGGER.log(Level.SEVERE, "An unexpected error occurred while attempting to enable " + plugin.getDisplayName(), e);
error = e;
requiresRestart = true;
status = new Failure(e);
}
if(status instanceof Pending) {
status = new Success();
}
}
}
......@@ -1530,6 +1547,11 @@ public class UpdateCenter extends AbstractModelObject implements Saveable, OnMas
public NoOpJob(UpdateSite site, Authentication auth, @Nonnull Plugin plugin) {
super(site, auth, plugin, false);
}
@Override
public void run() {
// do nothing
status = new Success();
}
}
/**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册