mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-06-10 11:00:22 +00:00
names: Use hostnamectl instead of socket API get the current hostname
- This would mean consistent interfacing with systemd instead of a split approach. Tests: - Edit hostname page shows the current value of hostname correctly. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
4176f53e05
commit
d9f9168c76
@ -242,7 +242,9 @@ def get_domain_name():
|
||||
|
||||
def get_hostname():
|
||||
"""Return the hostname."""
|
||||
return socket.gethostname()
|
||||
process = subprocess.run(['hostnamectl', 'hostname', '--static'],
|
||||
stdout=subprocess.PIPE, check=True)
|
||||
return process.stdout.decode().strip()
|
||||
|
||||
|
||||
def set_hostname(hostname):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user