From 126c6062e54a6bd67dc0272f0b605dd370802c9a Mon Sep 17 00:00:00 2001 From: Kyle McCormick Date: Thu, 21 Apr 2022 11:43:44 -0400 Subject: [PATCH] fix: `--mount` should accept service names with hyphens (no changelog entry, as this fixes a feature that hasn't yet been released) --- tests/commands/test_compose.py | 7 +++++++ tutor/commands/compose.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/commands/test_compose.py b/tests/commands/test_compose.py index eec5f9b..74f5610 100644 --- a/tests/commands/test_compose.py +++ b/tests/commands/test_compose.py @@ -26,5 +26,12 @@ class ComposeTests(unittest.TestCase): ], param("lms, cms:/path/to/edx-platform:/openedx/edx-platform"), ) + self.assertEqual( + [ + ("lms", "/path/to/edx-platform", "/openedx/edx-platform"), + ("lms-worker", "/path/to/edx-platform", "/openedx/edx-platform"), + ], + param("lms,lms-worker:/path/to/edx-platform:/openedx/edx-platform"), + ) with self.assertRaises(ClickException): param("lms,:/path/to/edx-platform:/openedx/edx-platform") diff --git a/tutor/commands/compose.py b/tutor/commands/compose.py index 413d4f5..58896d7 100644 --- a/tutor/commands/compose.py +++ b/tutor/commands/compose.py @@ -102,7 +102,7 @@ class MountParam(click.ParamType): MountType = t.Tuple[str, str, str] # Note that this syntax does not allow us to include colon ':' characters in paths PARAM_REGEXP = ( - r"(?P[a-zA-Z0-9_, ]+):(?P[^:]+):(?P[^:]+)" + r"(?P[a-zA-Z0-9-_, ]+):(?P[^:]+):(?P[^:]+)" ) def convert(