forked from pool/cloud-init
75 lines
2.9 KiB
Diff
75 lines
2.9 KiB
Diff
|
Index: cloud-init-0.7.8/cloudinit/net/__init__.py
|
||
|
===================================================================
|
||
|
--- cloud-init-0.7.8.orig/cloudinit/net/__init__.py
|
||
|
+++ cloud-init-0.7.8/cloudinit/net/__init__.py
|
||
|
@@ -38,7 +38,7 @@ def read_sys_net(devname, path, translat
|
||
|
contents = util.load_file(dev_path)
|
||
|
except (OSError, IOError) as e:
|
||
|
e_errno = getattr(e, 'errno', None)
|
||
|
- if e_errno in (errno.ENOENT, errno.ENOTDIR):
|
||
|
+ if e_errno in (errno.ENOENT, errno.ENOTDIR):
|
||
|
if enoent is not None:
|
||
|
return enoent
|
||
|
raise
|
||
|
@@ -173,16 +173,16 @@ def generate_fallback_config():
|
||
|
if name not in potential_interfaces:
|
||
|
continue
|
||
|
mac = read_sys_net(name, 'address', enoent=False)
|
||
|
- if mac:
|
||
|
+ if mac:
|
||
|
target_name = name
|
||
|
- target_mac = mac
|
||
|
- break
|
||
|
+ target_mac = mac
|
||
|
+ break
|
||
|
if target_mac and target_name:
|
||
|
nconf = {'config': [], 'version': 1}
|
||
|
- nconf['config'].append(
|
||
|
+ nconf['config'].append(
|
||
|
{'type': 'physical', 'name': target_name,
|
||
|
- 'mac_address': target_mac, 'subnets': [{'type': 'dhcp'}]})
|
||
|
- return nconf
|
||
|
+ 'mac_address': target_mac, 'subnets': [{'type': 'dhcp'}]})
|
||
|
+ return nconf
|
||
|
else:
|
||
|
return None
|
||
|
|
||
|
Index: cloud-init-0.7.8/cloudinit/net/eni.py
|
||
|
===================================================================
|
||
|
--- cloud-init-0.7.8.orig/cloudinit/net/eni.py
|
||
|
+++ cloud-init-0.7.8/cloudinit/net/eni.py
|
||
|
@@ -338,7 +338,7 @@ class Renderer(renderer.Renderer):
|
||
|
up = indent + "post-up route add"
|
||
|
down = indent + "pre-down route del"
|
||
|
or_true = " || true"
|
||
|
- gateway = indent + "gateway "
|
||
|
+ gateway = indent + "gateway "
|
||
|
mapping = {
|
||
|
'network': '-net',
|
||
|
'netmask': 'netmask',
|
||
|
@@ -347,7 +347,7 @@ class Renderer(renderer.Renderer):
|
||
|
}
|
||
|
if route['network'] == '0.0.0.0' and route['netmask'] == '0.0.0.0':
|
||
|
default_gw = " default gw %s" % route['gateway']
|
||
|
- content.append(gateway + route['gateway'])
|
||
|
+ content.append(gateway + route['gateway'])
|
||
|
content.append(up + default_gw + or_true)
|
||
|
content.append(down + default_gw + or_true)
|
||
|
elif route['network'] == '::' and route['netmask'] == 0:
|
||
|
Index: cloud-init-0.7.8/cloudinit/net/cmdline.py
|
||
|
===================================================================
|
||
|
--- cloud-init-0.7.8.orig/cloudinit/net/cmdline.py
|
||
|
+++ cloud-init-0.7.8/cloudinit/net/cmdline.py
|
||
|
@@ -198,9 +198,9 @@ def read_kernel_cmdline_config(files=Non
|
||
|
|
||
|
if mac_addrs is None:
|
||
|
mac_addrs = {}
|
||
|
- for k in get_devicelist():
|
||
|
+ for k in get_devicelist():
|
||
|
mac_addr = read_sys_net(k, 'address', enoent=False)
|
||
|
- if mac_addr:
|
||
|
+ if mac_addr:
|
||
|
mac_addrs[k] = mac_addr
|
||
|
|
||
|
return config_from_klibc_net_cfg(files=files, mac_addrs=mac_addrs)
|