Skip to content

Commit 5980a1d

Browse files
hoppla20vicupre-commit-ci[bot]
authored
feature: add launch method to Node class (#849)
* feature: add launch method to Node class * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: vicu <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent a131e75 commit 5980a1d

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

jenkinsapi/node.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,27 @@ def set_offline(self, message="requested from jenkinsapi") -> None:
269269
% (data["offline"], data["temporarilyOffline"])
270270
)
271271

272+
def launch(self) -> None:
273+
"""
274+
Tries to launch a connection with the slave if it is currently
275+
disconnected. Because launching a connection with the slave does not
276+
mean it is online (a slave can be launched, but set offline), this
277+
function does not check if the launch was successful.
278+
"""
279+
if not self._data["launchSupported"]:
280+
raise AssertionError("The node does not support manually launch.")
281+
282+
if not self._data["manualLaunchAllowed"]:
283+
raise AssertionError(
284+
"It is not allowed to manually launch this node."
285+
)
286+
287+
url = self.baseurl + "/launchSlaveAgent"
288+
html_result = self.jenkins.requester.post_and_confirm_status(
289+
url, data={}
290+
)
291+
log.debug(html_result)
292+
272293
def toggle_temporarily_offline(
273294
self, message="requested from jenkinsapi"
274295
) -> None:

0 commit comments

Comments
 (0)