Revision 8fb00704 lib/utils.py
b/lib/utils.py | ||
---|---|---|
92 | 92 |
_MCL_CURRENT = 1 |
93 | 93 |
_MCL_FUTURE = 2 |
94 | 94 |
|
95 |
#: MAC checker regexp |
|
96 |
_MAC_CHECK = re.compile("^([0-9a-f]{2}:){5}[0-9a-f]{2}$", re.I) |
|
97 |
|
|
95 | 98 |
|
96 | 99 |
class RunResult(object): |
97 | 100 |
"""Holds the result of running external programs. |
... | ... | |
1697 | 1700 |
@raise errors.OpPrereqError: If the MAC isn't valid |
1698 | 1701 |
|
1699 | 1702 |
""" |
1700 |
mac_check = re.compile("^([0-9a-f]{2}(:|$)){6}$", re.I) |
|
1701 |
if not mac_check.match(mac): |
|
1703 |
if not _MAC_CHECK.match(mac): |
|
1702 | 1704 |
raise errors.OpPrereqError("Invalid MAC address specified: %s" % |
1703 | 1705 |
mac, errors.ECODE_INVAL) |
1704 | 1706 |
|
Also available in: Unified diff