-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
0006-Support-for-setting-hostname-from-configuration-file.patch
54 lines (47 loc) · 1.82 KB
/
0006-Support-for-setting-hostname-from-configuration-file.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
From 432662457c561d05c9d8fcc9b5e7858d6ce89258 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Pierret=20=28fepitre=29?=
<frederic.pierret@qubes-os.org>
Date: Wed, 4 Jan 2023 17:18:36 +0100
Subject: [PATCH] Support for setting hostname from configuration file
---
data/anaconda.conf | 2 ++
pyanaconda/core/configuration/network.py | 5 +++++
pyanaconda/modules/network/network.py | 2 +-
3 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/data/anaconda.conf b/data/anaconda.conf
index 23dad7cc0c..60d09ded28 100644
--- a/data/anaconda.conf
+++ b/data/anaconda.conf
@@ -66,6 +66,8 @@ can_save_installation_logs = True
#
default_on_boot = NONE
+# Set hostname
+hostname =
[Payload]
# Default package environment.
diff --git a/pyanaconda/core/configuration/network.py b/pyanaconda/core/configuration/network.py
index f41c00b7e5..b3cb43a828 100644
--- a/pyanaconda/core/configuration/network.py
+++ b/pyanaconda/core/configuration/network.py
@@ -45,3 +45,8 @@ class NetworkSection(Section):
:return: an instance of NetworkOnBoot
"""
return self._get_option("default_on_boot", NetworkOnBoot)
+
+ @property
+ def hostname(self):
+ """Hostname"""
+ return self._get_option("hostname", str)
diff --git a/pyanaconda/modules/network/network.py b/pyanaconda/modules/network/network.py
index 0882144b8c..a31189e68e 100644
--- a/pyanaconda/modules/network/network.py
+++ b/pyanaconda/modules/network/network.py
@@ -65,7 +65,7 @@ class NetworkService(KickstartService):
self._firewall_module = FirewallModule()
self.hostname_changed = Signal()
- self._hostname = ""
+ self._hostname = conf.network.hostname
self.current_hostname_changed = Signal()
self._hostname_service_proxy = self._get_hostname_proxy()
--
2.45.2