Skip to content

Commit

Permalink
network: enable dnsconfd service on installed system if required
Browse files Browse the repository at this point in the history
Resolves: RHEL-80011
  • Loading branch information
rvykydal committed Feb 18, 2025
1 parent 29a8f39 commit 29ad169
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pyanaconda/modules/network/installation.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import os
import shutil

from pyanaconda.core import service
from pyanaconda.core.kernel import kernel_arguments
from pyanaconda.core.path import make_directories, join_paths
from pyanaconda.modules.common.errors.installation import NetworkInstallationError
from pyanaconda.modules.common.task import Task
Expand Down Expand Up @@ -115,6 +117,7 @@ class NetworkInstallationTask(Task):
[Link]
Name={}
""".strip()
DNSCONFD_SERVICE = "dnsconfd"

def __init__(self, sysroot, disable_ipv6, overwrite,
network_ifaces, ifname_option_values,
Expand Down Expand Up @@ -158,6 +161,7 @@ def run(self):
if self._configure_persistent_device_names:
self._copy_prefixdevname_files(self._sysroot)
self._copy_global_dns_config(self._sysroot)
self._enable_dnsconfd(self._sysroot)

def _write_sysconfig_network(self, root, overwrite):
"""Write empty /etc/sysconfig/network target system configuration file.
Expand Down Expand Up @@ -295,6 +299,13 @@ def _copy_global_dns_config(self, root):
if os.path.isfile(src):
shutil.copy(src, dst)

def _enable_dnsconfd(self, root):
"""Enable dnsconfd service if dnsconfd backend is used."""
if kernel_arguments.get("rd.net.dns-backend") == "dnsconfd":
if not service.is_service_installed(self.DNSCONFD_SERVICE, root=root):
log.debug("The dnsconfd service is not installed.")
return
service.enable_service(self.DNSCONFD_SERVICE, root=root)

class ConfigureActivationOnBootTask(Task):
"""Task for configuration of automatic activation of devices on boot"""
Expand Down

0 comments on commit 29ad169

Please sign in to comment.