mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-01-13 09:41:55 -06:00
Use split instead of find as split does not fail to provide a complete
component if no '.' is found.
This commit is contained in:
parent
58592c3b4f
commit
6119f83799
@ -175,7 +175,7 @@ def read_ip_address(host_name):
|
||||
fstore.backup_file("/etc/hosts")
|
||||
hosts_fd = open('/etc/hosts', 'r+')
|
||||
hosts_fd.seek(0, 2)
|
||||
hosts_fd.write(ip+'\t'+host_name+' '+host_name[:host_name.find('.')]+'\n')
|
||||
hosts_fd.write(ip+'\t'+host_name+' '+host_name.split('.')[0]+'\n')
|
||||
hosts_fd.close()
|
||||
|
||||
return ip
|
||||
|
@ -48,7 +48,7 @@ class BindInstance(service.Service):
|
||||
self.ip_address = ip_address
|
||||
self.realm = realm_name
|
||||
self.domain = domain_name
|
||||
self.host = fqdn[:fqdn.find(".")]
|
||||
self.host = fqdn.split(".")[0]
|
||||
|
||||
self.__setup_sub_dict()
|
||||
|
||||
|
@ -214,7 +214,7 @@ class DsInstance(service.Service):
|
||||
self.backup_state("running", is_ds_running())
|
||||
self.backup_state("serverid", self.serverid)
|
||||
|
||||
self.sub_dict['BASEDC'] = self.realm_name[:self.realm_name.find('.')].lower()
|
||||
self.sub_dict['BASEDC'] = self.realm_name.split('.')[0].lower()
|
||||
base_txt = ipautil.template_str(BASE_TEMPLATE, self.sub_dict)
|
||||
logging.debug(base_txt)
|
||||
base_fd = file("/var/lib/dirsrv/boot.ldif", "w")
|
||||
|
Loading…
Reference in New Issue
Block a user