network manager delete and add fixed

This commit is contained in:
agahhulusi 2021-01-04 16:14:00 +03:00
parent 3067caf015
commit 9602b41284
2 changed files with 13 additions and 5 deletions

View file

@ -37,7 +37,7 @@ class AddNetwork(AbstractPlugin):
self.netmask, self.netmask,
self.gateway) self.gateway)
else: else:
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\n#address {1}\n#netmask {2}\n#gateway {3}\n'.format(self.name,
self.ip, self.ip,
self.netmask, self.netmask,
self.gateway) self.gateway)

View file

@ -47,7 +47,7 @@ class DeleteNetwork(AbstractPlugin):
self.content = '#auto {0}\n'.format(self.name) self.content = '#auto {0}\n'.format(self.name)
if line.startswith(self.content): if line.startswith(self.content):
counter = 4 counter = 3
else: else:
print(str(line).strip()) print(str(line).strip())
@ -57,17 +57,25 @@ class DeleteNetwork(AbstractPlugin):
else: else:
self.content = '#auto {0}\n'.format(self.name) self.content = '#auto {0}\n'.format(self.name)
if not line.startswith(self.content): if line.startswith(self.content):
counter = 1
else:
print(str(line).strip()) print(str(line).strip())
# if not line.startswith(self.content):
# print(str(line).strip())
elif self.type == 'loopback': elif self.type == 'loopback':
if self.is_active is True: if self.is_active is True:
self.content = 'auto {0}\n'.format(self.name) self.content = 'auto {0}\n'.format(self.name)
else: else:
self.content = '#auto {0}\n'.format(self.name) self.content = 'auto {0}\n'.format(self.name)
if not line.startswith(self.content): if line.startswith(self.content):
counter = 1
else:
print(str(line).strip()) print(str(line).strip())
else: else:
counter -= 1 counter -= 1