From 54ae015bba1584c4150fe4dc4ba16b74a3b349b1 Mon Sep 17 00:00:00 2001 From: Dan Prince Date: Thu, 19 Mar 2015 11:25:18 -0400 Subject: Mark ENI files as autogenerated End users may not realize these files are autogenerated and may be surprised if they make changes to the /etc/sysconfig/network-scripts files which are then overwritten on reboot. Change-Id: I526c228463bd10de2cf3724aa4159b63a9aeff80 --- os_net_config/impl_ifcfg.py | 3 ++- os_net_config/tests/test_impl_ifcfg.py | 15 ++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'os_net_config') diff --git a/os_net_config/impl_ifcfg.py b/os_net_config/impl_ifcfg.py index 47f32a6..86cacf5 100644 --- a/os_net_config/impl_ifcfg.py +++ b/os_net_config/impl_ifcfg.py @@ -68,7 +68,8 @@ class IfcfgNetConfig(os_net_config.NetConfig): ovs_extra = [] - data = "DEVICE=%s\n" % base_opt.name + data = "# This file is autogenerated by os-net-config\n" + data += "DEVICE=%s\n" % base_opt.name data += "ONBOOT=yes\n" data += "HOTPLUG=no\n" if isinstance(base_opt, objects.Vlan): diff --git a/os_net_config/tests/test_impl_ifcfg.py b/os_net_config/tests/test_impl_ifcfg.py index 3930709..34a9e40 100644 --- a/os_net_config/tests/test_impl_ifcfg.py +++ b/os_net_config/tests/test_impl_ifcfg.py @@ -25,7 +25,8 @@ from os_net_config.tests import base from os_net_config import utils -_BASE_IFCFG = """DEVICE=em1 +_BASE_IFCFG = """# This file is autogenerated by os-net-config +DEVICE=em1 ONBOOT=yes HOTPLUG=no """ @@ -60,7 +61,8 @@ OVS_BRIDGE=br-ctlplane BOOTPROTO=none """ -_OVS_BRIDGE_DHCP = """DEVICE=br-ctlplane +_OVS_BRIDGE_DHCP = """# This file is autogenerated by os-net-config +DEVICE=br-ctlplane ONBOOT=yes HOTPLUG=no DEVICETYPE=ovs @@ -78,7 +80,8 @@ _OVS_BRIDGE_DHCP_OVS_EXTRA = _OVS_BRIDGE_DHCP + \ " -- br-set-external-id br-ctlplane bridge-id br-ctlplane\"\n" -_BASE_VLAN = """DEVICE=vlan5 +_BASE_VLAN = """# This file is autogenerated by os-net-config +DEVICE=vlan5 ONBOOT=yes HOTPLUG=no VLAN=yes @@ -100,7 +103,8 @@ BOOTPROTO=none """ -_OVS_BOND_DHCP = """DEVICE=bond0 +_OVS_BOND_DHCP = """# This file is autogenerated by os-net-config +DEVICE=bond0 ONBOOT=yes HOTPLUG=no DEVICETYPE=ovs @@ -246,7 +250,8 @@ class TestIfcfgNetConfig(base.TestCase): self.provider.add_bond(bond) self.assertEqual(_NO_IP, self.get_interface_config('em1')) - em2_config = """DEVICE=em2 + em2_config = """# This file is autogenerated by os-net-config +DEVICE=em2 ONBOOT=yes HOTPLUG=no BOOTPROTO=none -- cgit 1.2.3-korg