diff --git a/jenkinsapi/node.py b/jenkinsapi/node.py index 2c64cac0..33b62cb2 100644 --- a/jenkinsapi/node.py +++ b/jenkinsapi/node.py @@ -269,6 +269,27 @@ def set_offline(self, message="requested from jenkinsapi") -> None: % (data["offline"], data["temporarilyOffline"]) ) + def launch(self) -> None: + """ + Tries to launch a connection with the slave if it is currently + disconnected. Because launching a connection with the slave does not + mean it is online (a slave can be launched, but set offline), this + function does not check if the launch was successful. + """ + if not self._data["launchSupported"]: + raise AssertionError("The node does not support manually launch.") + + if not self._data["manualLaunchAllowed"]: + raise AssertionError( + "It is not allowed to manually launch this node." + ) + + url = self.baseurl + "/launchSlaveAgent" + html_result = self.jenkins.requester.post_and_confirm_status( + url, data={} + ) + log.debug(html_result) + def toggle_temporarily_offline( self, message="requested from jenkinsapi" ) -> None: