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 22
33## Release 0.3.8 (NOT RELEASED YET)
44
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+
517 * [ JENKINS-46445] ( https://issues.jenkins-ci.org/browse/JENKINS-46445 )
618
719 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 {
9797 toggleOffline ( false );
9898 }
9999
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+
100117 public Boolean getManualLaunchAllowed () {
101118 return manualLaunchAllowed ;
102119 }
You can’t perform that action at this time.
0 commit comments