Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1465440 - Cloud-init sysconifg.py called util.write_file incorrectly
Summary: Cloud-init sysconifg.py called util.write_file incorrectly
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: cloud-init
Version: 26
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Garrett Holmstrom
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: AcceptedFreezeException
Depends On:
Blocks: F26FinalFreezeException
TreeView+ depends on / blocked
 
Reported: 2017-06-27 12:37 UTC by Ben Howard
Modified: 2018-05-29 12:15 UTC (History)
10 users (show)

Fixed In Version: cloud-init-0.7.9-7.fc26
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-05-29 12:15:08 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Ben Howard 2017-06-27 12:37:43 UTC
When provisioning Fedora 25 and 26 Atomic, it fails to setup networking due to:

This is caused by line 423, which calls util.write incorrectly: 
util.write_file(nm_conf_path, nm_conf_content, file_mode)

The third parameter of "file_mode" appears to be a backport, since it appears in the current upstream trunk. 

Potential fix:
--- /usr/lib/python3.6/site-packages/cloudinit/net/sysconfig.py	1970-01-01 00:00:00.000000000 +0000
+++ /tmp/sysconfig.py	2017-06-27 12:36:47.455379873 +0000
@@ -420,7 +420,7 @@
                                             self.networkmanager_conf_path)
             nm_conf_content = self._render_networkmanager_conf(network_state)
             if nm_conf_content:
-                util.write_file(nm_conf_path, nm_conf_content, file_mode)
+                util.write_file(nm_conf_path, nm_conf_content)
         if self.netrules_path:
             netrules_content = self._render_persistent_net(network_state)
             netrules_path = os.path.join(target, self.netrules_path)

Comment 1 Lars Kellogg-Stedman 2017-06-27 12:58:01 UTC
That appears to be a mis-applied backport.  The changes to write_file were implemented in https://git.launchpad.net/cloud-init/commit/?id=721348a6 to resolve https://bugzilla.redhat.com/show_bug.cgi?id=1295984.

I think that the fix in the description here is incorrect; rather, the Fedora package should probably carry 721348a6 as well.

Comment 2 Lars Kellogg-Stedman 2017-06-27 13:04:19 UTC
Actually, I lied. The support for the mode parameter has been around forever. Going back to 0.7.5, write_file looks like:

   def write_file(filename, content, mode=0644, omode="wb"):

Which is fine.  So actually, I don't see any problem here.  Are you seeing some sort of failure?  Could you post the error/traceback? Thanks!

Comment 3 Dusty Mabe 2017-06-27 13:10:42 UTC
Here is the traceback he sent me earlier:

```
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/cloudinit/cmd/main.py", line 513, in status_wrapper
    ret = functor(name, args) 
  File "/usr/lib/python3.6/site-packages/cloudinit/cmd/main.py", line 269, in main_init
    init.apply_network_config(bring_up=bool(mode != sources.DSMODE_LOCAL))
  File "/usr/lib/python3.6/site-packages/cloudinit/stages.py", line 641, in apply_network_config
    return self.distro.apply_network_config(netcfg, bring_up=bring_up)
  File "/usr/lib/python3.6/site-packages/cloudinit/distros/__init__.py", line 150, in apply_network_config
    dev_names = self._write_network_config(netconfig)
  File "/usr/lib/python3.6/site-packages/cloudinit/distros/rhel.py", line 60, in _write_network_config 
    self._net_renderer.render_network_state("/", ns)
  File "/usr/lib/python3.6/site-packages/cloudinit/net/sysconfig.py", line 423, in render_network_state   
    util.write_file(nm_conf_path, nm_conf_content, file_mode)
  NameError: name 'file_mode' is not defined
```

Comment 4 Lars Kellogg-Stedman 2017-06-27 13:17:47 UTC
Okay, so, still a mis-applied backport.  The file_mode variable should be defined at the top of render_network_state.  That was introduced in ef18b8ac4cf7e3dfd98830fbdb298380a192a0fc.

Comment 5 Fedora Update System 2017-06-27 23:09:23 UTC
cloud-init-0.7.9-7.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2017-faae58b0d0

Comment 6 Fedora Update System 2017-06-27 23:09:43 UTC
cloud-init-0.7.9-7.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2017-faae58b0d0

Comment 7 Garrett Holmstrom 2017-06-27 23:17:15 UTC
F26 update:  https://bodhi.fedoraproject.org/updates/cloud-init-0.7.9-7.fc26

Comment 8 Fedora Update System 2017-06-28 19:20:32 UTC
cloud-init-0.7.9-7.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-a687a6d05c

Comment 9 Fedora Update System 2017-06-28 21:53:00 UTC
cloud-init-0.7.9-7.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-faae58b0d0

Comment 11 Fedora Blocker Bugs Application 2017-06-29 02:19:00 UTC
Proposed as a Freeze Exception for 26-final by Fedora user dustymabe using the blocker tracking app because:

 This fixes an issue with static networking configuration in cloud-init. Our DigitalOcean images use this in order to configure network. Please allow it as a freeze exception.

Comment 12 Ben Howard 2017-06-29 12:30:14 UTC
Images posted in Comment #10 still have the previous version of Cloud-init:

# rpm -qa cloud-init
cloud-init-0.7.9-6.fc26.noarch

/var/log/cloud-init.log
2017-06-29 12:26:26,021 - util.py[DEBUG]: failed stage init-local
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/cloudinit/cmd/main.py", line 513, in status_wrapper
    ret = functor(name, args)
  File "/usr/lib/python3.6/site-packages/cloudinit/cmd/main.py", line 269, in main_init
    init.apply_network_config(bring_up=bool(mode != sources.DSMODE_LOCAL))
  File "/usr/lib/python3.6/site-packages/cloudinit/stages.py", line 641, in apply_network_config
    return self.distro.apply_network_config(netcfg, bring_up=bring_up)
  File "/usr/lib/python3.6/site-packages/cloudinit/distros/__init__.py", line 150, in apply_network_config
    dev_names = self._write_network_config(netconfig)
  File "/usr/lib/python3.6/site-packages/cloudinit/distros/rhel.py", line 60, in _write_network_config
    self._net_renderer.render_network_state("/", ns)
  File "/usr/lib/python3.6/site-packages/cloudinit/net/sysconfig.py", line 423, in render_network_state
    util.write_file(nm_conf_path, nm_conf_content, file_mode)
NameError: name 'file_mode' is not defined

Comment 13 Dusty Mabe 2017-06-29 13:49:03 UTC
ok the cloud base image did not have the new cloud-init. The atomic image was good. Can you re-download the cloud-base image and verify your images match:


```
$ md5sum atomic-host-cloud-init-0.7.9-7.qcow2 cloud-base-cloud-init-0.7.9-7.qcow2 
50c418f240b04ef7ceaa6e933d0de628  atomic-host-cloud-init-0.7.9-7.qcow2
e56b3b64a2b1bd3a569afe7f90a2b62a  cloud-base-cloud-init-0.7.9-7.qcow2
```

Comment 14 Adam Williamson 2017-06-29 19:30:53 UTC
Discussed at 2017-06-29 freeze exception review meeting: https://meetbot-raw.fedoraproject.org/fedora-blocker-review/2017-06-29/f26-blocker-review.2017-06-29-16.00.html . Accepted as a freeze exception as a significant issue which can't be fully fixed with a post-release update.

Comment 15 Fedora Update System 2017-07-06 22:50:48 UTC
cloud-init-0.7.9-7.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.

Comment 16 Fedora Update System 2017-09-18 22:38:19 UTC
cloud-init-0.7.9-9.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2017-5507234819

Comment 17 Fedora Update System 2017-09-20 01:21:54 UTC
cloud-init-0.7.9-9.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-5507234819

Comment 18 Fedora End Of Life 2018-05-03 08:33:03 UTC
This message is a reminder that Fedora 26 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 26. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '26'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 26 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 19 Fedora End Of Life 2018-05-29 12:15:08 UTC
Fedora 26 changed to end-of-life (EOL) status on 2018-05-29. Fedora 26
is no longer maintained, which means that it will not receive any
further security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.