Merge "Remove unused utils.find_config function"
This commit is contained in:
commit
657943b0cb
|
@ -66,18 +66,6 @@ class ExecuteTestCase(test.TestCase):
|
|||
|
||||
|
||||
class GenericUtilsTestCase(test.TestCase):
|
||||
|
||||
@mock.patch('os.path.exists', return_value=True)
|
||||
def test_find_config(self, mock_exists):
|
||||
path = '/etc/cinder/cinder.conf'
|
||||
cfgpath = utils.find_config(path)
|
||||
self.assertEqual(path, cfgpath)
|
||||
|
||||
mock_exists.return_value = False
|
||||
self.assertRaises(exception.ConfigNotFound,
|
||||
utils.find_config,
|
||||
path)
|
||||
|
||||
def test_as_int(self):
|
||||
test_obj_int = '2'
|
||||
test_obj_float = '2.2'
|
||||
|
|
|
@ -70,29 +70,6 @@ TRACE_API = False
|
|||
synchronized = lockutils.synchronized_with_prefix('cinder-')
|
||||
|
||||
|
||||
def find_config(config_path):
|
||||
"""Find a configuration file using the given hint.
|
||||
|
||||
:param config_path: Full or relative path to the config.
|
||||
:returns: Full path of the config, if it exists.
|
||||
:raises: `cinder.exception.ConfigNotFound`
|
||||
|
||||
"""
|
||||
possible_locations = [
|
||||
config_path,
|
||||
os.path.join(CONF.state_path, "etc", "cinder", config_path),
|
||||
os.path.join(CONF.state_path, "etc", config_path),
|
||||
os.path.join(CONF.state_path, config_path),
|
||||
"/etc/cinder/%s" % config_path,
|
||||
]
|
||||
|
||||
for path in possible_locations:
|
||||
if os.path.exists(path):
|
||||
return os.path.abspath(path)
|
||||
|
||||
raise exception.ConfigNotFound(path=os.path.abspath(config_path))
|
||||
|
||||
|
||||
def as_int(obj, quiet=True):
|
||||
# Try "2" -> 2
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue