You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

22 lines
768 B

from ee.core.shellexec import EEShellExec
from ee.core.variables import EEVariables
import os
def check_fqdn(self, ee_host):
#ee_host=os.popen("hostname -f | tr -d '\n'").read()
if '.' in ee_host:
EEVariables.ee_fqdn = ee_host
with open('/etc/hostname', 'w') as hostfile:
hostfile.write(ee_host)
EEShellExec.cmd_exec(self, "sed -i \"1i\\127.0.0.1 {0}\" /etc/hosts"
.format(ee_host))
if EEVariables.ee_platform_distro == 'debian':
EEShellExec.cmd_exec(self, "/etc/init.d/hostname.sh start")
else:
EEShellExec.cmd_exec(self, "service hostname restart")
else:
ee_host = input("Enter hostname [fqdn]:")
check_fqdn(self, ee_host)