[Spacewalk-list] spacewalk 1.4-RC cElementTree problem with spacewalk-repo-sync

Martin Zehetmayer martin at zehetmayer.at
Wed Apr 13 13:12:15 UTC 2011


Hi,

for I am new on this list let me introduce myself: 
My name is Martin Zehetmayer, I work for as consultant for a small linux solution provider in germany, mostly dealing with RHEL systems. 

I am currently testing spacewalk 1.4-RC6 on a RHEL6.0 x86_64 system. Installing works very fine but when
adding packages to a custom channel I get the following error: 

---
[root at spacewalk ]# spacewalk-repo-sync -u http://10.160.14.83/cobbler/ks_mirror/testrepo -c testchannel1-x86_64 -t yum
Traceback (most recent call last):
  File "/usr/bin/spacewalk-repo-sync", line 69, in <module>
    sys.exit(abs(main() or 0))
  File "/usr/bin/spacewalk-repo-sync", line 63, in main
    sync.main()
  File "/usr/lib/python2.6/site-packages/spacewalk/satellite_tools/reposync.py", line 108, in main
    plugin = self.load_plugin()(url, self.channel_label)
  File "/usr/lib/python2.6/site-packages/spacewalk/satellite_tools/reposync.py", line 137, in load_plugin
    mod = __import__('spacewalk.satellite_tools.repo_plugins', globals(), locals(), [name])
  File "/usr/lib/python2.6/site-packages/spacewalk/satellite_tools/repo_plugins/yum_src.py", line 25, in <module>
    import cElementTree
ImportError: No module named cElementTree
---

After searching I found a post in this list from Michael Calmer which reports the same error under SLES. As mentioned above I tested it under RHEL6 and the same problem appear. It can be solved using three tests as suggested from Michael. 

Here is a diff of my changed yum_src.py:


--- snip ---

--- /usr/lib/python2.6/site-packages/spacewalk/satellite_tools/repo_plugins/yum_src.py.old      2011-04-13 17:03:44.611896473 +0200
+++ /usr/lib/python2.6/site-packages/spacewalk/satellite_tools/repo_plugins/yum_src.py  2011-04-13 17:03:35.378881722 +0200
@@ -19,11 +19,17 @@
 import gzip
 from yum.update_md import UpdateMetadata, UpdateNoticeException, UpdateNotice
 from yum.yumRepo import YumRepository
+
 try:
     from yum.misc import cElementTree_iterparse as iterparse
 except ImportError:
-    import cElementTree
-    iterparse = cElementTree.iterparse
+    try:
+        from xml.etree import cElementTree
+    except ImportError:
+        import cElementTree
+        iterparse = cElementTree.iterparse
+
+

-- snap --- 

For I do not know how to reference the thread this problem was originally posted in I open an new one. 

best regards, 

  Martin 




More information about the Spacewalk-list mailing list