def update_capabilities(self, capabilities): """Update node capabilities Args: capabilities (:obj:`str`): json string representing capabilities """ try: capabilities = capabilities.replace("'", '"') json_data = json.loads(capabilities) node_details = self.node_details node_details.set_capabilities(json_data) self._update_node_with_node_details(node_details) except ValueError: raise NodeDataError("Improper json format for capabilities:" " '%s'" % capabilities)
def __init__(self, jenkins_instance, node_name, nodes_data): self.node_name = node_name self.node_data = None self.jenkins = jenkins_instance self.node = None for node_dt in nodes_data: if node_dt.get(NodeData.DISPLAY_NAME) == node_name: self.node_data = node_dt break if not self.node_data: raise NodeDataError("Failed to get data for node %s" % node_name) self.reservation_info = self._get_reservation_info() self.node_status = self.get_node_status() description = self.node_data.get('description') self.node_details = self._node_details_from_description(description) self._config = None