def _check_package(self, package_name, executable_name): pkgmgr = RedHatPackageManager() is_installed_before = self._is_package_seems_to_be_installed(package_name, executable_name) self.assertEqual(pkgmgr.is_package_installed(package_name), is_installed_before) # Do the opposite pkgmgr.install_package(package_name) if not is_installed_before else pkgmgr.remove_package(package_name) self.assertNotEqual(pkgmgr.is_package_installed(package_name), is_installed_before)
def is_installed(self): ''' In linux, return True if iSCSI initiator sw is installed otherwise return False ''' platform = get_platform_string() if any(dist in platform for dist in ('redhat', 'centos', 'oracle')): pkgmgr = infi.pkgmgr.get_package_manager() return pkgmgr.is_package_installed('iscsi-initiator-utils') if any(dist in platform for dist in ('ubuntu', 'suse')): pkgmgr = infi.pkgmgr.get_package_manager() return pkgmgr.is_package_installed('open-iscsi')
def is_installed(self): ''' In linux, return True if iSCSI initiator sw is installed otherwise return False ''' if 'centos' in get_platform_string( ) or 'redhat' in get_platform_string(): pkgmgr = infi.pkgmgr.get_package_manager() return pkgmgr.is_package_installed('iscsi-initiator-utils') if 'ubuntu' in get_platform_string() or 'suse' in get_platform_string( ): pkgmgr = infi.pkgmgr.get_package_manager() return pkgmgr.is_package_installed('open-iscsi')
def test_check_unknown_package(self): pkgmgr = UbuntuPackageManager() self.assertFalse(pkgmgr.is_package_installed('blablabla9988ok'))