Fix broken sysconfig file writing on DigitalOcean

https://bugzilla.redhat.com/show_bug.cgi?id=1465440
This commit is contained in:
Garrett Holmstrom 2017-06-27 15:45:45 -07:00
parent 02e0391010
commit 75af4c1acd
2 changed files with 22 additions and 3 deletions

View File

@ -70,10 +70,22 @@ Index: cloud-init-0.7.9/cloudinit/net/sysconfig.py
@classmethod
def _render_bridge_interfaces(cls, network_state, iface_contents):
bridge_filter = renderer.filter_by_type('bridge')
@@ -396,6 +415,12 @@ class Renderer(renderer.Renderer):
@@ -387,18 +406,25 @@ class Renderer(renderer.Renderer):
return contents
def render_network_state(self, target, network_state):
+ file_mode = 0o644
base_sysconf_dir = os.path.join(target, self.sysconf_dir)
for path, data in self._render_sysconfig(base_sysconf_dir,
network_state).items():
- util.write_file(path, data)
+ util.write_file(path, data, file_mode)
if self.dns_path:
dns_path = os.path.join(target, self.dns_path)
resolv_content = self._render_dns(network_state,
existing_dns_path=dns_path)
util.write_file(dns_path, resolv_content)
- util.write_file(dns_path, resolv_content)
+ util.write_file(dns_path, resolv_content, file_mode)
+ if self.networkmanager_conf_path:
+ nm_conf_path = util.target_path(target,
+ self.networkmanager_conf_path)
@ -83,6 +95,10 @@ Index: cloud-init-0.7.9/cloudinit/net/sysconfig.py
if self.netrules_path:
netrules_content = self._render_persistent_net(network_state)
netrules_path = os.path.join(target, self.netrules_path)
- util.write_file(netrules_path, netrules_content)
+ util.write_file(netrules_path, netrules_content, file_mode)
# vi: ts=4 expandtab
Index: cloud-init-0.7.9/tests/unittests/test_net.py
===================================================================
--- cloud-init-0.7.9.orig/tests/unittests/test_net.py

View File

@ -1,6 +1,6 @@
Name: cloud-init
Version: 0.7.9
Release: 6%{?dist}
Release: 7%{?dist}
Summary: Cloud instance init scripts
License: GPLv3
URL: http://launchpad.net/cloud-init
@ -242,6 +242,9 @@ nosetests-%{python3_version} tests/unittests/
%changelog
* Tue Jun 27 2017 Garrett Holmstrom <gholms@fedoraproject.org> - 0.7.9-7
- Fixed broken sysconfig file writing on DigitalOcean [RH:1465440]
* Wed Jun 21 2017 Garrett Holmstrom <gholms@fedoraproject.org> - 0.7.9-6
- Fixed NameError in package module [RH:1447708]
- Resolved a conflict between cloud-init and NetworkManager writing resolv.conf [RH:1454491 RH:1461959 LP:1693251]