ahenk static network bug fixed

This commit is contained in:
agahhulusi 2021-01-04 15:31:59 +03:00
parent e6cf0015ae
commit 3067caf015
2 changed files with 10 additions and 10 deletions

View file

@ -44,10 +44,10 @@ class AddNetwork(AbstractPlugin):
self.logger.debug('Created content for STATIC type.') self.logger.debug('Created content for STATIC type.')
elif self.type == 'DHCP': 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.') self.logger.debug('Created content for DHCP type.')
elif self.type == 'LOOPBACK': 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.') self.logger.debug('Created content for LOOPBACK type.')
if self.is_active is False: if self.is_active is False:

View file

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