Ejemplo n.º 1
0
    def test_info(self, rpm_command):
        test_pkg = 'http://www.site.com/rpms/vim-common-7.3.682-1.fc17.x86_64.rpm'
        rpm_command.return_value = ('vim-common-7.3.682-1.fc17.x86_64', '', 0)
 
        mgr = pkgmgr.RpmPackageMgr()
        result = mgr.info(test_pkg)
 
        rpm_command.assert_called_once_with('-q vim-common-7.3.682-1.fc17.x86_64', raise_exc=False)
        assert result == {'candidate': None,
                                          'installed': '7.3.682-1.fc17.x86_64'}
Ejemplo n.º 2
0
    def check(self):
        if linux.os['family'] in ('RedHat', 'Oracle'):
            # Avoid "Can't locate Time/HiRes.pm in @INC"
            # with InnoDB Backup Utility v1.5.1-xtrabackup
            pkgmgr.installed('perl-Time-HiRes')

        mgr = pkgmgr.package_mgr()
        if not 'percona' in mgr.repos():
            if linux.os['family'] in ('RedHat', 'Oracle'):
                url = 'http://www.percona.com/downloads/percona-release/percona-release-0.0-1.%s.rpm' % linux.os[
                    'arch']
                pkgmgr.RpmPackageMgr().install(url)
            else:
                codename = linux.ubuntu_release_to_codename[
                    linux.os['lsb_release']]
                pkgmgr.apt_source(
                    'percona.list',
                    ['deb http://repo.percona.com/apt %s main' % codename],
                    gpg_keyserver='hkp://keys.gnupg.net',
                    gpg_keyid='CD2EFD2A')
            mgr.updatedb()

        return super(PerconaExec, self).check()
Ejemplo n.º 3
0
    def test_updatedb(self, system):
        mgr = pkgmgr.RpmPackageMgr()
        mgr.updatedb()
 
        assert not system.called
Ejemplo n.º 4
0
    def test_remove(self, rpm_command):
        mgr = pkgmgr.RpmPackageMgr()
        mgr.remove('test.rpm', True)
 
        rpm_command.assert_called_once_with('-e test.rpm', raise_exc=True)
Ejemplo n.º 5
0
    def test_install(self, rpm_command):
        mgr = pkgmgr.RpmPackageMgr()
        mgr.install('test.rpm', 1.1, True, test_kwd=True)
 
        rpm_command.assert_called_once_with('-Uvh test.rpm', raise_exc=True, test_kwd=True)
Ejemplo n.º 6
0
    def test_rpm_command(self, system):
        mgr = pkgmgr.RpmPackageMgr()
        mgr.rpm_command('-Uvh test.rpm', raise_exc=True)
 
        system.assert_called_once_with(['/usr/bin/rpm', '-Uvh', 'test.rpm'], raise_exc=True)