qa: enable early release during parallel burnin
[ganeti-local] / qa / qa_utils.py
index fbc92e8..a4af630 100644 (file)
@@ -24,6 +24,7 @@
 """
 
 import os
+import re
 import sys
 import subprocess
 
@@ -92,6 +93,14 @@ def AssertNotEqual(first, second):
     raise qa_error.Error('%r != %r' % (first, second))
 
 
+def AssertMatch(string, pattern):
+  """Raises an error when string doesn't match regexp pattern.
+
+  """
+  if not re.match(pattern, string):
+    raise qa_error.Error("%r doesn't match /%r/" % (string, pattern))
+
+
 def GetSSHCommand(node, cmd, strict=True):
   """Builds SSH command to be executed.