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.gateway)
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.netmask,
self.gateway)

View File

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