def _list(self): # TODO list_nodes return type is Dict[str, Node] but returns list nodes = self.controller.list_nodes() return [ Node(node.name(), self.controller, self.private_ssh_key_path) for node in nodes ]
def gather_sosreport_from_node(node: Node, destination_dir: str): try: node.upload_file(SOSREPORT_SCRIPT, "/tmp/man_sosreport.sh") node.run_command("chmod a+x /tmp/man_sosreport.sh") node.run_command("sudo /tmp/man_sosreport.sh") node.download_file(f"/tmp/sosreport.tar.bz2", os.path.join(destination_dir, f"sosreport-{node.name}.tar.bz2")) except (TimeoutError, RuntimeError, SSHException): log.exception("Failed accessing node %s for sosreport data gathering", node)
def list_nodes_with_name_filter(self, name_filter) -> List[Node]: logging.info("Listing current hosts with name filter %s", name_filter) nodes = list() domains = self.libvirt_connection.listAllDomains() for domain in domains: domain_name = domain.name() if name_filter and name_filter not in domain_name: continue if (consts.NodeRoles.MASTER in domain_name) or (consts.NodeRoles.WORKER in domain_name): nodes.append(Node(domain_name, self, self.private_ssh_key_path)) logging.info("Found domains %s", [node.name for node in nodes]) return nodes
def _list(self): nodes = self.controller.list_nodes() return [ Node(node.name(), self.controller, self.private_ssh_key_path) for node in nodes ]
def vsphere_vm_to_node(terraform_vm_state): return Node(name=terraform_vm_state["attributes"]["name"], private_ssh_key_path=self._config.private_ssh_key_path, node_controller=self)