From: Ruslan Lutsenko Date: Fri, 18 Jan 2013 10:51:36 +0000 (+0100) Subject: add comments X-Git-Tag: v0.2.23~258^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=67ec8814e4c27b62f8074fc8f1ad5d5ab18db405;p=tools%2Fpython-jenkinsapi.git add comments --- diff --git a/jenkinsapi/node.py b/jenkinsapi/node.py index c942de1..38b8bb5 100644 --- a/jenkinsapi/node.py +++ b/jenkinsapi/node.py @@ -49,7 +49,14 @@ class Node(JenkinsBase): def set_online(self): + """ + Set node online. + Before change state verify client state: if node set 'offline' but 'temporarilyOffline' + is not set - client has connection problems and AssertionError raised. + If after run node state has not been changed raise AssertionError. + """ self.poll() + # Before change state check if client is connected if self._data['offline'] and not self._data['temporarilyOffline']: raise AssertionError("Node is offline and not marked as temporarilyOffline" + ", check client connection: " + @@ -64,6 +71,11 @@ class Node(JenkinsBase): (self._data['offline'], self._data['temporarilyOffline'])) def set_offline(self, message="requested from jenkinsapi"): + """ + Set node offline. + If after run node state has not been changed raise AssertionError. + : param message: optional string explain why you are taking this node offline + """ self.poll() if not self._data['offline']: self.toggle_temporarily_offline(message) @@ -74,6 +86,11 @@ class Node(JenkinsBase): (self._data['offline'], self._data['temporarilyOffline'])) def toggle_temporarily_offline(self, message="requested from jenkinsapi"): + """ + Switches state of connected node (online/offline) and set 'temporarilyOffline' property (True/False) + Calling the same method again will bring node status back. + : param message: optional string can be used to explain why you are taking this node offline + """ initial_state = self.is_temporarily_offline() url = self.baseurl + "/toggleOffline?offlineMessage=" + urllib.quote(message) html_result = self.hit_url(url)