Make SSH driver regex configurable
This commit is contained in:
parent
a5825d45f7
commit
abb8ce323d
@ -151,6 +151,7 @@ v0.2.0
|
||||
* Switch to setuptools entry points.
|
||||
* Switch to tox.
|
||||
* Periodic firewall update is now configurable.
|
||||
* SSH driver regex is now configurable.
|
||||
* Supported on Python 3.3.
|
||||
* Enhanced documentation.
|
||||
|
||||
|
@ -14,6 +14,8 @@
|
||||
;dnsmasq_interface = br-ctlplane
|
||||
; Amount of time in seconds, after which repeat periodic update of firewall.
|
||||
;firewall_update_period = 15
|
||||
; Regular expression that matches names of Ironic drivers with SSH power.
|
||||
;ssh_driver_regex = ^.*_ssh$
|
||||
|
||||
; IP to listen on.
|
||||
;listen_address = 0.0.0.0
|
||||
|
@ -18,7 +18,8 @@ CONF = configparser.ConfigParser(
|
||||
'listen_port': '5050',
|
||||
'dnsmasq_interface': 'br-ctlplane',
|
||||
'authenticate': 'true',
|
||||
'firewall_update_period': '15'})
|
||||
'firewall_update_period': '15',
|
||||
'ssh_driver_regex': '^.*_ssh$'})
|
||||
OS_ARGS = ('os_password', 'os_username', 'os_auth_url', 'os_tenant_name')
|
||||
|
||||
|
||||
@ -164,10 +165,11 @@ def discover(uuids):
|
||||
return
|
||||
|
||||
LOG.info('Proceeding with discovery on nodes %s', [n.uuid for n in nodes])
|
||||
ssh_regex = re.compile(CONF.get('discoverd', 'ssh_driver_regex'))
|
||||
|
||||
to_exclude = set()
|
||||
for node in nodes:
|
||||
if not node.driver.endswith('ssh'):
|
||||
if not ssh_regex.match(node.driver):
|
||||
continue
|
||||
|
||||
LOG.warn('Driver for %s is %s, requires white-listing MAC',
|
||||
|
@ -1,4 +1,5 @@
|
||||
import logging
|
||||
import re
|
||||
import sys
|
||||
|
||||
import eventlet
|
||||
@ -59,6 +60,8 @@ def main():
|
||||
|
||||
discoverd.CONF.read(sys.argv[1])
|
||||
debug = discoverd.CONF.getboolean('discoverd', 'debug')
|
||||
# Just checking
|
||||
re.compile(discoverd.CONF.get('discoverd', 'ssh_driver_regex'))
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG if debug else logging.INFO)
|
||||
logging.getLogger('urllib3.connectionpool').setLevel(logging.WARNING)
|
||||
|
@ -93,6 +93,8 @@ class TestDiscover(unittest.TestCase):
|
||||
self.node2 = Mock(driver='pxe_ipmitool',
|
||||
uuid='uuid2')
|
||||
firewall.MACS_DISCOVERY = set()
|
||||
if not discoverd.CONF.has_section('discoverd'):
|
||||
discoverd.CONF.add_section('discoverd')
|
||||
|
||||
def test(self, client_mock, filters_mock):
|
||||
cli = client_mock.return_value
|
||||
|
Loading…
Reference in New Issue
Block a user