Remove unneeded validation code in ValidateInterfacesHook

oslo.config now sets enforce_type=True by default since [1], so
there is no need to check in ValidateInterfacesHook that the value
set in the config file is one of the valid values.

[1] https://review.openstack.org/328692

Closes-Bug: #1683732
Change-Id: I5830466cb21f200ae1c33021cce4d166a26456be
This commit is contained in:
Javier Pena 2017-04-18 12:59:11 +02:00
parent d6b00fade0
commit dffdf36ebd
2 changed files with 0 additions and 25 deletions

View File

@ -13,7 +13,6 @@
"""Standard set of plugins."""
import sys
from ironic_lib import utils as il_utils
import netaddr
@ -23,7 +22,6 @@ from oslo_utils import units
import six
from ironic_inspector.common.i18n import _
from ironic_inspector import conf
from ironic_inspector.plugins import base
from ironic_inspector import utils
@ -126,21 +124,6 @@ class SchedulerHook(base.ProcessingHook):
class ValidateInterfacesHook(base.ProcessingHook):
"""Hook to validate network interfaces."""
def __init__(self):
if CONF.processing.add_ports not in conf.VALID_ADD_PORTS_VALUES:
LOG.critical('Accepted values for [processing]add_ports are '
'%(valid)s, got %(actual)s',
{'valid': conf.VALID_ADD_PORTS_VALUES,
'actual': CONF.processing.add_ports})
sys.exit(1)
if CONF.processing.keep_ports not in conf.VALID_KEEP_PORTS_VALUES:
LOG.critical('Accepted values for [processing]keep_ports are '
'%(valid)s, got %(actual)s',
{'valid': conf.VALID_KEEP_PORTS_VALUES,
'actual': CONF.processing.keep_ports})
sys.exit(1)
def _get_interfaces(self, data=None):
"""Convert inventory to a dict with interfaces.

View File

@ -103,14 +103,6 @@ class TestValidateInterfacesHookLoad(test_base.NodeTest):
ext = base.processing_hooks_manager()['validate_interfaces']
self.assertIsInstance(ext.obj, std_plugins.ValidateInterfacesHook)
def test_wrong_add_ports(self):
CONF.set_override('add_ports', 'foobar', 'processing')
self.assertRaises(SystemExit, std_plugins.ValidateInterfacesHook)
def test_wrong_keep_ports(self):
CONF.set_override('keep_ports', 'foobar', 'processing')
self.assertRaises(SystemExit, std_plugins.ValidateInterfacesHook)
class TestValidateInterfacesHookBeforeProcessing(test_base.NodeTest):
def setUp(self):