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