mirror of
https://github.com/Pardus-LiderAhenk/ahenk
synced 2024-11-22 12:02:15 +03:00
change module for linux_distro as distro and added dynamic_dns_update param to ad_login
This commit is contained in:
parent
b252637a09
commit
24d425d27f
3 changed files with 10 additions and 10 deletions
|
@ -73,7 +73,7 @@ class CommandRunner(object):
|
||||||
|
|
||||||
if str(json_data['event']) == 'login' and self.check_last_login():
|
if str(json_data['event']) == 'login' and self.check_last_login():
|
||||||
username = json_data['username']
|
username = json_data['username']
|
||||||
if username != "Debian-gdm":
|
if username != "Debian-gdm" or username != "gdm":
|
||||||
display = json_data['display']
|
display = json_data['display']
|
||||||
desktop = json_data['desktop']
|
desktop = json_data['desktop']
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ import socket
|
||||||
import struct
|
import struct
|
||||||
import netifaces
|
import netifaces
|
||||||
from uuid import getnode as get_mac
|
from uuid import getnode as get_mac
|
||||||
|
import distro
|
||||||
import cpuinfo
|
import cpuinfo
|
||||||
import psutil
|
import psutil
|
||||||
|
|
||||||
|
@ -337,15 +337,18 @@ class System:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def distribution_name():
|
def distribution_name():
|
||||||
return platform.linux_distribution()[0]
|
#return platform.linux_distribution()[0]
|
||||||
|
return distro.linux_distribution()[0]
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def distribution_version():
|
def distribution_version():
|
||||||
return platform.linux_distribution()[1]
|
# return platform.linux_distribution()[1]
|
||||||
|
return distro.linux_distribution()[1]
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def distribution_id():
|
def distribution_id():
|
||||||
return platform.linux_distribution()[2]
|
# return platform.linux_distribution()[2]
|
||||||
|
return distro.linux_distribution()[2]
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def version():
|
def version():
|
||||||
|
|
|
@ -30,8 +30,9 @@ class ADLogin(AbstractPlugin):
|
||||||
ad_username = self.data['ad_username']
|
ad_username = self.data['ad_username']
|
||||||
admin_password = self.data['admin_password']
|
admin_password = self.data['admin_password']
|
||||||
ad_port = self.data['ad_port']
|
ad_port = self.data['ad_port']
|
||||||
|
dynamic_dns_update = self.data['dynamic_dns_update']
|
||||||
|
|
||||||
execution_result = self.ad_authentication.authenticate(domain_name, hostname, ip_address, admin_password, ad_username)
|
execution_result = self.ad_authentication.authenticate(domain_name, hostname, ip_address, admin_password, ad_username, dynamic_dns_update)
|
||||||
if execution_result is False:
|
if execution_result is False:
|
||||||
self.context.create_response(code=self.message_code.TASK_ERROR.value,
|
self.context.create_response(code=self.message_code.TASK_ERROR.value,
|
||||||
message='Active Directory kullanıcısı ile oturum açma ayarlanırken hata oluştu.: Gerekli Paketleri indirilemedi.',
|
message='Active Directory kullanıcısı ile oturum açma ayarlanırken hata oluştu.: Gerekli Paketleri indirilemedi.',
|
||||||
|
@ -46,21 +47,17 @@ class ADLogin(AbstractPlugin):
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.read(self.ahenk_conf_path)
|
config.read(self.ahenk_conf_path)
|
||||||
config.set('MACHINE', 'user_disabled', 'true')
|
config.set('MACHINE', 'user_disabled', 'true')
|
||||||
|
|
||||||
with open(self.ahenk_conf_path, 'w') as configfile:
|
with open(self.ahenk_conf_path, 'w') as configfile:
|
||||||
self.logger.info('Opening config file ')
|
self.logger.info('Opening config file ')
|
||||||
config.write(configfile)
|
config.write(configfile)
|
||||||
configfile.close()
|
configfile.close()
|
||||||
self.logger.info('User disabled value Disabled')
|
self.logger.info('User disabled value Disabled')
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.logger.info("local users will not be disabled because local_user parameter is FALSE")
|
self.logger.info("local users will not be disabled because local_user parameter is FALSE")
|
||||||
self.shutdown()
|
self.shutdown()
|
||||||
|
|
||||||
self.context.create_response(code=self.message_code.TASK_PROCESSED.value,
|
self.context.create_response(code=self.message_code.TASK_PROCESSED.value,
|
||||||
message='Active Directory kullanıcısı ile oturum açma başarı ile sağlandı ve istemci yeniden başlatılıyor.',
|
message='Active Directory kullanıcısı ile oturum açma başarı ile sağlandı ve istemci yeniden başlatılıyor.',
|
||||||
content_type=self.get_content_type().APPLICATION_JSON.value)
|
content_type=self.get_content_type().APPLICATION_JSON.value)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.logger.error(str(e))
|
self.logger.error(str(e))
|
||||||
self.context.create_response(code=self.message_code.TASK_ERROR.value,
|
self.context.create_response(code=self.message_code.TASK_ERROR.value,
|
||||||
|
|
Loading…
Reference in a new issue