- This method is used as map_async parameter. It receives tuple with all
- parameters as passed to map_async function.
-
- :param args: All parameters needed to setup one node.
- :type args: tuple
- :return: nothing
- :return: True - success, False - error
+ :param node: Node to create virtualenv on.
+ :type node: dict
+ :returns: nothing
+ :raises RuntimeError: When failed to setup virtualenv.
+ """
+ host = node['host']
+ logger.console('Virtualenv setup including requirements.txt on {0} starts.'
+ .format(host))
+ exec_cmd_no_error(
+ node, 'cd {0} && rm -rf env'
+ ' && virtualenv --system-site-packages --never-download env'
+ ' && source env/bin/activate && pip install -r requirements.txt'
+ .format(con.REMOTE_FW_DIR), timeout=100, include_reason=True,
+ message="Failed install at node {host}".format(host=host))
+ logger.console('Virtualenv setup on {0} done.'.format(host))
+
+
+def setup_node(node, tarball, remote_tarball, results=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.
+ :type node: dict
+ :type tarball: str
+ :type remote_tarball: str
+ :type results: list
+ :returns: True - success, False - error