Exemplo n.º 1
0
 def test_os_version_from_bad_package(self, mocked_error):
     '''Test deriving OpenStack version from an uninstalled package'''
     with patch('apt_pkg.Cache') as cache:
         cache.return_value = self._apt_cache()
         try:
             openstack.get_os_version_package('foo')
         except:
             # ignore exceptions that raise when error_out is mocked
             # and doesn't sys.exit(1)
             pass
         e = 'Could not determine version of package with no installation '\
             'candidate: foo'
         mocked_error.assert_called_with(e)
Exemplo n.º 2
0
def assert_libvirt_rbd_imagebackend_allowed():
    os_rel = "Juno"
    os_ver = get_os_version_package('nova-common')
    if float(os_ver) < float(get_os_version_codename(os_rel.lower())):
        msg = ("Libvirt RBD imagebackend only supported for openstack >= %s" %
               os_rel)
        raise Exception(msg)

    return True
def assert_libvirt_rbd_imagebackend_allowed():
    os_rel = "Juno"
    os_ver = get_os_version_package('nova-common')
    if float(os_ver) < float(get_os_version_codename(os_rel.lower())):
        msg = ("Libvirt RBD imagebackend only supported for openstack >= %s" %
               os_rel)
        raise Exception(msg)

    return True
Exemplo n.º 4
0
 def test_os_version_from_package(self, mocked_error):
     '''Test deriving OpenStack version from an installed package'''
     with patch('apt_pkg.Cache') as cache:
         cache.return_value = self._apt_cache()
         for pkg, vers in six.iteritems(FAKE_REPO):
             if pkg.startswith('bad-'):
                 continue
             if 'pkg_vers' not in vers:
                 continue
             self.assertEquals(openstack.get_os_version_package(pkg),
                               vers['os_version'])
Exemplo n.º 5
0
 def test_os_version_from_bad_package_nonfatal(self):
     '''Test OpenStack version from an uninstalled package is non-fatal'''
     with patch('apt_pkg.Cache') as cache:
         cache.return_value = self._apt_cache()
         self.assertEquals(
             None, openstack.get_os_version_package('foo', fatal=False))