提交 83a8d549 编写于 作者: T tfennelly

Noisy warning if restart is required

上级 433d4375
......@@ -119,6 +119,8 @@ import org.xml.sax.helpers.DefaultHandler;
import static hudson.init.InitMilestone.*;
import hudson.model.DownloadService;
import hudson.util.FormValidation;
import static java.util.logging.Level.SEVERE;
import static java.util.logging.Level.WARNING;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
......@@ -803,6 +805,7 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
*/
public void doInstall(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
boolean dynamicLoad = req.getParameter("dynamicLoad")!=null;
final List<Future<UpdateCenter.UpdateCenterJob>> deployJobs = new ArrayList<>();
Enumeration<String> en = req.getParameterNames();
while (en.hasMoreElements()) {
......@@ -835,9 +838,36 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
if (p == null) {
throw new Failure("No such plugin: " + n);
}
p.deploy(dynamicLoad);
deployJobs.add(p.deploy(dynamicLoad));
}
}
// Fire a one-off thread to wait for the plugins to be deployed and then
// refresh the dependant plugins list.
new Thread() {
@Override
public void run() {
INSTALLING: while (true) {
for (Future<UpdateCenter.UpdateCenterJob> deployJob : deployJobs) {
try {
Thread.sleep(500);
} catch (InterruptedException e) {
LOGGER.log(SEVERE, "Unexpected error while waiting for some plugins to install. Plugin Manager state may be invalid. Please restart Jenkins ASAP.", e);
}
if (!deployJob.isCancelled() && !deployJob.isDone()) {
// One of the plugins is not installing/canceled, so
// go back to sleep and try again in a while.
continue INSTALLING;
}
}
// All the plugins are installed. It's now safe to refresh.
resolveDependantPlugins();
break;
}
}
}.start();
rsp.sendRedirect("../updateCenter/");
}
......
......@@ -35,6 +35,11 @@ THE SOFTWARE.
${%Filter}:
<input type="text" id="filter-box"/>
</div>
<j:if test="${app.updateCenter.isRestartRequiredForCompletion()}">
<div class="alert alert-warning"><strong>${%Warning}</strong>: ${%requires.restart}</div>
</j:if>
<local:tabBar page="installed" xmlns:local="/hudson/PluginManager" />
<div class="pane-frame">
......
......@@ -20,4 +20,5 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
wiki.url=http://wiki.jenkins-ci.org/display/JENKINS/Pinned+Plugins
downgradeTo=Downgrade to {0}
\ No newline at end of file
downgradeTo=Downgrade to {0}
requires.restart=This Jenkins instance requires a restart. Changing the state of plugins at this time is strongly discouraged. Restart Jenkins before proceeding.
\ No newline at end of file
......@@ -1773,4 +1773,17 @@ table#legend-table td {
.i18n {
display: none;
}
.alert {
padding: 15px;
margin-bottom: 20px;
border: 1px solid transparent;
border-radius: 4px;
}
.alert-warning {
color: #8a6d3b;
background-color: #fcf8e3;
border-color: #faebcc;
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册