File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
jenkins-client/src/main/java/com/offbytwo/jenkins/model Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change 2
2
3
3
## Release 0.3.8 (NOT RELEASED YET)
4
4
5
+ * [ JENKINS-46472] ( https://issues.jenkins-ci.org/browse/JENKINS-46472 )
6
+
7
+ Added ability to modify offline cause for offline computers.
8
+
9
+ ``` java
10
+ ComputerWithDetails computer = ...
11
+ if (! computer. getOffline()){
12
+ computer. toggleOffline();
13
+ computer. changeOfflineCause(" Scheduled for termination" );
14
+ }
15
+ ```
16
+
5
17
* [ JENKINS-46445] ( https://issues.jenkins-ci.org/browse/JENKINS-46445 )
6
18
7
19
Add support for both client TLS and basic authentication.
Original file line number Diff line number Diff line change @@ -97,6 +97,23 @@ public void toggleOffline() throws IOException {
97
97
toggleOffline ( false );
98
98
}
99
99
100
+ public void changeOfflineCause (String cause , boolean crumbFlag ) throws IOException {
101
+ String name ;
102
+ if ("master" .equals (displayName )) {
103
+ name = "(master)" ;
104
+ } else {
105
+ name = UrlEscapers .urlPathSegmentEscaper ().escape (displayName );
106
+ }
107
+
108
+ Map <String , String > data = new HashMap <String , String >();
109
+ data .put ( "offlineMessage" , cause );
110
+ client .post_form ("/computer/" + name + "/changeOfflineCause?" , data , crumbFlag );
111
+ }
112
+
113
+ public void changeOfflineCause (String cause ) throws IOException {
114
+ changeOfflineCause (cause , false );
115
+ }
116
+
100
117
public Boolean getManualLaunchAllowed () {
101
118
return manualLaunchAllowed ;
102
119
}
You can’t perform that action at this time.
0 commit comments