Bug 1972283
| Summary: | AttributeError: module 'collections' has no attribute 'Iterable' | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Viktor Ashirov <vashirov> |
| Component: | cloud-init | Assignee: | Dusty Mabe <dustymabe> |
| Status: | CLOSED RAWHIDE | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | urgent | Docs Contact: | |
| Priority: | urgent | ||
| Version: | rawhide | CC: | adimania, apevec, dustymabe, eterrell, gholms, lars, shardy, s |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2021-06-17 17:29:12 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
Here's a quick fix:
diff --git a/cloudinit/log.py b/cloudinit/log.py
index 2e5df042..fbd3e80a 100644
--- a/cloudinit/log.py
+++ b/cloudinit/log.py
@@ -8,7 +8,10 @@
#
# This file is part of cloud-init. See LICENSE file for license information.
-import collections
+try:
+ import collections.abc as collectionsAbc # python 3.6+
+except ImportError:
+ import collections as collectionsAbc
import io
import logging
import logging.config
@@ -78,7 +81,7 @@ def setupLogging(cfg=None):
for a_cfg in cfg['log_cfgs']:
if isinstance(a_cfg, str):
log_cfgs.append(a_cfg)
- elif isinstance(a_cfg, (collections.Iterable)):
+ elif isinstance(a_cfg, (collectionsAbc.Iterable)):
cfg_str = [str(c) for c in a_cfg]
log_cfgs.append('\n'.join(cfg_str))
else:
Moving to POST as it's fixed upstream: https://github.com/canonical/cloud-init/pull/922 And raising the priority because latest rawhide qcow2 images are unusable without working cloud-init. |
Description of problem: cloud-init crashes with AttributeError: module 'collections' has no attribute 'Iterable' Version-Release number of selected component (if applicable): cloud-init-20.4-5.fc35.noarch.rpm How reproducible: always Steps to Reproduce: 1. /usr/bin/cloud-init init Actual results: ><fs> cat /var/log/cloud-init-output.log failed run of stage init-local ------------------------------------------------------------ Traceback (most recent call last): File "/usr/lib/python3.10/site-packages/cloudinit/cmd/main.py", line 653, in status_wrapper ret = functor(name, args) File "/usr/lib/python3.10/site-packages/cloudinit/cmd/main.py", line 261, in main_init logging.setupLogging(init.cfg) File "/usr/lib/python3.10/site-packages/cloudinit/log.py", line 81, in setupLogging elif isinstance(a_cfg, (collections.Iterable)): AttributeError: module 'collections' has no attribute 'Iterable' ------------------------------------------------------------ failed run of stage init ------------------------------------------------------------ Traceback (most recent call last): File "/usr/lib/python3.10/site-packages/cloudinit/cmd/main.py", line 653, in status_wrapper ret = functor(name, args) File "/usr/lib/python3.10/site-packages/cloudinit/cmd/main.py", line 261, in main_init logging.setupLogging(init.cfg) File "/usr/lib/python3.10/site-packages/cloudinit/log.py", line 81, in setupLogging elif isinstance(a_cfg, (collections.Iterable)): AttributeError: module 'collections' has no attribute 'Iterable' ------------------------------------------------------------ failed run of stage modules-config ------------------------------------------------------------ Traceback (most recent call last): File "/usr/lib/python3.10/site-packages/cloudinit/cmd/main.py", line 653, in status_wrapper ret = functor(name, args) File "/usr/lib/python3.10/site-packages/cloudinit/cmd/main.py", line 509, in main_modules logging.setupLogging(mods.cfg) File "/usr/lib/python3.10/site-packages/cloudinit/log.py", line 81, in setupLogging elif isinstance(a_cfg, (collections.Iterable)): AttributeError: module 'collections' has no attribute 'Iterable' ------------------------------------------------------------ failed run of stage modules-final ------------------------------------------------------------ Traceback (most recent call last): File "/usr/lib/python3.10/site-packages/cloudinit/cmd/main.py", line 653, in status_wrapper ret = functor(name, args) File "/usr/lib/python3.10/site-packages/cloudinit/cmd/main.py", line 509, in main_modules logging.setupLogging(mods.cfg) File "/usr/lib/python3.10/site-packages/cloudinit/log.py", line 81, in setupLogging elif isinstance(a_cfg, (collections.Iterable)): AttributeError: module 'collections' has no attribute 'Iterable' ------------------------------------------------------------ Expected results: cloud-init doesn't crash Additional info: