Created attachment 611948 [details] Python Script to Collect Channel Information Description of problem: Using a python script to make a call to namespace=channel.software, method=listChannelRepos, passing in my sessionKey and Channel Label. I expected to have returned: array: struct - channel int "id" string "label" string "sourceUrl" string "type" Instead a text representation Version-Release number of selected component (if applicable): RHN Satellite 5.4.1 spacewalk-java-1.2.39-126.el6sat.src.rpm How reproducible: 100% Steps to Reproduce: 1. Call channel.software.listChannelRepos(sessionKey, 'ese-custom-6') 2. Print returned object 3. Actual results: [{'value': 'com.redhat.rhn.domain.channel.ContentSource@75d175d1[id=500,org=com.redhat.rhn.domain.org.Org@18451845[id=1,name=US Department of Veterans Affairs],type=com.redhat.rhn.domain.channel.ContentSourceType@45e045e[id=500,label=yum,created=2012-04-30,modified=2012-04-30],sourceUrl=http://vhaetnmon33.vha.med.va.gov/repos/ese-custom/,label=ESE Custom RPMs,channels=[com.redhat.rhn.domain.channel.Channel@392f392f[id=142,label=ese-custom-6], com.redhat.rhn.domain.channel.Channel@7c637c63[id=161,label=ese-custom-5]],created=2012-05-08 13:24:53.0,modified=2012-05-08 13:24:53.0]'}, {'value': 'com.redhat.rhn.domain.channel.ContentSource@76f676f6[id=501,org=com.redhat.rhn.domain.org.Org@18451845[id=1,name=US Department of Veterans Affairs],type=com.redhat.rhn.domain.channel.ContentSourceType@45e045e[id=500,label=yum,created=2012-04-30,modified=2012-04-30],sourceUrl=http://vhaetnmon33.vha.med.va.gov/repos/ese-third-party/,label=ESE Third Party RPMs,channels=[com.redhat.rhn.domain.channel.Channel@392f392f[id=142,label=ese-custom-6], com.redhat.rhn.domain.channel.Channel@7c637c63[id=161,label=ese-custom-5]],created=2012-05-08 14:16:47.0,modified=2012-05-08 14:16:47.0]'}, {'value': 'com.redhat.rhn.domain.channel.ContentSource@77ca77ca[id=502,org=com.redhat.rhn.domain.org.Org@18451845[id=1,name=US Department of Veterans Affairs],type=com.redhat.rhn.domain.channel.ContentSourceType@45e045e[id=500,label=yum,created=2012-04-30,modified=2012-04-30],sourceUrl=http://vhaetnmon33.vha.med.va.gov/repos/ese-v2s/,label=ESE V2S RPMs,channels=[com.redhat.rhn.domain.channel.Channel@392f392f[id=142,label=ese-custom-6], com.redhat.rhn.domain.channel.Channel@7c637c63[id=161,label=ese-custom-5]],created=2012-05-08 14:17:35.0,modified=2012-05-08 14:17:35.0]'}] Expected results: [{'sourceUrl': 'http://vhaetnmon33.vha.med.va.gov/repos/ese-custom/', 'type': 'yum', 'id': 500, 'label': 'ESE Custom RPMs'}, {'sourceUrl': 'http://vhaetnmon33.vha.med.va.gov/repos/ese-third-party/', 'type': 'yum', 'id': 501, 'label': 'ESE Third Party RPMs'}, {'sourceUrl': 'http://vhaetnmon33.vha.med.va.gov/repos/ese-v2s/', 'type': 'yum', 'id': 502, 'label': 'ESE V2S RPMs'}] Additional info: Possible patch for spacewalk-java-1.2.39-126.el6sat.src.rpm: diff --git a/code/src/com/redhat/rhn/frontend/xmlrpc/channel/software/ChannelSoftwareHandler.java b/code/src/com/redhat/rhn/frontend/xmlrpc/channel/software/ChannelSoftwareHandler.java index 2d29a28..a725dd8 100644 --- a/code/src/com/redhat/rhn/frontend/xmlrpc/channel/software/ChannelSoftwareHandler.java +++ b/code/src/com/redhat/rhn/frontend/xmlrpc/channel/software/ChannelSoftwareHandler.java @@ -2384,10 +2384,22 @@ public class ChannelSoftwareHandler extends BaseHandler { * $ContentSourceSerializer * #array_end() */ - public List<ContentSource> listChannelRepos(String sessionKey, String channelLabel) { - User loggedInUser = getLoggedInUser(sessionKey); - Channel channel = lookupChannelByLabel(loggedInUser, channelLabel); - return ChannelFactory.lookupContentSources(loggedInUser.getOrg(), channel); + public List listChannelRepos(String sessionKey, String channelLabel) { + User user = getLoggedInUser(sessionKey); + Channel channel = lookupChannelByLabel(user, channelLabel); + List<ContentSource> result = ChannelFactory.lookupContentSources(user.getOrg(), channel); + + List list = new ArrayList(); + for (Iterator itr = result.iterator(); itr.hasNext();) { + ContentSource cs = (ContentSource) itr.next(); + Map map = new HashMap(); + map.put("id", cs.getId()); + map.put("label", cs.getLabel()); + map.put("sourceUrl", cs.getSourceUrl()); + map.put("type", cs.getType().getLabel()); + list.add(map); + } + return list; } /** I have tested the patch with positive results.
When I discovered other calls that should return Repository Informaion had similar issues, I investigated further and discovered the ContentSourceSerializer was not registered. I backed out my previous patch and applied the following patch to correct the issue in multiple calls: diff --git a/code/src/com/redhat/rhn/frontend/xmlrpc/serializer/SerializerRegistry.java b/code/src/com/redhat/rhn/frontend/xmlrpc/serializer/SerializerRegistry.java index c701ac2..1dd51c3 100644 --- a/code/src/com/redhat/rhn/frontend/xmlrpc/serializer/SerializerRegistry.java +++ b/code/src/com/redhat/rhn/frontend/xmlrpc/serializer/SerializerRegistry.java @@ -44,6 +44,7 @@ public class SerializerRegistry { SERIALIZER_CLASSES.add(ChannelArchSerializer.class); SERIALIZER_CLASSES.add(ChannelOverviewSerializer.class); SERIALIZER_CLASSES.add(ChannelSerializer.class); + SERIALIZER_CLASSES.add(ContentSourceSerializer.class); SERIALIZER_CLASSES.add(CpuSerializer.class); SERIALIZER_CLASSES.add(DeviceSerializer.class); SERIALIZER_CLASSES.add(DmiSerializer.class);
Patch in Comment#1 is correct. However, we have this patch in Spacewalk since Tue Aug 28 2012. spacewalk.git: ad74aa7f79a9730ae7b67cce88cf152fffc839e6 Thank you.
Moving ON_QA. Packages that address this bugzilla should now be available in yum repos at http://yum.spacewalkproject.org/nightly/
Spacewalk 1.8 has been released: https://fedorahosted.org/spacewalk/wiki/ReleaseNotes18