828b155e |
diff -uNr cloud-init-18.3/cloudinit/config/cc_resolv_conf.py cloud-init-18.3-new/cloudinit/config/cc_resolv_conf.py
--- cloud-init-18.3/cloudinit/config/cc_resolv_conf.py 2018-06-20 05:49:26.000000000 +0530
+++ cloud-init-18.3-new/cloudinit/config/cc_resolv_conf.py 2018-09-20 20:33:38.368316711 +0530 |
37f01a69 |
@@ -55,10 +55,10 @@
frequency = PER_INSTANCE
|
828b155e |
-distros = ['fedora', 'opensuse', 'rhel', 'sles']
+distros = ['fedora', 'opensuse', 'rhel', 'sles', 'photon'] |
37f01a69 |
-def generate_resolv_conf(template_fn, params, target_fname="/etc/resolv.conf"):
+def generate_resolv_conf(template_fn, params, target_fname="/etc/systemd/resolved.conf"):
flags = []
false_flags = []
@@ -104,12 +104,13 @@
if "resolv_conf" not in cfg:
log.warn("manage_resolv_conf True but no parameters provided!")
- template_fn = cloud.get_template_filename('resolv.conf')
+ template_fn = cloud.get_template_filename('systemd.resolved.conf')
if not template_fn:
- log.warn("No template found, not rendering /etc/resolv.conf")
+ log.warn("No template found, not rendering /etc/systemd/resolved.conf")
return
generate_resolv_conf(template_fn=template_fn, params=cfg["resolv_conf"])
+ util.subp(["systemctl", "restart", "systemd-resolved"])
return
# vi: ts=4 expandtab |
828b155e |
diff -uNr cloud-init-18.3/templates/systemd.resolved.conf.tmpl cloud-init-18.3-new/templates/systemd.resolved.conf.tmpl
--- cloud-init-18.3/templates/systemd.resolved.conf.tmpl 1970-01-01 05:30:00.000000000 +0530
+++ cloud-init-18.3-new/templates/systemd.resolved.conf.tmpl 2018-09-20 20:35:54.672313067 +0530 |
37f01a69 |
@@ -0,0 +1,15 @@
+## template:jinja
+# Your system has been configured with 'manage-resolv-conf' set to true.
+# As a result, cloud-init has written this file with configuration data
+# that it has been provided. Cloud-init, by default, will write this file
+# a single time (PER_ONCE).
+#
+[Resolve]
+LLMNR=false
+{% if nameservers is defined %}
+DNS={% for server in nameservers %}{{server}} {% endfor %}
+{% endif %}
+
+{% if searchdomains is defined %}
+Domains={% for search in searchdomains %}{{search}} {% endfor %}
+{% endif %} |