Merge "trivial: Remove dead code"
This commit is contained in:
commit
759ecdfb21
|
@ -170,14 +170,6 @@ class GenericUtilsTestCase(test.NoDBTestCase):
|
|||
self.assertEqual(fake_execute.uid, 2)
|
||||
self.assertEqual(fake_execute.uid, os.getuid())
|
||||
|
||||
def test_xhtml_escape(self):
|
||||
self.assertEqual('"foo"', utils.xhtml_escape('"foo"'))
|
||||
self.assertEqual(''foo'', utils.xhtml_escape("'foo'"))
|
||||
self.assertEqual('&', utils.xhtml_escape('&'))
|
||||
self.assertEqual('>', utils.xhtml_escape('>'))
|
||||
self.assertEqual('<', utils.xhtml_escape('<'))
|
||||
self.assertEqual('<foo>', utils.xhtml_escape('<foo>'))
|
||||
|
||||
def test_get_shortened_ipv6(self):
|
||||
self.assertEqual("abcd:ef01:2345:6789:abcd:ef01:c0a8:fefe",
|
||||
utils.get_shortened_ipv6(
|
||||
|
@ -247,21 +239,6 @@ class GenericUtilsTestCase(test.NoDBTestCase):
|
|||
cmd = utils.get_root_helper()
|
||||
self.assertEqual('sudo nova-rootwrap foo', cmd)
|
||||
|
||||
@mock.patch('nova.utils.RootwrapProcessHelper')
|
||||
def test_get_root_helper_proc(self, mock_proc_helper):
|
||||
self.flags(use_rootwrap_daemon=False)
|
||||
self.flags(rootwrap_config="/path/to/conf")
|
||||
utils._get_rootwrap_helper()
|
||||
mock_proc_helper.assert_called_once_with()
|
||||
|
||||
@mock.patch('nova.utils.RootwrapDaemonHelper')
|
||||
def test_get_root_helper_daemon(self, mock_daemon_helper):
|
||||
conf_path = '/path/to/conf'
|
||||
self.flags(use_rootwrap_daemon=True)
|
||||
self.flags(rootwrap_config=conf_path)
|
||||
utils._get_rootwrap_helper()
|
||||
mock_daemon_helper.assert_called_once_with(conf_path)
|
||||
|
||||
def test_use_sudo(self):
|
||||
self.flags(disable_rootwrap=True, group='workarounds')
|
||||
cmd = utils.get_root_helper()
|
||||
|
|
|
@ -35,7 +35,6 @@ import sys
|
|||
import tempfile
|
||||
import textwrap
|
||||
import time
|
||||
from xml.sax import saxutils
|
||||
|
||||
import eventlet
|
||||
import netaddr
|
||||
|
@ -163,13 +162,6 @@ def get_root_helper():
|
|||
return cmd
|
||||
|
||||
|
||||
def _get_rootwrap_helper():
|
||||
if CONF.use_rootwrap_daemon:
|
||||
return RootwrapDaemonHelper(CONF.rootwrap_config)
|
||||
else:
|
||||
return RootwrapProcessHelper()
|
||||
|
||||
|
||||
class RootwrapProcessHelper(object):
|
||||
def trycmd(self, *cmd, **kwargs):
|
||||
kwargs['root_helper'] = get_root_helper()
|
||||
|
@ -330,11 +322,6 @@ DEFAULT_PASSWORD_SYMBOLS = ('23456789', # Removed: 0,1
|
|||
'abcdefghijkmnopqrstuvwxyz') # Removed: l
|
||||
|
||||
|
||||
# ~5 bits per symbol
|
||||
EASIER_PASSWORD_SYMBOLS = ('23456789', # Removed: 0, 1
|
||||
'ABCDEFGHJKLMNPQRSTUVWXYZ') # Removed: I, O
|
||||
|
||||
|
||||
def last_completed_audit_period(unit=None, before=None):
|
||||
"""This method gives you the most recently *completed* audit period.
|
||||
|
||||
|
@ -480,13 +467,7 @@ def get_my_linklocal(interface):
|
|||
raise exception.NovaException(msg)
|
||||
|
||||
|
||||
def xhtml_escape(value):
|
||||
"""Escapes a string so it is valid within XML or XHTML.
|
||||
|
||||
"""
|
||||
return saxutils.escape(value, {'"': '"', "'": '''})
|
||||
|
||||
|
||||
# TODO(sfinucan): Replace this with the equivalent from oslo.utils
|
||||
def utf8(value):
|
||||
"""Try to turn a string into utf-8 if possible.
|
||||
|
||||
|
@ -503,13 +484,6 @@ def utf8(value):
|
|||
return value.encode('utf-8')
|
||||
|
||||
|
||||
def check_isinstance(obj, cls):
|
||||
"""Checks that obj is of type cls, and lets PyLint infer types."""
|
||||
if isinstance(obj, cls):
|
||||
return obj
|
||||
raise Exception(_('Expected object of type: %s') % (str(cls)))
|
||||
|
||||
|
||||
def parse_server_string(server_str):
|
||||
"""Parses the given server_string and returns a tuple of host and port.
|
||||
If it's not a combination of host part and port, the port element
|
||||
|
|
|
@ -28,7 +28,6 @@ import six
|
|||
|
||||
import nova.conf
|
||||
from nova.i18n import _, _LE, _LI
|
||||
from nova import utils
|
||||
from nova.virt import event as virtevent
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
@ -1624,10 +1623,16 @@ def load_compute_driver(virtapi, compute_driver=None):
|
|||
driver = importutils.import_object(
|
||||
'nova.virt.%s' % compute_driver,
|
||||
virtapi)
|
||||
return utils.check_isinstance(driver, ComputeDriver)
|
||||
if isinstance(driver, ComputeDriver):
|
||||
return driver
|
||||
raise ValueError()
|
||||
except ImportError:
|
||||
LOG.exception(_LE("Unable to load the virtualization driver"))
|
||||
sys.exit(1)
|
||||
except ValueError:
|
||||
LOG.exception("Compute driver '%s' from 'nova.virt' is not of type"
|
||||
"'%s'", compute_driver, str(ComputeDriver))
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def is_xenapi():
|
||||
|
|
Loading…
Reference in New Issue