--- a/pvl/hosts.py Mon Mar 31 17:14:51 2014 +0300
+++ b/pvl/hosts.py Mon Mar 31 17:27:36 2014 +0300
@@ -32,6 +32,13 @@
class HostConfigError (HostError) :
pass
+def parse_ethernet (value) :
+ """
+ Normalize ethernet str.
+ """
+
+ return ':'.join('%02x' % int(x, 16) for x in value.split(':'))
+
class Host (object) :
# the label used for alias4/6 hosts
ALIAS4_FMT = '{host}-ipv4'
@@ -143,10 +150,10 @@
if field == 'ethernet' :
if instance :
- ethernet[instance] = value
+ ethernet[instance] = parse_ethernet(value)
else :
for eth in value.split() :
- ethernet[len(ethernet)] = eth
+ ethernet[len(ethernet)] = parse_ethernet(eth)
else :
raise ValueError("%s: Unknown host field: %s=%s" % (host, field, value))