From 65eb5068d10fe0e95a632078a738a5a32384c692 Mon Sep 17 00:00:00 2001 From: agahhulusi Date: Mon, 29 Mar 2021 10:47:28 +0300 Subject: [PATCH] null check bug fixed --- src/base/registration/registration.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/base/registration/registration.py b/src/base/registration/registration.py index f05accf..d374c8f 100644 --- a/src/base/registration/registration.py +++ b/src/base/registration/registration.py @@ -196,18 +196,28 @@ class Registration: def install_and_config_ad(self, reg_reply): self.logger.info('AD install process starting') + domain_name = str(reg_reply['adDomainName']) host_name = str(reg_reply['adHostName']) ip_address = str(reg_reply['adIpAddress']) password = str(reg_reply['adAdminPassword']) ad_username = str(reg_reply['adAdminUserName']) - dynamic_dns_update = reg_reply['dynamicDNSUpdate'] + dynamic_dns_update = False - if domain_name is None or host_name is None or ip_address is None or password is None : - self.logger.error("Registration params is null") - return - - self.ad_login.authenticate(domain_name, host_name, ip_address, password, ad_username, dynamic_dns_update) + if 'dynamicDNSUpdate' in reg_reply: + dynamic_dns_update = reg_reply['dynamicDNSUpdate'] + self.logger.info("DynamicDNSUpdate is NOT NULL") + if domain_name is None or host_name is None or ip_address is None or password is None: + self.logger.error("Registration params is null") + return + self.ad_login.authenticate(domain_name, host_name, ip_address, password, ad_username, dynamic_dns_update) + else: + self.logger.info("DynamicDNSUpdate is NULL") + if domain_name is None or host_name is None or ip_address is None or password is None: + self.logger.error("Registration params is null") + return + self.ad_login.authenticate(domain_name, host_name, ip_address, password, ad_username, dynamic_dns_update) + # self.ad_login.authenticate(domain_name, host_name, ip_address, password, ad_username, dynamic_dns_update) def registration_error(self, reg_reply): self.re_register()