def test_fetch_deploy_all_same_paths(self, mock_ensure,
                                         mock_local_exists,
                                         mock_remote_exists,
                                         mock_put, mock_get):
        env.host = 'any_host'
        get_files = set()
        put_files = set()

        def get(remote_path, local_path):
            get_files.add((local_path, remote_path))

        def put(local_path, remote_path):
            put_files.add((local_path, remote_path))

        mock_put.side_effect = put
        mock_get.side_effect = get

        # Local files don't exist for the fetch phase so we don't have to
        # worry about allow_overwrite behavior.
        mock_local_exists.return_value = False
        mock_remote_exists.return_value = True

        local_dir = 'any_dir'
        configure_cmds.fetch_all(local_dir)

        # Local files *do* exist for the deploy phase. If not, they'll be
        # skipped and the test will fail.
        mock_local_exists.return_value = True
        configure_cmds.deploy_all(local_dir)
        self.assertTrue(len(get_files) > 0)
        self.assertEquals(get_files, put_files)
示例#2
0
def upgrade(new_rpm_path, local_config_dir=None, overwrite=False):
    """
    Copy and upgrade a new presto-server rpm to all of the nodes in the
    cluster. Retains existing node configuration.

    The existing topology information is read from the config.json file.
    Unlike install, there is no provision to supply topology information
    interactively.

    The existing cluster configuration is collected from the nodes on the
    cluster and stored on the host running presto-admin. After the
    presto-server packages have been upgraded, presto-admin pushes the
    collected configuration back out to the hosts on the cluster.

    Note that the configuration files in /etc/opt/prestoadmin are not updated
    during upgrade.

    :param new_rpm_path -       The path to the new Presto RPM to
                                install
    :param local_config_dir -   (optional) Directory to store the cluster
                                configuration in. If not specified, a temp
                                directory is used.
    :param overwrite -          (optional) if set to True then existing
                                configuration will be orerwriten.

    :param --nodeps -           (optional) Flag to indicate if server upgrade
                                should ignore checking Presto rpm package
                                dependencies. Equivalent to adding --nodeps
                                flag to rpm -U.
    """
    stop()

    if not local_config_dir:
        local_config_dir = mkdtemp()
        print('Saving cluster configuration to %s' % local_config_dir)

    configure_cmds.gather_directory(local_config_dir, overwrite)
    filenames = connector.gather_connectors(local_config_dir, overwrite)

    package.deploy_upgrade(new_rpm_path)

    configure_cmds.deploy_all(local_config_dir)
    connector.deploy_files(filenames,
                           os.path.join(local_config_dir, env.host, 'catalog'),
                           constants.REMOTE_CATALOG_DIR,
                           PRESTO_STANDALONE_USER_GROUP)
示例#3
0
def upgrade(new_rpm_path, local_config_dir=None, overwrite=False):
    """
    Copy and upgrade a new presto-server rpm to all of the nodes in the
    cluster. Retains existing node configuration.

    The existing topology information is read from the config.json file.
    Unlike install, there is no provision to supply topology information
    interactively.

    The existing cluster configuration is collected from the nodes on the
    cluster and stored on the host running presto-admin. After the
    presto-server packages have been upgraded, presto-admin pushes the
    collected configuration back out to the hosts on the cluster.

    Note that the configuration files in /etc/opt/prestoadmin are not updated
    during upgrade.

    :param new_rpm_path -       The path to the new Presto RPM to
                                install
    :param local_config_dir -   (optional) Directory to store the cluster
                                configuration in. If not specified, a temp
                                directory is used.
    :param overwrite -          (optional) if set to True then existing
                                configuration will be orerwriten.

    :param --nodeps -           (optional) Flag to indicate if server upgrade
                                should ignore checking Presto rpm package
                                dependencies. Equivalent to adding --nodeps
                                flag to rpm -U.
    """
    stop()

    if not local_config_dir:
        local_config_dir = mkdtemp()
        print('Saving cluster configuration to %s' % local_config_dir)

    configure_cmds.gather_directory(local_config_dir, overwrite)
    filenames = connector.gather_connectors(local_config_dir, overwrite)

    package.deploy_upgrade(new_rpm_path)

    configure_cmds.deploy_all(local_config_dir)
    connector.deploy_files(
        filenames,
        os.path.join(local_config_dir, env.host, 'catalog'),
        constants.REMOTE_CATALOG_DIR, PRESTO_STANDALONE_USER_GROUP)
示例#4
0
def upgrade(local_package_path, local_config_dir=None):
    """
    Copy and upgrade a new presto-server rpm to all of the nodes in the
    cluster. Retains existing node configuration.

    The existing topology information is read from the config.json file.
    Unlike install, there is no provision to supply topology information
    interactively.

    The existing cluster configuration is collected from the nodes on the
    cluster and stored on the host running presto-admin. After the
    presto-server packages have been upgraded, presto-admin pushes the
    collected configuration back out to the hosts on the cluster.

    Note that the configuration files in /etc/opt/prestoadmin are not updated
    during upgrade.

    :param local_package_path - Absolute path to the presto rpm to be
                                installed
    :param local_config_dir -   (optional) Directory to store the cluster
                                configuration in. If not specified, a temp
                                directory is used.
    """
    stop()

    if not local_config_dir:
        local_config_dir = mkdtemp()
        print('Saving cluster configuration to %s' % local_config_dir)

    configure_cmds.gather_directory(local_config_dir)
    filenames = connector.gather_connectors(local_config_dir)

    package.deploy_upgrade(local_package_path)

    configure_cmds.deploy_all(local_config_dir)
    connector.deploy_files(
        filenames,
        os.path.join(local_config_dir, env.host, 'catalog'),
        constants.REMOTE_CATALOG_DIR
    )
示例#5
0
def upgrade(local_package_path, local_config_dir=None):
    """
    Copy and upgrade a new presto-server rpm to all of the nodes in the
    cluster. Retains existing node configuration.

    The existing topology information is read from the config.json file.
    Unlike install, there is no provision to supply topology information
    interactively.

    The existing cluster configuration is collected from the nodes on the
    cluster and stored on the host running presto-admin. After the
    presto-server packages have been upgraded, presto-admin pushes the
    collected configuration back out to the hosts on the cluster.

    Note that the configuration files in /etc/opt/prestoadmin are not updated
    during upgrade.

    :param local_package_path - Absolute path to the presto rpm to be
                                installed
    :param local_config_dir -   (optional) Directory to store the cluster
                                configuration in. If not specified, a temp
                                directory is used.
    """
    stop()

    if not local_config_dir:
        local_config_dir = mkdtemp()
        print('Saving cluster configuration to %s' % local_config_dir)

    configure_cmds.gather_directory(local_config_dir)
    filenames = connector.gather_connectors(local_config_dir)

    package.deploy_upgrade(local_package_path)

    configure_cmds.deploy_all(local_config_dir)
    connector.deploy_files(filenames,
                           os.path.join(local_config_dir, env.host, 'catalog'),
                           constants.REMOTE_CATALOG_DIR)