mirror of
https://github.com/Pardus-LiderAhenk/ahenk
synced 2024-11-26 07:02:22 +03:00
ahenk static network bug fixed
This commit is contained in:
parent
e6cf0015ae
commit
3067caf015
2 changed files with 10 additions and 10 deletions
|
@ -32,7 +32,7 @@ class AddNetwork(AbstractPlugin):
|
||||||
try:
|
try:
|
||||||
if self.type == 'STATIC':
|
if self.type == 'STATIC':
|
||||||
if self.is_active is True:
|
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.ip,
|
||||||
self.netmask,
|
self.netmask,
|
||||||
self.gateway)
|
self.gateway)
|
||||||
|
@ -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:
|
||||||
|
|
|
@ -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())
|
||||||
|
|
Loading…
Reference in a new issue