Fix wrong rejex for [ovs] ovsdb_connection

The change 03a976d933 introduced
the wrong regex which rejects usage of unix domain socket.

Also 'tls' is not a protocol actually accepted.

Closes-Bug: #2099450
Change-Id: I119f33a85df6f95c8cdc937fa2bb02b425a34de3
This commit is contained in:
Takashi Kajinami
2025-02-21 14:16:58 +09:00
parent 3454723a97
commit dad75a8202
2 changed files with 13 additions and 7 deletions

View File

@@ -20,7 +20,7 @@ from oslo_config import cfg
API_OPTS = [
cfg.StrOpt('ovsdb_connection',
default='tcp:127.0.0.1:6640',
regex=r'^(tcp|tls|ssl):.+',
regex=r'^(tcp|ssl|unix):.+',
help=_('The connection string for the OVSDB backend. '
'Will be used for all OVSDB commands and '
'by ovsdb-client when monitoring'

View File

@@ -22,8 +22,8 @@ class OvsdbNativeHelpersTestCase(base.BaseTestCase):
'ptcp:6640:127.0.0.1',
helpers._connection_to_manager_uri('tcp:127.0.0.1:6640'))
self.assertEqual(
'ptls:6640:127.0.0.1',
helpers._connection_to_manager_uri('tls:127.0.0.1:6640'))
'pssl:6640:127.0.0.1',
helpers._connection_to_manager_uri('ssl:127.0.0.1:6640'))
self.assertEqual(
'ptcp:127.0.0.1',
helpers._connection_to_manager_uri('tcp:127.0.0.1'))
@@ -33,8 +33,8 @@ class OvsdbNativeHelpersTestCase(base.BaseTestCase):
'ptcp:6640:[::1]',
helpers._connection_to_manager_uri('tcp:[::1]:6640'))
self.assertEqual(
'ptls:6640:[::1]',
helpers._connection_to_manager_uri('tls:[::1]:6640'))
'pssl:6640:[::1]',
helpers._connection_to_manager_uri('ssl:[::1]:6640'))
self.assertEqual(
'ptcp:[::1]',
helpers._connection_to_manager_uri('tcp:[::1]'))
@@ -44,8 +44,14 @@ class OvsdbNativeHelpersTestCase(base.BaseTestCase):
'ptcp:6640:localhost',
helpers._connection_to_manager_uri('tcp:localhost:6640'))
self.assertEqual(
'ptls:6640:localhost',
helpers._connection_to_manager_uri('tls:localhost:6640'))
'pssl:6640:localhost',
helpers._connection_to_manager_uri('ssl:localhost:6640'))
self.assertEqual(
'ptcp:localhost',
helpers._connection_to_manager_uri('tcp:localhost'))
def test__connect_to_manager_uri_unix(self):
self.assertEqual(
'punix:/run/openvswitch/db.sock',
helpers._connection_to_manager_uri(
'unix:/run/openvswitch/db.sock'))