+ :param node: Node to create virtualenv on.
+ :type node: dict
+ :returns: Stdout and stderr.
+ :rtype: str, str
+ :raises RuntimeError: When failed to setup virtualenv.
+ """
+ logger.console(
+ f"Virtualenv setup including requirements.txt on {node[u'type']} "
+ f"host {node[u'host']}, port {node[u'port']} starts."
+ )
+ cmd = f"cd {con.REMOTE_FW_DIR} && rm -rf env && virtualenv " \
+ f"-p $(which python3) --system-site-packages --never-download env " \
+ f"&& source env/bin/activate && ANSIBLE_SKIP_CONFLICT_CHECK=1 " \
+ f"pip3 install -r requirements.txt"
+ stdout, stderr = exec_cmd_no_error(
+ node, cmd, timeout=300, include_reason=True, export=False,
+ message=f"Failed install at node {node[u'type']} host {node[u'host']}, "
+ f"port {node[u'port']}"
+ )
+ logger.console(
+ f"Virtualenv setup on {node[u'type']} host {node[u'host']}, "
+ f"port {node[u'port']} done."
+ )
+ return stdout, stderr
+
+
+def setup_node(node, tarball, remote_tarball, results=None, logs=None):
+ """Copy a tarball to a node and extract it.
+
+ :param node: A node where the tarball will be copied and extracted.
+ :param tarball: Local path of tarball to be copied.
+ :param remote_tarball: Remote path of the tarball.
+ :param results: A list where to store the result of node setup, optional.
+ :param logs: A list where to store anything that should be logged.
+ :type node: dict
+ :type tarball: str
+ :type remote_tarball: str
+ :type results: list
+ :type logs: list
+ :returns: True - success, False - error
+ :rtype: bool