Ejemplo n.º 1
0
 def test_deploy_files(self, put_mock, sudo_mock):
     local_dir = '/my/local/dir'
     remote_dir = '/my/remote/dir'
     connector.deploy_files(['a', 'b'], local_dir, remote_dir)
     sudo_mock.assert_called_with('mkdir -p %s' % remote_dir)
     put_mock.assert_any_call('/my/local/dir/a', remote_dir, use_sudo=True)
     put_mock.assert_any_call('/my/local/dir/b', remote_dir, use_sudo=True)
Ejemplo n.º 2
0
 def test_deploy_files(self, put_mock, sudo_mock):
     local_dir = '/my/local/dir'
     remote_dir = '/my/remote/dir'
     connector.deploy_files(['a', 'b'], local_dir, remote_dir)
     sudo_mock.assert_called_with('mkdir -p %s' % remote_dir)
     put_mock.assert_any_call('/my/local/dir/a', remote_dir, use_sudo=True)
     put_mock.assert_any_call('/my/local/dir/b', remote_dir, use_sudo=True)
Ejemplo n.º 3
0
 def test_deploy_files(self, put_mock, sudo_mock):
     local_dir = '/my/local/dir'
     remote_dir = '/my/remote/dir'
     connector.deploy_files(['a', 'b'], local_dir, remote_dir,
                            PRESTO_STANDALONE_USER_GROUP)
     sudo_mock.assert_called_with('mkdir -p %s' % remote_dir)
     put_mock.assert_any_call('/my/local/dir/a', remote_dir, use_sudo=True,
                              mode=0600)
     put_mock.assert_any_call('/my/local/dir/b', remote_dir, use_sudo=True,
                              mode=0600)
Ejemplo n.º 4
0
 def test_deploy_files(self, put_mock, sudo_mock):
     local_dir = '/my/local/dir'
     remote_dir = '/my/remote/dir'
     connector.deploy_files(['a', 'b'], local_dir, remote_dir,
                            PRESTO_STANDALONE_USER_GROUP)
     sudo_mock.assert_called_with('mkdir -p %s' % remote_dir)
     put_mock.assert_any_call('/my/local/dir/a',
                              remote_dir,
                              use_sudo=True,
                              mode=0600)
     put_mock.assert_any_call('/my/local/dir/b',
                              remote_dir,
                              use_sudo=True,
                              mode=0600)
Ejemplo n.º 5
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)
Ejemplo n.º 6
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)
Ejemplo n.º 7
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
    )
Ejemplo n.º 8
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)