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