[FIXED JENKINS-19081] Offer the option of downloading metadata directly from the server.

This commit is contained in:
Jesse Glick committed 2014-02-27 16:31:07 -05:00
1 parent f9953add7b
commit 1ac77750e9
13 files changed
+279 -64

No files matched your search

@@ -108,7 +108,12 @@ import org.xml.sax.SAXException;
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.WARNING;
import jenkins.security.DownloadSettings;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
/**
* Manages {@link PluginWrapper}s.
@@ -775,6 +780,24 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
}
}
@Restricted(NoExternalUse.class)
@RequirePOST public HttpResponse doCheckUpdatesServer() throws IOException {
for (UpdateSite site : Jenkins.getInstance().getUpdateCenter().getSites()) {
FormValidation v = site.updateDirectlyNow(DownloadSettings.get().isCheckSignature());
if (v.kind != FormValidation.Kind.OK) {
// TODO crude but enough for now
return v;
}
}
for (DownloadService.Downloadable d : DownloadService.Downloadable.all()) {
FormValidation v = d.updateNow();
if (v.kind != FormValidation.Kind.OK) {
return v;
}
}
return HttpResponses.forwardToPreviousPage();
}
protected String identifyPluginShortName(File t) {
try {
JarFile j = new JarFile(t);