Allow plugin names to contain non-letter characters
There are already devstack plugins that contain a hyphen in the name, like `networking-baremetal`. In order to allow ordering for these to work properly, amend the regexes we are using to match any non-whitespace characters instead of only alphanumerics. Amend the test to cover this use case. Change-Id: I91093a424f8d5e8007f140083e1ea36a81fe849f Closes-Bug: 1809016
This commit is contained in:
parent
6d103a7ff8
commit
0b855007f8
@ -155,8 +155,8 @@ class PluginGraph(DependencyGraph):
|
|||||||
continue
|
continue
|
||||||
self.loadDevstackPluginInfo(settings)
|
self.loadDevstackPluginInfo(settings)
|
||||||
|
|
||||||
define_re = re.compile(r'^define_plugin\s+(\w+).*')
|
define_re = re.compile(r'^define_plugin\s+(\S+).*')
|
||||||
require_re = re.compile(r'^plugin_requires\s+(\w+)\s+(\w+).*')
|
require_re = re.compile(r'^plugin_requires\s+(\S+)\s+(\S+).*')
|
||||||
def loadDevstackPluginInfo(self, fn):
|
def loadDevstackPluginInfo(self, fn):
|
||||||
name = None
|
name = None
|
||||||
reqs = set()
|
reqs = set()
|
||||||
|
@ -78,12 +78,12 @@ class TestDevstackLocalConf(unittest.TestCase):
|
|||||||
with open(os.path.join(
|
with open(os.path.join(
|
||||||
self.tmpdir,
|
self.tmpdir,
|
||||||
'foo-plugin', 'devstack', 'settings'), 'w') as f:
|
'foo-plugin', 'devstack', 'settings'), 'w') as f:
|
||||||
f.write('define_plugin foo\n')
|
f.write('define_plugin foo-plugin\n')
|
||||||
with open(os.path.join(
|
with open(os.path.join(
|
||||||
self.tmpdir,
|
self.tmpdir,
|
||||||
'bar-plugin', 'devstack', 'settings'), 'w') as f:
|
'bar-plugin', 'devstack', 'settings'), 'w') as f:
|
||||||
f.write('define_plugin bar\n')
|
f.write('define_plugin bar-plugin\n')
|
||||||
f.write('plugin_requires bar foo\n')
|
f.write('plugin_requires bar-plugin foo-plugin\n')
|
||||||
|
|
||||||
localrc = {'test_localrc': '1'}
|
localrc = {'test_localrc': '1'}
|
||||||
local_conf = {'install':
|
local_conf = {'install':
|
||||||
@ -94,8 +94,8 @@ class TestDevstackLocalConf(unittest.TestCase):
|
|||||||
# We use ordereddict here to make sure the plugins are in the
|
# We use ordereddict here to make sure the plugins are in the
|
||||||
# *wrong* order for testing.
|
# *wrong* order for testing.
|
||||||
plugins = OrderedDict([
|
plugins = OrderedDict([
|
||||||
('bar', 'git://git.openstack.org/openstack/bar-plugin'),
|
('bar-plugin', 'git://git.openstack.org/openstack/bar-plugin'),
|
||||||
('foo', 'git://git.openstack.org/openstack/foo-plugin'),
|
('foo-plugin', 'git://git.openstack.org/openstack/foo-plugin'),
|
||||||
])
|
])
|
||||||
p = dict(localrc=localrc,
|
p = dict(localrc=localrc,
|
||||||
local_conf=local_conf,
|
local_conf=local_conf,
|
||||||
@ -119,7 +119,7 @@ class TestDevstackLocalConf(unittest.TestCase):
|
|||||||
for line in f:
|
for line in f:
|
||||||
if line.startswith('enable_plugin'):
|
if line.startswith('enable_plugin'):
|
||||||
plugins.append(line.split()[1])
|
plugins.append(line.split()[1])
|
||||||
self.assertEqual(['foo', 'bar'], plugins)
|
self.assertEqual(['foo-plugin', 'bar-plugin'], plugins)
|
||||||
|
|
||||||
def test_libs_from_git(self):
|
def test_libs_from_git(self):
|
||||||
"Test that LIBS_FROM_GIT is auto-generated"
|
"Test that LIBS_FROM_GIT is auto-generated"
|
||||||
|
Loading…
Reference in New Issue
Block a user