add UUID from mac adress
This commit is contained in:
@ -31,7 +31,7 @@ def write_when_new(filename, content, doit):
|
||||
return True
|
||||
|
||||
|
||||
def create_if(name, cfg):
|
||||
def create_if(name, cfg, mac):
|
||||
result = dict(
|
||||
TYPE='Ethernet',
|
||||
NAME=name,
|
||||
@ -41,6 +41,7 @@ def create_if(name, cfg):
|
||||
PROXY_METHOD='none',
|
||||
BROWSER_ONLY='no',
|
||||
IPV4_FAILURE_FATAL='yes',
|
||||
UUID='58d61ced-05d2-4726-a8f7-%s' % ''.join(mac.split(':')),
|
||||
IPV6INIT='no')
|
||||
if cfg == 'off':
|
||||
result['ONBOOT']='no'
|
||||
@ -172,7 +173,7 @@ def network(doit):
|
||||
parser.read(cfgfile)
|
||||
network = dict(parser['NETWORK'])
|
||||
for ifname in IFNAMES:
|
||||
content = create_if(ifname, network.get(ifname, 'off'))
|
||||
content = create_if(ifname, network.get(ifname, 'off'), netaddr_dict[ifname])
|
||||
content = '\n'.join('%s=%s' % kv for kv in content.items())
|
||||
todo = write_when_new('/etc/sysconfig/network-scripts/ifcfg-%s' % ifname, content, doit)
|
||||
if todo:
|
||||
|
Reference in New Issue
Block a user