diff --git a/src/plugins/network-manager/add_network.py b/src/plugins/network-manager/add_network.py index 2a15576..f02552a 100644 --- a/src/plugins/network-manager/add_network.py +++ b/src/plugins/network-manager/add_network.py @@ -32,7 +32,7 @@ class AddNetwork(AbstractPlugin): try: if self.type == 'STATIC': if self.is_active is True: - self.content = 'auto {0}\n iface {0} inet static\n address {1}\n netmask {2}\n gateway {3}\n'.format(self.name, + self.content = 'auto {0}\niface {0} inet static\naddress {1}\nnetmask {2}\ngateway {3}\n'.format(self.name, self.ip, self.netmask, self.gateway) @@ -44,10 +44,10 @@ class AddNetwork(AbstractPlugin): self.logger.debug('Created content for STATIC type.') elif self.type == 'DHCP': - self.content = 'iface {} inet dhcp\n'.format(self.name) + self.content = 'auto {0}\niface {0} inet dhcp\n'.format(self.name) self.logger.debug('Created content for DHCP type.') elif self.type == 'LOOPBACK': - self.content = 'iface {} inet loopback\n'.format(self.name) + self.content = 'auto {0}\niface {0} inet loopback\n'.format(self.name) self.logger.debug('Created content for LOOPBACK type.') if self.is_active is False: diff --git a/src/plugins/network-manager/delete_network.py b/src/plugins/network-manager/delete_network.py index 762a0da..62451e3 100644 --- a/src/plugins/network-manager/delete_network.py +++ b/src/plugins/network-manager/delete_network.py @@ -42,29 +42,29 @@ class DeleteNetwork(AbstractPlugin): if not counter: if self.type == 'static': if self.is_active is True: - self.content = 'iface {0} inet static\n'.format(self.name) + self.content = 'auto {0}\n'.format(self.name) else: - self.content = '#iface {0} inet static\n'.format(self.name) + self.content = '#auto {0}\n'.format(self.name) if line.startswith(self.content): - counter = 3 + counter = 4 else: print(str(line).strip()) elif self.type == 'dhcp': if self.is_active is True: - self.content = 'iface {} inet dhcp\n'.format(self.name) + self.content = 'auto {0}\n'.format(self.name) else: - self.content = '#iface {} inet dhcp\n'.format(self.name) + self.content = '#auto {0}\n'.format(self.name) if not line.startswith(self.content): print(str(line).strip()) elif self.type == 'loopback': if self.is_active is True: - self.content = 'iface {} inet loopback\n'.format(self.name) + self.content = 'auto {0}\n'.format(self.name) else: - self.content = '#iface {} inet loopback\n'.format(self.name) + self.content = '#auto {0}\n'.format(self.name) if not line.startswith(self.content): print(str(line).strip())