We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[Backport] Add support for cnames in dnsmasq
### Original feature issue

- Issue: #1643
- PR: #3640

### Target release

- [x] release33
- [ ] release32
- [ ] release30

### Reason

Stabilization of Cobbler 3.3.5


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `cobbler/modules/managers/dnsmasq.py`
Content:
```
1 """
2 This is some of the code behind 'cobbler sync'.
3 
4 Copyright 2006-2009, Red Hat, Inc and Others
5 Michael DeHaan <michael.dehaan AT gmail>
6 John Eckersberg <jeckersb@redhat.com>
7 
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12 
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 GNU General Public License for more details.
17 
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 02110-1301  USA
22 """
23 
24 import time
25 
26 import cobbler.utils as utils
27 from cobbler.manager import ManagerModule
28 
29 MANAGER = None
30 
31 
32 def register() -> str:
33     """
34     The mandatory Cobbler modules registration hook.
35 
36     :return: Always "manage".
37     """
38     return "manage"
39 
40 
41 class _DnsmasqManager(ManagerModule):
42     """
43     Handles conversion of internal state to the tftpboot tree layout.
44     """
45 
46     @staticmethod
47     def what() -> str:
48         """
49         This identifies the module.
50 
51         :return: Will always return ``dnsmasq``.
52         """
53         return "dnsmasq"
54 
55     def write_configs(self):
56         """
57         DHCP files are written when ``manage_dhcp`` is set in our settings.
58 
59         :raises OSError
60         """
61 
62         settings_file = "/etc/dnsmasq.conf"
63         template_file = "/etc/cobbler/dnsmasq.template"
64 
65         try:
66             f2 = open(template_file, "r")
67         except Exception:
68             raise OSError("error writing template to file: %s" % template_file)
69         template_data = f2.read()
70         f2.close()
71 
72         system_definitions = {}
73 
74         # we used to just loop through each system, but now we must loop
75         # through each network interface of each system.
76 
77         for system in self.systems:
78 
79             if not system.is_management_supported(cidr_ok=False):
80                 continue
81 
82             profile = system.get_conceptual_parent()
83             distro = profile.get_conceptual_parent()
84             for interface in system.interfaces.values():
85 
86                 mac = interface.mac_address
87                 ip = interface.ip_address
88                 host = interface.dns_name
89                 ipv6 = interface.ipv6_address
90 
91                 if not mac:
92                     # can't write a DHCP entry for this system
93                     continue
94 
95                 # In many reallife situations there is a need to control the IP address and hostname for a specific
96                 # client when only the MAC address is available. In addition to that in some scenarios there is a need
97                 # to explicitly label a host with the applicable architecture in order to correctly handle situations
98                 # where we need something other than ``pxelinux.0``. So we always write a dhcp-host entry with as much
99                 # info as possible to allow maximum control and flexibility within the dnsmasq config.
100 
101                 systxt = "dhcp-host=net:" + distro.arch.value.lower() + "," + mac
102 
103                 if host != "":
104                     systxt += "," + host
105 
106                 if ip != "":
107                     systxt += "," + ip
108                 if ipv6 != "":
109                     systxt += ",[%s]" % ipv6
110 
111                 systxt += "\n"
112 
113                 dhcp_tag = interface.dhcp_tag
114                 if dhcp_tag == "":
115                     dhcp_tag = "default"
116 
117                 if dhcp_tag not in system_definitions:
118                     system_definitions[dhcp_tag] = ""
119                 system_definitions[dhcp_tag] = system_definitions[dhcp_tag] + systxt
120 
121         # We are now done with the looping through each interface of each system.
122 
123         metadata = {
124             "insert_cobbler_system_definitions": system_definitions.get("default", ""),
125             "date": time.asctime(time.gmtime()),
126             "cobbler_server": self.settings.server,
127             "next_server_v4": self.settings.next_server_v4,
128             "next_server_v6": self.settings.next_server_v6,
129         }
130 
131         # now add in other DHCP expansions that are not tagged with "default"
132         for x in list(system_definitions.keys()):
133             if x == "default":
134                 continue
135             metadata["insert_cobbler_system_definitions_%s" % x] = system_definitions[x]
136 
137         self.templar.render(template_data, metadata, settings_file)
138 
139     def regen_ethers(self):
140         """
141         This function regenerates the ethers file. To get more information please read ``man ethers``, the format is
142         also in there described.
143         """
144         # dnsmasq knows how to read this database of MACs -> IPs, so we'll keep it up to date every time we add a
145         # system.
146         fh = open("/etc/ethers", "w+")
147         for system in self.systems:
148             if not system.is_management_supported(cidr_ok=False):
149                 continue
150             for interface in system.interfaces.values():
151                 mac = interface.mac_address
152                 ip = interface.ip_address
153                 if not mac:
154                     # can't write this w/o a MAC address
155                     continue
156                 if ip is not None and ip != "":
157                     fh.write(mac.upper() + "\t" + ip + "\n")
158         fh.close()
159 
160     def regen_hosts(self):
161         """
162         This rewrites the hosts file and thus also rewrites the dns config.
163         """
164         # dnsmasq knows how to read this database for host info (other things may also make use of this later)
165         fh = open("/var/lib/cobbler/cobbler_hosts", "w+")
166         for system in self.systems:
167             if not system.is_management_supported(cidr_ok=False):
168                 continue
169             for (_, interface) in system.interfaces.items():
170                 mac = interface.mac_address
171                 host = interface.dns_name
172                 ip = interface.ip_address
173                 ipv6 = interface.ipv6_address
174                 if not mac:
175                     continue
176                 if host is not None and host != "" and ipv6 is not None and ipv6 != "":
177                     fh.write(ipv6 + "\t" + host + "\n")
178                 elif host is not None and host != "" and ip is not None and ip != "":
179                     fh.write(ip + "\t" + host + "\n")
180         fh.close()
181 
182     def restart_service(self):
183         """
184         This restarts the dhcp server and thus applied the newly written config files.
185         """
186         service_name = "dnsmasq"
187         if self.settings.restart_dhcp:
188             return_code_service_restart = utils.service_restart(service_name)
189             if return_code_service_restart != 0:
190                 self.logger.error("%s service failed", service_name)
191             return return_code_service_restart
192 
193 
194 def get_manager(api):
195     """
196     Creates a manager object to manage a dnsmasq server.
197 
198     :param api: The API to resolve all information with.
199     :return: The object generated from the class.
200     """
201     # Singleton used, therefore ignoring 'global'
202     global MANAGER  # pylint: disable=global-statement
203 
204     if not MANAGER:
205         MANAGER = _DnsmasqManager(api)
206     return MANAGER
207
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/cobbler/modules/managers/dnsmasq.py b/cobbler/modules/managers/dnsmasq.py
--- a/cobbler/modules/managers/dnsmasq.py
+++ b/cobbler/modules/managers/dnsmasq.py
@@ -169,14 +169,21 @@
             for (_, interface) in system.interfaces.items():
                 mac = interface.mac_address
                 host = interface.dns_name
+                cnames = " ".join(interface.cnames)
                 ip = interface.ip_address
                 ipv6 = interface.ipv6_address
                 if not mac:
                     continue
                 if host is not None and host != "" and ipv6 is not None and ipv6 != "":
-                    fh.write(ipv6 + "\t" + host + "\n")
+                    if cnames:
+                        fh.write(ipv6 + "\t" + host + ' ' + cnames + "\n")
+                    else:
+                        fh.write(ipv6 + "\t" + host + "\n")
                 elif host is not None and host != "" and ip is not None and ip != "":
-                    fh.write(ip + "\t" + host + "\n")
+                    if cnames:
+                        fh.write(ip + "\t" + host + ' ' + cnames + "\n")
+                    else:
+                        fh.write(ip + "\t" + host + "\n")
         fh.close()
 
     def restart_service(self):

{"golden_diff": "diff --git a/cobbler/modules/managers/dnsmasq.py b/cobbler/modules/managers/dnsmasq.py\n--- a/cobbler/modules/managers/dnsmasq.py\n+++ b/cobbler/modules/managers/dnsmasq.py\n@@ -169,14 +169,21 @@\n             for (_, interface) in system.interfaces.items():\n                 mac = interface.mac_address\n                 host = interface.dns_name\n+                cnames = \" \".join(interface.cnames)\n                 ip = interface.ip_address\n                 ipv6 = interface.ipv6_address\n                 if not mac:\n                     continue\n                 if host is not None and host != \"\" and ipv6 is not None and ipv6 != \"\":\n-                    fh.write(ipv6 + \"\\t\" + host + \"\\n\")\n+                    if cnames:\n+                        fh.write(ipv6 + \"\\t\" + host + ' ' + cnames + \"\\n\")\n+                    else:\n+                        fh.write(ipv6 + \"\\t\" + host + \"\\n\")\n                 elif host is not None and host != \"\" and ip is not None and ip != \"\":\n-                    fh.write(ip + \"\\t\" + host + \"\\n\")\n+                    if cnames:\n+                        fh.write(ip + \"\\t\" + host + ' ' + cnames + \"\\n\")\n+                    else:\n+                        fh.write(ip + \"\\t\" + host + \"\\n\")\n         fh.close()\n \n     def restart_service(self):\n", "issue": "[Backport] Add support for cnames in dnsmasq\n### Original feature issue\r\n\r\n- Issue: #1643\r\n- PR: #3640\r\n\r\n### Target release\r\n\r\n- [x] release33\r\n- [ ] release32\r\n- [ ] release30\r\n\r\n### Reason\r\n\r\nStabilization of Cobbler 3.3.5\r\n\n", "before_files": [{"content": "\"\"\"\nThis is some of the code behind 'cobbler sync'.\n\nCopyright 2006-2009, Red Hat, Inc and Others\nMichael DeHaan <michael.dehaan AT gmail>\nJohn Eckersberg <jeckersb@redhat.com>\n\nThis program is free software; you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation; either version 2 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program; if not, write to the Free Software\nFoundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\n02110-1301  USA\n\"\"\"\n\nimport time\n\nimport cobbler.utils as utils\nfrom cobbler.manager import ManagerModule\n\nMANAGER = None\n\n\ndef register() -> str:\n    \"\"\"\n    The mandatory Cobbler modules registration hook.\n\n    :return: Always \"manage\".\n    \"\"\"\n    return \"manage\"\n\n\nclass _DnsmasqManager(ManagerModule):\n    \"\"\"\n    Handles conversion of internal state to the tftpboot tree layout.\n    \"\"\"\n\n    @staticmethod\n    def what() -> str:\n        \"\"\"\n        This identifies the module.\n\n        :return: Will always return ``dnsmasq``.\n        \"\"\"\n        return \"dnsmasq\"\n\n    def write_configs(self):\n        \"\"\"\n        DHCP files are written when ``manage_dhcp`` is set in our settings.\n\n        :raises OSError\n        \"\"\"\n\n        settings_file = \"/etc/dnsmasq.conf\"\n        template_file = \"/etc/cobbler/dnsmasq.template\"\n\n        try:\n            f2 = open(template_file, \"r\")\n        except Exception:\n            raise OSError(\"error writing template to file: %s\" % template_file)\n        template_data = f2.read()\n        f2.close()\n\n        system_definitions = {}\n\n        # we used to just loop through each system, but now we must loop\n        # through each network interface of each system.\n\n        for system in self.systems:\n\n            if not system.is_management_supported(cidr_ok=False):\n                continue\n\n            profile = system.get_conceptual_parent()\n            distro = profile.get_conceptual_parent()\n            for interface in system.interfaces.values():\n\n                mac = interface.mac_address\n                ip = interface.ip_address\n                host = interface.dns_name\n                ipv6 = interface.ipv6_address\n\n                if not mac:\n                    # can't write a DHCP entry for this system\n                    continue\n\n                # In many reallife situations there is a need to control the IP address and hostname for a specific\n                # client when only the MAC address is available. In addition to that in some scenarios there is a need\n                # to explicitly label a host with the applicable architecture in order to correctly handle situations\n                # where we need something other than ``pxelinux.0``. So we always write a dhcp-host entry with as much\n                # info as possible to allow maximum control and flexibility within the dnsmasq config.\n\n                systxt = \"dhcp-host=net:\" + distro.arch.value.lower() + \",\" + mac\n\n                if host != \"\":\n                    systxt += \",\" + host\n\n                if ip != \"\":\n                    systxt += \",\" + ip\n                if ipv6 != \"\":\n                    systxt += \",[%s]\" % ipv6\n\n                systxt += \"\\n\"\n\n                dhcp_tag = interface.dhcp_tag\n                if dhcp_tag == \"\":\n                    dhcp_tag = \"default\"\n\n                if dhcp_tag not in system_definitions:\n                    system_definitions[dhcp_tag] = \"\"\n                system_definitions[dhcp_tag] = system_definitions[dhcp_tag] + systxt\n\n        # We are now done with the looping through each interface of each system.\n\n        metadata = {\n            \"insert_cobbler_system_definitions\": system_definitions.get(\"default\", \"\"),\n            \"date\": time.asctime(time.gmtime()),\n            \"cobbler_server\": self.settings.server,\n            \"next_server_v4\": self.settings.next_server_v4,\n            \"next_server_v6\": self.settings.next_server_v6,\n        }\n\n        # now add in other DHCP expansions that are not tagged with \"default\"\n        for x in list(system_definitions.keys()):\n            if x == \"default\":\n                continue\n            metadata[\"insert_cobbler_system_definitions_%s\" % x] = system_definitions[x]\n\n        self.templar.render(template_data, metadata, settings_file)\n\n    def regen_ethers(self):\n        \"\"\"\n        This function regenerates the ethers file. To get more information please read ``man ethers``, the format is\n        also in there described.\n        \"\"\"\n        # dnsmasq knows how to read this database of MACs -> IPs, so we'll keep it up to date every time we add a\n        # system.\n        fh = open(\"/etc/ethers\", \"w+\")\n        for system in self.systems:\n            if not system.is_management_supported(cidr_ok=False):\n                continue\n            for interface in system.interfaces.values():\n                mac = interface.mac_address\n                ip = interface.ip_address\n                if not mac:\n                    # can't write this w/o a MAC address\n                    continue\n                if ip is not None and ip != \"\":\n                    fh.write(mac.upper() + \"\\t\" + ip + \"\\n\")\n        fh.close()\n\n    def regen_hosts(self):\n        \"\"\"\n        This rewrites the hosts file and thus also rewrites the dns config.\n        \"\"\"\n        # dnsmasq knows how to read this database for host info (other things may also make use of this later)\n        fh = open(\"/var/lib/cobbler/cobbler_hosts\", \"w+\")\n        for system in self.systems:\n            if not system.is_management_supported(cidr_ok=False):\n                continue\n            for (_, interface) in system.interfaces.items():\n                mac = interface.mac_address\n                host = interface.dns_name\n                ip = interface.ip_address\n                ipv6 = interface.ipv6_address\n                if not mac:\n                    continue\n                if host is not None and host != \"\" and ipv6 is not None and ipv6 != \"\":\n                    fh.write(ipv6 + \"\\t\" + host + \"\\n\")\n                elif host is not None and host != \"\" and ip is not None and ip != \"\":\n                    fh.write(ip + \"\\t\" + host + \"\\n\")\n        fh.close()\n\n    def restart_service(self):\n        \"\"\"\n        This restarts the dhcp server and thus applied the newly written config files.\n        \"\"\"\n        service_name = \"dnsmasq\"\n        if self.settings.restart_dhcp:\n            return_code_service_restart = utils.service_restart(service_name)\n            if return_code_service_restart != 0:\n                self.logger.error(\"%s service failed\", service_name)\n            return return_code_service_restart\n\n\ndef get_manager(api):\n    \"\"\"\n    Creates a manager object to manage a dnsmasq server.\n\n    :param api: The API to resolve all information with.\n    :return: The object generated from the class.\n    \"\"\"\n    # Singleton used, therefore ignoring 'global'\n    global MANAGER  # pylint: disable=global-statement\n\n    if not MANAGER:\n        MANAGER = _DnsmasqManager(api)\n    return MANAGER\n", "path": "cobbler/modules/managers/dnsmasq.py"}], "after_files": [{"content": "\"\"\"\nThis is some of the code behind 'cobbler sync'.\n\nCopyright 2006-2009, Red Hat, Inc and Others\nMichael DeHaan <michael.dehaan AT gmail>\nJohn Eckersberg <jeckersb@redhat.com>\n\nThis program is free software; you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation; either version 2 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program; if not, write to the Free Software\nFoundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\n02110-1301  USA\n\"\"\"\n\nimport time\n\nimport cobbler.utils as utils\nfrom cobbler.manager import ManagerModule\n\nMANAGER = None\n\n\ndef register() -> str:\n    \"\"\"\n    The mandatory Cobbler modules registration hook.\n\n    :return: Always \"manage\".\n    \"\"\"\n    return \"manage\"\n\n\nclass _DnsmasqManager(ManagerModule):\n    \"\"\"\n    Handles conversion of internal state to the tftpboot tree layout.\n    \"\"\"\n\n    @staticmethod\n    def what() -> str:\n        \"\"\"\n        This identifies the module.\n\n        :return: Will always return ``dnsmasq``.\n        \"\"\"\n        return \"dnsmasq\"\n\n    def write_configs(self):\n        \"\"\"\n        DHCP files are written when ``manage_dhcp`` is set in our settings.\n\n        :raises OSError\n        \"\"\"\n\n        settings_file = \"/etc/dnsmasq.conf\"\n        template_file = \"/etc/cobbler/dnsmasq.template\"\n\n        try:\n            f2 = open(template_file, \"r\")\n        except Exception:\n            raise OSError(\"error writing template to file: %s\" % template_file)\n        template_data = f2.read()\n        f2.close()\n\n        system_definitions = {}\n\n        # we used to just loop through each system, but now we must loop\n        # through each network interface of each system.\n\n        for system in self.systems:\n\n            if not system.is_management_supported(cidr_ok=False):\n                continue\n\n            profile = system.get_conceptual_parent()\n            distro = profile.get_conceptual_parent()\n            for interface in system.interfaces.values():\n\n                mac = interface.mac_address\n                ip = interface.ip_address\n                host = interface.dns_name\n                ipv6 = interface.ipv6_address\n\n                if not mac:\n                    # can't write a DHCP entry for this system\n                    continue\n\n                # In many reallife situations there is a need to control the IP address and hostname for a specific\n                # client when only the MAC address is available. In addition to that in some scenarios there is a need\n                # to explicitly label a host with the applicable architecture in order to correctly handle situations\n                # where we need something other than ``pxelinux.0``. So we always write a dhcp-host entry with as much\n                # info as possible to allow maximum control and flexibility within the dnsmasq config.\n\n                systxt = \"dhcp-host=net:\" + distro.arch.value.lower() + \",\" + mac\n\n                if host != \"\":\n                    systxt += \",\" + host\n\n                if ip != \"\":\n                    systxt += \",\" + ip\n                if ipv6 != \"\":\n                    systxt += \",[%s]\" % ipv6\n\n                systxt += \"\\n\"\n\n                dhcp_tag = interface.dhcp_tag\n                if dhcp_tag == \"\":\n                    dhcp_tag = \"default\"\n\n                if dhcp_tag not in system_definitions:\n                    system_definitions[dhcp_tag] = \"\"\n                system_definitions[dhcp_tag] = system_definitions[dhcp_tag] + systxt\n\n        # We are now done with the looping through each interface of each system.\n\n        metadata = {\n            \"insert_cobbler_system_definitions\": system_definitions.get(\"default\", \"\"),\n            \"date\": time.asctime(time.gmtime()),\n            \"cobbler_server\": self.settings.server,\n            \"next_server_v4\": self.settings.next_server_v4,\n            \"next_server_v6\": self.settings.next_server_v6,\n        }\n\n        # now add in other DHCP expansions that are not tagged with \"default\"\n        for x in list(system_definitions.keys()):\n            if x == \"default\":\n                continue\n            metadata[\"insert_cobbler_system_definitions_%s\" % x] = system_definitions[x]\n\n        self.templar.render(template_data, metadata, settings_file)\n\n    def regen_ethers(self):\n        \"\"\"\n        This function regenerates the ethers file. To get more information please read ``man ethers``, the format is\n        also in there described.\n        \"\"\"\n        # dnsmasq knows how to read this database of MACs -> IPs, so we'll keep it up to date every time we add a\n        # system.\n        fh = open(\"/etc/ethers\", \"w+\")\n        for system in self.systems:\n            if not system.is_management_supported(cidr_ok=False):\n                continue\n            for interface in system.interfaces.values():\n                mac = interface.mac_address\n                ip = interface.ip_address\n                if not mac:\n                    # can't write this w/o a MAC address\n                    continue\n                if ip is not None and ip != \"\":\n                    fh.write(mac.upper() + \"\\t\" + ip + \"\\n\")\n        fh.close()\n\n    def regen_hosts(self):\n        \"\"\"\n        This rewrites the hosts file and thus also rewrites the dns config.\n        \"\"\"\n        # dnsmasq knows how to read this database for host info (other things may also make use of this later)\n        fh = open(\"/var/lib/cobbler/cobbler_hosts\", \"w+\")\n        for system in self.systems:\n            if not system.is_management_supported(cidr_ok=False):\n                continue\n            for (_, interface) in system.interfaces.items():\n                mac = interface.mac_address\n                host = interface.dns_name\n                cnames = \" \".join(interface.cnames)\n                ip = interface.ip_address\n                ipv6 = interface.ipv6_address\n                if not mac:\n                    continue\n                if host is not None and host != \"\" and ipv6 is not None and ipv6 != \"\":\n                    if cnames:\n                        fh.write(ipv6 + \"\\t\" + host + ' ' + cnames + \"\\n\")\n                    else:\n                        fh.write(ipv6 + \"\\t\" + host + \"\\n\")\n                elif host is not None and host != \"\" and ip is not None and ip != \"\":\n                    if cnames:\n                        fh.write(ip + \"\\t\" + host + ' ' + cnames + \"\\n\")\n                    else:\n                        fh.write(ip + \"\\t\" + host + \"\\n\")\n        fh.close()\n\n    def restart_service(self):\n        \"\"\"\n        This restarts the dhcp server and thus applied the newly written config files.\n        \"\"\"\n        service_name = \"dnsmasq\"\n        if self.settings.restart_dhcp:\n            return_code_service_restart = utils.service_restart(service_name)\n            if return_code_service_restart != 0:\n                self.logger.error(\"%s service failed\", service_name)\n            return return_code_service_restart\n\n\ndef get_manager(api):\n    \"\"\"\n    Creates a manager object to manage a dnsmasq server.\n\n    :param api: The API to resolve all information with.\n    :return: The object generated from the class.\n    \"\"\"\n    # Singleton used, therefore ignoring 'global'\n    global MANAGER  # pylint: disable=global-statement\n\n    if not MANAGER:\n        MANAGER = _DnsmasqManager(api)\n    return MANAGER\n", "path": "cobbler/modules/managers/dnsmasq.py"}]}