Client: Fix responce id

This commit is contained in:
Arthur Golubtsov
2020-02-21 10:56:36 +00:00
parent e208b7959f
commit 6b1649941b
2 changed files with 5 additions and 2 deletions

View File

@@ -51,6 +51,8 @@ class Client(object):
self.client_id = socket.gethostname()
elif config_id == '/ip':
self.client_id = messaging.get_ip_address()
else:
self.client_id = config_id
logger.info("Config loaded")

View File

@@ -252,14 +252,15 @@ def _response_id(*args, **kwargs):
old_id = client.active_client.client_id
if new_id != old_id:
client.active_client.config.set('PRIVATE', 'id', new_id, write=True)
client.active_client.client_id = new_id
if new_id != '/hostname':
if client.active_client.system_restart_after_rename:
if client.active_client.config.system_restart_after_rename:
hostname = client.active_client.client_id
configure_hostname(hostname)
configure_hosts(hostname)
configure_bashrc(hostname)
configure_motd(hostname)
execute_command("reboot")
execute_command("systemctl stop clever-show & reboot")
# execute_command("hostname {}".format(hostname))
# restart_service("dhcpcd")
# restart_service("avahi-daemon")