Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
LinuxSuRen
jenkins
提交
aeb6ad95
J
jenkins
项目概览
LinuxSuRen
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jenkins
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
aeb6ad95
编写于
4月 06, 2016
作者:
F
Felix Belzunce Arcos
提交者:
Vincent Latombe
7月 29, 2016
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[JENKINS-21485] AdministrativeMonitor for PluginWrapper
上级
646969b6
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
59 addition
and
0 deletion
+59
-0
core/src/main/java/hudson/PluginWrapper.java
core/src/main/java/hudson/PluginWrapper.java
+40
-0
core/src/main/resources/hudson/Messages.properties
core/src/main/resources/hudson/Messages.properties
+4
-0
core/src/main/resources/hudson/PluginWrapper/PluginWrapperAdministrativeMonitor/message.jelly
...nWrapper/PluginWrapperAdministrativeMonitor/message.jelly
+15
-0
未找到文件。
core/src/main/java/hudson/PluginWrapper.java
浏览文件 @
aeb6ad95
...
...
@@ -26,6 +26,7 @@ package hudson;
import
com.google.common.collect.ImmutableSet
;
import
hudson.PluginManager.PluginInstanceStore
;
import
hudson.model.AdministrativeMonitor
;
import
hudson.model.Api
;
import
hudson.model.ModelObject
;
import
jenkins.YesNoMaybe
;
...
...
@@ -53,6 +54,8 @@ import org.apache.commons.lang.StringUtils;
import
org.apache.commons.logging.LogFactory
;
import
org.kohsuke.stapler.HttpResponse
;
import
org.kohsuke.stapler.HttpResponses
;
import
org.kohsuke.stapler.StaplerRequest
;
import
org.kohsuke.stapler.StaplerResponse
;
import
org.kohsuke.stapler.export.Exported
;
import
org.kohsuke.stapler.export.ExportedBean
;
import
org.kohsuke.stapler.interceptor.RequirePOST
;
...
...
@@ -560,13 +563,16 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
PluginWrapper
dependency
=
parent
.
getPlugin
(
d
.
shortName
);
if
(
dependency
==
null
)
{
missingDependencies
.
add
(
d
);
NOTICE
.
addErrorMessage
(
Messages
.
PluginWrapper_admonitor_MissingDependency
(
getLongName
(),
d
.
shortName
));
}
else
{
if
(
dependency
.
isActive
())
{
if
(
isDependencyObsolete
(
d
,
dependency
))
{
obsoleteDependencies
.
add
(
d
);
NOTICE
.
addErrorMessage
(
Messages
.
PluginWrapper_admonitor_ObsoleteDependency
(
getLongName
(),
dependency
.
getLongName
(),
d
.
version
));
}
}
else
{
disabledDependencies
.
add
(
d
);
NOTICE
.
addErrorMessage
(
Messages
.
PluginWrapper_admonitor_DisabledDependency
(
getLongName
(),
dependency
.
getLongName
()));
}
}
...
...
@@ -577,6 +583,7 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
if
(
dependency
!=
null
&&
dependency
.
isActive
())
{
if
(
isDependencyObsolete
(
d
,
dependency
))
{
obsoleteDependencies
.
add
(
d
);
NOTICE
.
addErrorMessage
(
Messages
.
PluginWrapper_admonitor_ObsoleteDependency
(
getLongName
(),
dependency
.
getLongName
(),
d
.
version
));
}
else
{
dependencies
.
add
(
d
);
}
...
...
@@ -612,6 +619,7 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
private
void
checkRequiredCoreVersion
(
String
requiredCoreVersion
)
throws
IOException
{
if
(
Jenkins
.
getVersion
().
isOlderThan
(
new
VersionNumber
(
requiredCoreVersion
)))
{
NOTICE
.
addErrorMessage
(
Messages
.
PluginWrapper_admonitor_OutdatedCoreVersion
(
getLongName
(),
requiredCoreVersion
));
throw
new
IOException
(
shortName
+
" requires a more recent core version ("
+
requiredCoreVersion
+
") than the current ("
+
Jenkins
.
getVersion
()
+
")."
);
}
}
...
...
@@ -725,6 +733,38 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
return
false
;
}
@Extension
public
final
static
PluginWrapperAdministrativeMonitor
NOTICE
=
new
PluginWrapperAdministrativeMonitor
();
/**
* Administrative Monitor for failed plugins
*/
public
static
final
class
PluginWrapperAdministrativeMonitor
extends
AdministrativeMonitor
{
public
final
List
<
String
>
pluginError
=
new
ArrayList
<>();
void
addErrorMessage
(
String
error
)
{
pluginError
.
add
(
error
);
}
public
boolean
isActivated
()
{
return
!
pluginError
.
isEmpty
();
}
/**
* Depending on whether the user said "dismiss" or "correct", send him to the right place.
*/
public
void
doAct
(
StaplerRequest
req
,
StaplerResponse
rsp
)
throws
IOException
{
if
(
req
.
hasParameter
(
"correct"
))
{
rsp
.
sendRedirect
(
req
.
getContextPath
()+
"/pluginManager"
);
}
}
public
static
PluginWrapperAdministrativeMonitor
get
()
{
return
AdministrativeMonitor
.
all
().
get
(
PluginWrapperAdministrativeMonitor
.
class
);
}
}
//
//
// Action methods
...
...
core/src/main/resources/hudson/Messages.properties
浏览文件 @
aeb6ad95
...
...
@@ -73,4 +73,8 @@ ProxyConfiguration.Success=Success
Functions.NoExceptionDetails
=
No Exception details
PluginWrapper.admonitor.OutdatedCoreVersion
=
Plugin {0} requires Jenkins {1} or later
PluginWrapper.admonitor.MissingDependency
=
Plugin {0} requires the missing plugin {1}
PluginWrapper.admonitor.DisabledDependency
=
Plugin {0} depends on the disabled {1}
PluginWrapper.admonitor.ObsoleteDependency
=
Plugin {0} requires {1} {2} or later
TcpSlaveAgentListener.PingAgentProtocol.displayName
=
Ping protocol
core/src/main/resources/hudson/PluginWrapper/PluginWrapperAdministrativeMonitor/message.jelly
0 → 100644
浏览文件 @
aeb6ad95
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<div class="error">
<form method="post" action="${rootURL}/${it.url}/act" name="${it.id}">
<div style="float:right">
<f:submit name="correct" value="${%Correct}"/>
</div>
</form>
<ul>
<j:forEach items="${it.pluginError}" var="pluginError">
<li>${pluginError}</li>
</j:forEach>
</ul>
</div>
</j:jelly>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录