Change-Id: I7ce3c7774e009e6a483186e0f351f75df120a90b
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/4078
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Dheeraj S Shetty <dheerajs@vmware.com>
| ... | ... |
@@ -5,7 +5,7 @@ |
| 5 | 5 |
|
| 6 | 6 |
Name: cloud-init |
| 7 | 7 |
Version: 0.7.9 |
| 8 |
-Release: 3%{?dist}
|
|
| 8 |
+Release: 4%{?dist}
|
|
| 9 | 9 |
Summary: Cloud instance init scripts |
| 10 | 10 |
Group: System Environment/Base |
| 11 | 11 |
License: GPLv3 |
| ... | ... |
@@ -22,6 +22,7 @@ Patch3: photon-hosts-template.patch |
| 22 | 22 |
Patch4: resizePartitionUUID.patch |
| 23 | 23 |
Patch5: datasource-guestinfo.patch |
| 24 | 24 |
Patch6: systemd-service-changes.patch |
| 25 |
+Patch7: systemd-resolved-config.patch |
|
| 25 | 26 |
|
| 26 | 27 |
BuildRequires: python3 |
| 27 | 28 |
BuildRequires: python3-libs |
| ... | ... |
@@ -32,7 +33,7 @@ BuildRequires: python3-ipaddr |
| 32 | 32 |
BuildRequires: iproute2 |
| 33 | 33 |
BuildRequires: automake |
| 34 | 34 |
|
| 35 |
-Requires: systemd |
|
| 35 |
+Requires: systemd >= 228-38 |
|
| 36 | 36 |
Requires: net-tools |
| 37 | 37 |
Requires: python3 |
| 38 | 38 |
Requires: python3-libs |
| ... | ... |
@@ -63,6 +64,7 @@ ssh keys and to let the user run various scripts. |
| 63 | 63 |
%patch4 -p1 |
| 64 | 64 |
%patch5 -p1 |
| 65 | 65 |
%patch6 -p1 |
| 66 |
+%patch7 -p1 |
|
| 66 | 67 |
|
| 67 | 68 |
find systemd -name cloud*.service | xargs sed -i s/StandardOutput=journal+console/StandardOutput=journal/g |
| 68 | 69 |
|
| ... | ... |
@@ -200,6 +202,8 @@ systemctl daemon-reload >/dev/null 2>&1 || : |
| 200 | 200 |
|
| 201 | 201 |
|
| 202 | 202 |
%changelog |
| 203 |
+* Tue Oct 17 2017 Vinay Kulkarni <kulkarniv@vmware.com> 0.7.9-4 |
|
| 204 |
+- Support configuration of systemd resolved.conf |
|
| 203 | 205 |
* Fri Jul 28 2017 Dheeraj Shetty <dheerajs@vmware.com> 0.7.9-3 |
| 204 | 206 |
- Removed networking.service and NetworkManger.service from |
| 205 | 207 |
- cloud-init and cloud-init-local service files |
| 206 | 208 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,64 @@ |
| 0 |
+diff -uNr cloud-init-0.7.9-orig/cloudinit/config/cc_resolv_conf.py cloud-init-0.7.9/cloudinit/config/cc_resolv_conf.py |
|
| 1 |
+--- cloud-init-0.7.9-orig/cloudinit/config/cc_resolv_conf.py 2017-10-18 00:36:44.839010507 +0000 |
|
| 2 |
+@@ -55,10 +55,10 @@ |
|
| 3 |
+ |
|
| 4 |
+ frequency = PER_INSTANCE |
|
| 5 |
+ |
|
| 6 |
+-distros = ['fedora', 'rhel', 'sles'] |
|
| 7 |
++distros = ['fedora', 'rhel', 'sles', 'photon'] |
|
| 8 |
+ |
|
| 9 |
+ |
|
| 10 |
+-def generate_resolv_conf(template_fn, params, target_fname="/etc/resolv.conf"): |
|
| 11 |
++def generate_resolv_conf(template_fn, params, target_fname="/etc/systemd/resolved.conf"): |
|
| 12 |
+ flags = [] |
|
| 13 |
+ false_flags = [] |
|
| 14 |
+ |
|
| 15 |
+@@ -104,12 +104,29 @@ |
|
| 16 |
+ if "resolv_conf" not in cfg: |
|
| 17 |
+ log.warn("manage_resolv_conf True but no parameters provided!")
|
|
| 18 |
+ |
|
| 19 |
+- template_fn = cloud.get_template_filename('resolv.conf')
|
|
| 20 |
++ template_fn = cloud.get_template_filename('systemd.resolved.conf')
|
|
| 21 |
+ if not template_fn: |
|
| 22 |
+- log.warn("No template found, not rendering /etc/resolv.conf")
|
|
| 23 |
++ log.warn("No template found, not rendering /etc/systemd/resolved.conf")
|
|
| 24 |
+ return |
|
| 25 |
+ |
|
| 26 |
+ generate_resolv_conf(template_fn=template_fn, params=cfg["resolv_conf"]) |
|
| 27 |
++ |
|
| 28 |
++ cmd = ['/usr/bin/sed', '-i', '/Domains=/d' , '/etc/systemd/network/99-dhcp-en.network'] |
|
| 29 |
++ util.subp(cmd) |
|
| 30 |
++ |
|
| 31 |
++ domain_regex_str = None |
|
| 32 |
++ resolv_cfg = cfg["resolv_conf"] |
|
| 33 |
++ if resolv_cfg: |
|
| 34 |
++ domains = resolv_cfg["searchdomains"] |
|
| 35 |
++ if domains: |
|
| 36 |
++ domains_regex_str = '/\[Network\]/a Domains=' |
|
| 37 |
++ for domain in domains: |
|
| 38 |
++ domains_regex_str += domain + ' ' |
|
| 39 |
++ if domains_regex_str: |
|
| 40 |
++ cmd = ['/usr/bin/sed', '-i', domains_regex_str, '/etc/systemd/network/99-dhcp-en.network'] |
|
| 41 |
++ util.subp(cmd) |
|
| 42 |
++ |
|
| 43 |
++ util.subp(["systemctl", "restart", "systemd-networkd", "systemd-resolved"]) |
|
| 44 |
+ return |
|
| 45 |
+ |
|
| 46 |
+ # vi: ts=4 expandtab |
|
| 47 |
+diff -uNr cloud-init-0.7.9-orig/templates/systemd.resolved.conf.tmpl cloud-init-0.7.9/templates/systemd.resolved.conf.tmpl |
|
| 48 |
+--- cloud-init-0.7.9-orig/templates/systemd.resolved.conf.tmpl 1970-01-01 00:00:00.000000000 +0000 |
|
| 49 |
+@@ -0,0 +1,12 @@ |
|
| 50 |
++## template:jinja |
|
| 51 |
++# Your system has been configured with 'manage-resolv-conf' set to true. |
|
| 52 |
++# As a result, cloud-init has written this file with configuration data |
|
| 53 |
++# that it has been provided. Cloud-init, by default, will write this file |
|
| 54 |
++# a single time (PER_ONCE). |
|
| 55 |
++# |
|
| 56 |
++[Resolve] |
|
| 57 |
++LLMNR=false |
|
| 58 |
++{% if nameservers is defined %}
|
|
| 59 |
++DNS={% for server in nameservers %}{{server}} {% endfor %}
|
|
| 60 |
++{% endif %}
|
|
| 61 |
++ |