Esempio n. 1
0
    def test_rpm_uninstall_nodeps(self, mock_sudo):
        env.host = 'any_host'
        env.nodeps = True

        package.rpm_uninstall('anyrpm')

        mock_sudo.assert_called_with('rpm -e --nodeps anyrpm')
Esempio n. 2
0
    def test_rpm_uninstall_nodeps(self, mock_sudo):
        env.host = 'any_host'
        env.nodeps = True

        package.rpm_uninstall('anyrpm')

        mock_sudo.assert_called_with('rpm -e --nodeps anyrpm')
Esempio n. 3
0
    def test_rpm_uninstall_non_existing_with_force(self, mock_sudo, mock_is_rpm_installed):
        env.host = 'any_host'
        env.force = True
        env.nodeps = False
        mock_is_rpm_installed.return_value = False

        package.rpm_uninstall('anyrpm')

        self.assertTrue(mock_sudo.call_count == 0)
Esempio n. 4
0
    def test_rpm_uninstall_non_existing_with_force(self, mock_sudo,
                                                   mock_is_rpm_installed):
        env.host = 'any_host'
        env.force = True
        env.nodeps = False
        mock_is_rpm_installed.return_value = False

        package.rpm_uninstall('anyrpm')

        self.assertTrue(mock_sudo.call_count == 0)
Esempio n. 5
0
    def test_rpm_uninstall_non_existing(self, mock_is_rpm_installed):
        env.host = 'any_host'
        env.force = False
        mock_is_rpm_installed.return_value = False

        try:
            package.rpm_uninstall('anyrpm')
            self.fail('expected exception to be raised here')
        except SystemExit, e:
            self.assertEqual(e.message, '[any_host] Package is not installed: anyrpm')
Esempio n. 6
0
    def test_rpm_uninstall_non_existing(self, mock_is_rpm_installed):
        env.host = 'any_host'
        env.force = False
        mock_is_rpm_installed.return_value = False

        try:
            package.rpm_uninstall('anyrpm')
            self.fail('expected exception to be raised here')
        except SystemExit, e:
            self.assertEqual(e.message,
                             '[any_host] Package is not installed: anyrpm')
Esempio n. 7
0
def uninstall():
    """
    Uninstall Presto after stopping the services on all nodes

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

    if package.is_rpm_installed('presto'):
        package.rpm_uninstall('presto')
    elif package.is_rpm_installed('prestosql'):
        package.rpm_uninstall('prestosql')
    elif package.is_rpm_installed('presto-server'):
        package.rpm_uninstall('presto-server')
    elif package.is_rpm_installed('presto-server-rpm'):
        package.rpm_uninstall('presto-server-rpm')
    elif package.is_rpm_installed('starburst-presto-server-rpm'):
        package.rpm_uninstall('starburst-presto-server-rpm')
    else:
        abort('Unable to uninstall package on: ' + env.host)
Esempio n. 8
0
def uninstall():
    """
    Uninstall Presto after stopping the services on all nodes

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

    if package.is_rpm_installed('presto'):
        package.rpm_uninstall('presto')
    elif package.is_rpm_installed('presto-server'):
        package.rpm_uninstall('presto-server')
    elif package.is_rpm_installed('presto-server-rpm'):
        package.rpm_uninstall('presto-server-rpm')
    else:
        abort('Unable to uninstall package on: ' + env.host)