[Minor] Fix misspellings of "insufficient"
In a few places in the codebase, "insufficient" is misspelled as "insufficent," which includes function names and exception class names. This can be inconvenient for writing and debugging code, in which case one would raise an exception/call a function and get an error that is resolved by intentionally misspelling the function call. The changes made here are mostly to the names of exceptions and functions but also include some other instances of this misspelling in docstrings, policy descriptions, etc. There were also some strings describing policies in ironic/common/policy.py that were missing spaces, which were also fixed. Story: 2010089 Task: 45604 Change-Id: I7b65c449d5d30ca30f537a95a3ffd365492e0274
This commit is contained in:
parent
0659485d63
commit
94f9745f0c
@ -819,8 +819,8 @@ class AgentInProgress(IronicException):
|
||||
'presently executing a command. Error %(error)s')
|
||||
|
||||
|
||||
class InsufficentMemory(IronicException):
|
||||
_msg_fmt = _("Available memory at %(free)s, Insufficent as %(required)s "
|
||||
class InsufficientMemory(IronicException):
|
||||
_msg_fmt = _("Available memory at %(free)s, Insufficient as %(required)s "
|
||||
"is required to proceed at this time.")
|
||||
|
||||
|
||||
|
@ -411,7 +411,7 @@ def image_to_raw(image_href, path, path_tmp):
|
||||
if fmt != "raw":
|
||||
staged = "%s.converted" % path
|
||||
|
||||
utils.is_memory_insufficent(raise_if_fail=True)
|
||||
utils.is_memory_insufficient(raise_if_fail=True)
|
||||
LOG.debug("%(image)s was %(format)s, converting to raw",
|
||||
{'image': image_href, 'format': fmt})
|
||||
with fileutils.remove_path_on_error(staged):
|
||||
|
@ -474,8 +474,8 @@ node_policies = [
|
||||
name='baremetal:node:get:last_error',
|
||||
check_str=SYSTEM_OR_OWNER_READER,
|
||||
scope_types=['system', 'project'],
|
||||
description='Governs if the node last_error field is masked from API'
|
||||
'clients with insufficent privileges.',
|
||||
description='Governs if the node last_error field is masked from API '
|
||||
'clients with insufficient privileges.',
|
||||
operations=[{'path': '/nodes/{node_ident}', 'method': 'GET'}],
|
||||
deprecated_rule=deprecated_node_get
|
||||
),
|
||||
@ -483,8 +483,8 @@ node_policies = [
|
||||
name='baremetal:node:get:reservation',
|
||||
check_str=SYSTEM_OR_OWNER_READER,
|
||||
scope_types=['system', 'project'],
|
||||
description='Governs if the node reservation field is masked from API'
|
||||
'clients with insufficent privileges.',
|
||||
description='Governs if the node reservation field is masked from API '
|
||||
'clients with insufficient privileges.',
|
||||
operations=[{'path': '/nodes/{node_ident}', 'method': 'GET'}],
|
||||
deprecated_rule=deprecated_node_get
|
||||
),
|
||||
@ -493,7 +493,7 @@ node_policies = [
|
||||
check_str=SYSTEM_OR_OWNER_READER,
|
||||
scope_types=['system', 'project'],
|
||||
description='Governs if the node driver_internal_info field is '
|
||||
'masked from API clients with insufficent privileges.',
|
||||
'masked from API clients with insufficient privileges.',
|
||||
operations=[{'path': '/nodes/{node_ident}', 'method': 'GET'}],
|
||||
deprecated_rule=deprecated_node_get
|
||||
),
|
||||
@ -501,8 +501,8 @@ node_policies = [
|
||||
name='baremetal:node:get:driver_info',
|
||||
check_str=SYSTEM_OR_OWNER_READER,
|
||||
scope_types=['system', 'project'],
|
||||
description='Governs if the driver_info field is masked from API'
|
||||
'clients with insufficent privileges.',
|
||||
description='Governs if the driver_info field is masked from API '
|
||||
'clients with insufficient privileges.',
|
||||
operations=[{'path': '/nodes/{node_ident}', 'method': 'GET'}],
|
||||
deprecated_rule=deprecated_node_get
|
||||
),
|
||||
|
@ -592,7 +592,7 @@ def _get_mb_ram_available():
|
||||
return psutil.virtual_memory().available / 1024 / 1024
|
||||
|
||||
|
||||
def is_memory_insufficent(raise_if_fail=False):
|
||||
def is_memory_insufficient(raise_if_fail=False):
|
||||
"""Checks available system memory and holds the deployment process.
|
||||
|
||||
Evaluates the current system memory available, meaning can be
|
||||
@ -601,15 +601,15 @@ def is_memory_insufficent(raise_if_fail=False):
|
||||
or until it has timed out.
|
||||
|
||||
This method will issue a sleep, if the amount of available memory is
|
||||
insufficent. This is configured using the
|
||||
insufficient. This is configured using the
|
||||
``[DEFAULT]minimum_memory_wait_time`` and the
|
||||
``[DEFAULT]minimum_memory_wait_retries``.
|
||||
|
||||
:param raise_if_fail: Default False, but if set to true an
|
||||
InsufficentMemory exception is raised
|
||||
upon insufficent memory.
|
||||
InsufficientMemory exception is raised
|
||||
upon insufficient memory.
|
||||
:returns: True if the check has timed out. Otherwise None is returned.
|
||||
:raises: InsufficentMemory if the raise_if_fail parameter is set to
|
||||
:raises: InsufficientMemory if the raise_if_fail parameter is set to
|
||||
True.
|
||||
"""
|
||||
required_memory = CONF.minimum_required_memory
|
||||
@ -633,7 +633,7 @@ def is_memory_insufficent(raise_if_fail=False):
|
||||
'exceeded retries.',
|
||||
log_values)
|
||||
if raise_if_fail:
|
||||
raise exception.InsufficentMemory(
|
||||
raise exception.InsufficientMemory(
|
||||
free=_get_mb_ram_available(),
|
||||
required=required_memory)
|
||||
return True
|
||||
|
@ -818,7 +818,7 @@ def get_image_instance_info(node):
|
||||
|
||||
error_msg = (_("Cannot validate image information for node %s because one "
|
||||
"or more parameters are missing from its instance_info and "
|
||||
"insufficent information is present to boot from a remote "
|
||||
"insufficient information is present to boot from a remote "
|
||||
"volume")
|
||||
% node.uuid)
|
||||
check_for_missing_params(info, error_msg)
|
||||
|
@ -441,31 +441,31 @@ class TempFilesTestCase(base.TestCase):
|
||||
|
||||
@mock.patch.object(time, 'sleep', autospec=True)
|
||||
@mock.patch.object(psutil, 'virtual_memory', autospec=True)
|
||||
def test_is_memory_insufficent(self, mock_vm_check, mock_sleep):
|
||||
def test_is_memory_insufficient(self, mock_vm_check, mock_sleep):
|
||||
|
||||
class vm_check(object):
|
||||
available = 1000000000
|
||||
|
||||
mock_vm_check.return_value = vm_check
|
||||
self.assertTrue(utils.is_memory_insufficent())
|
||||
self.assertTrue(utils.is_memory_insufficient())
|
||||
self.assertEqual(14, mock_vm_check.call_count)
|
||||
|
||||
@mock.patch.object(time, 'sleep', autospec=True)
|
||||
@mock.patch.object(psutil, 'virtual_memory', autospec=True)
|
||||
def test_is_memory_insufficent_good(self, mock_vm_check,
|
||||
mock_sleep):
|
||||
def test_is_memory_insufficient_good(self, mock_vm_check,
|
||||
mock_sleep):
|
||||
|
||||
class vm_check(object):
|
||||
available = 3276700000
|
||||
|
||||
mock_vm_check.return_value = vm_check
|
||||
self.assertFalse(utils.is_memory_insufficent())
|
||||
self.assertFalse(utils.is_memory_insufficient())
|
||||
self.assertEqual(1, mock_vm_check.call_count)
|
||||
|
||||
@mock.patch.object(time, 'sleep', autospec=True)
|
||||
@mock.patch.object(psutil, 'virtual_memory', autospec=True)
|
||||
def test_is_memory_insufficent_recovers(self, mock_vm_check,
|
||||
mock_sleep):
|
||||
def test_is_memory_insufficient_recovers(self, mock_vm_check,
|
||||
mock_sleep):
|
||||
|
||||
class vm_check_bad(object):
|
||||
available = 1023000000
|
||||
@ -477,20 +477,20 @@ class TempFilesTestCase(base.TestCase):
|
||||
mock_vm_check.side_effect = iter([vm_check_bad,
|
||||
vm_check_bad,
|
||||
vm_check_good])
|
||||
self.assertFalse(utils.is_memory_insufficent())
|
||||
self.assertFalse(utils.is_memory_insufficient())
|
||||
self.assertEqual(3, mock_vm_check.call_count)
|
||||
|
||||
@mock.patch.object(time, 'sleep', autospec=True)
|
||||
@mock.patch.object(psutil, 'virtual_memory', autospec=True)
|
||||
def test_is_memory_insufficent_warning_only(self, mock_vm_check,
|
||||
mock_sleep):
|
||||
def test_is_memory_insufficient_warning_only(self, mock_vm_check,
|
||||
mock_sleep):
|
||||
self.config(minimum_memory_warning_only=True)
|
||||
|
||||
class vm_check_bad(object):
|
||||
available = 1023000000
|
||||
|
||||
mock_vm_check.side_effect = vm_check_bad
|
||||
self.assertFalse(utils.is_memory_insufficent())
|
||||
self.assertFalse(utils.is_memory_insufficient())
|
||||
self.assertEqual(2, mock_vm_check.call_count)
|
||||
|
||||
|
||||
|
@ -55,7 +55,7 @@ class CinderInterfaceTestCase(db_base.DbTestCase):
|
||||
mock_log.error.assert_called_with(expected)
|
||||
|
||||
@mock.patch.object(cinder, 'LOG', autospec=True)
|
||||
def test__generate_connector_raises_with_insufficent_data(self, mock_log):
|
||||
def test__generate_connector_raises_with_insufficient_data(self, mock_log):
|
||||
with task_manager.acquire(self.context, self.node.id) as task:
|
||||
self.assertRaises(exception.StorageError,
|
||||
self.interface._generate_connector,
|
||||
|
@ -73,9 +73,9 @@ class TestImageCacheFetch(BaseTest):
|
||||
mock_download,
|
||||
mock_clean_up,
|
||||
mock_image_service):
|
||||
mock_fetch.side_effect = exception.InsufficentMemory
|
||||
mock_fetch.side_effect = exception.InsufficientMemory
|
||||
self.cache.master_dir = None
|
||||
self.assertRaises(exception.InsufficentMemory,
|
||||
self.assertRaises(exception.InsufficientMemory,
|
||||
self.cache.fetch_image,
|
||||
self.uuid, self.dest_path)
|
||||
self.assertFalse(mock_download.called)
|
||||
@ -263,8 +263,8 @@ class TestImageCacheDownload(BaseTest):
|
||||
self.assertTrue(mock_log.error.called)
|
||||
|
||||
def test__download_image_raises_memory_guard(self, mock_fetch):
|
||||
mock_fetch.side_effect = exception.InsufficentMemory
|
||||
self.assertRaises(exception.InsufficentMemory,
|
||||
mock_fetch.side_effect = exception.InsufficientMemory
|
||||
self.assertRaises(exception.InsufficientMemory,
|
||||
self.cache._download_image,
|
||||
self.uuid, self.master_path,
|
||||
self.dest_path, self.img_info)
|
||||
|
Loading…
Reference in New Issue
Block a user