Commit cb639800 authored by Michael Hanselmann's avatar Michael Hanselmann

Merge branch 'devel-2.1' into devel-2.2

* devel-2.1:
  Fix mac checker regex
Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
parents c219f613 8fb00704
......@@ -91,6 +91,9 @@ _VALID_SERVICE_NAME_RE = re.compile("^[-_.a-zA-Z0-9]{1,128}$")
_MCL_CURRENT = 1
_MCL_FUTURE = 2
#: MAC checker regexp
_MAC_CHECK = re.compile("^([0-9a-f]{2}:){5}[0-9a-f]{2}$", re.I)
class RunResult(object):
"""Holds the result of running external programs.
......@@ -2003,8 +2006,7 @@ def NormalizeAndValidateMac(mac):
@raise errors.OpPrereqError: If the MAC isn't valid
"""
mac_check = re.compile("^([0-9a-f]{2}(:|$)){6}$", re.I)
if not mac_check.match(mac):
if not _MAC_CHECK.match(mac):
raise errors.OpPrereqError("Invalid MAC address specified: %s" %
mac, errors.ECODE_INVAL)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment