dns and network plugins fixed

This commit is contained in:
agahhulusi 2021-09-08 12:00:49 +03:00
parent 6963448efe
commit a8e33f640c
4 changed files with 7 additions and 7 deletions

View file

@ -23,10 +23,10 @@ class AddDNS(AbstractPlugin):
def handle_task(self): def handle_task(self):
try: try:
if self.is_active is True: if self.is_active is True:
content = 'nameserver {}\n'.format(self.ip) content = '\nnameserver {}\n'.format(self.ip)
self.logger.debug('Created active dns content.') self.logger.debug('Created active dns content.')
else: else:
content = '#nameserver {}\n'.format(self.ip) content = '\n#nameserver {}\n'.format(self.ip)
self.logger.debug('Created passive dns content.') self.logger.debug('Created passive dns content.')
self.logger.debug('Writing to file...') self.logger.debug('Writing to file...')

View file

@ -21,7 +21,7 @@ class AddDomain(AbstractPlugin):
def handle_task(self): def handle_task(self):
try: try:
content = 'domain {0}\nsearch {0}\n'.format(self.domain) content = '\ndomain {0}\nsearch {0}\n'.format(self.domain)
self.logger.debug('Writing to file...') self.logger.debug('Writing to file...')
self.write_file(self.dns_file, content, 'a') self.write_file(self.dns_file, content, 'a')

View file

@ -24,10 +24,10 @@ class AddHost(AbstractPlugin):
def handle_task(self): def handle_task(self):
try: try:
if self.is_active is True: if self.is_active is True:
content = '{0} {1}\n'.format(self.ip, self.hostname) content = '\n{0} {1}\n'.format(self.ip, self.hostname)
self.logger.debug('Created active host content.') self.logger.debug('Created active host content.')
else: else:
content = '#{0} {1}\n'.format(self.ip, self.hostname) content = '\n#{0} {1}\n'.format(self.ip, self.hostname)
self.logger.debug('Created passive host content.') self.logger.debug('Created passive host content.')
self.logger.debug('Writing to file...') self.logger.debug('Writing to file...')

View file

@ -32,12 +32,12 @@ 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}\niface {0} inet static\naddress {1}\nnetmask {2}\ngateway {3}\n'.format(self.name, self.content = '\nauto {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)
else: else:
self.content = 'auto {0}\niface {0} inet static\n#address {1}\n#netmask {2}\n#gateway {3}\n'.format(self.name, self.content = '\nauto {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)