Repository: ansible/ansible-modules-core

Issue:
rhn_channel is using depreciated methods
Issue Type:
Bug Report

Ansible Version: 
1.7.2

Environment: 
OS X 10.9 / RHEL 6/7

Summary:
When adding a child channel to rhn sat server rhn_channel fails with 500 error. 

Steps To Reproduce:
attempt to subscribe to a child channel with rhn_channel to sat server 5.4+

Expected Results:
Server gets subscribed to child channel.

Actual Results:
xmlrpclib.ProtocolError: <ProtocolError for redhat.example.com/rpc/api: 500 Internal Server Error>

channel.software.setSystemChannels is depreciated. 
https://access.redhat.com/documentation/en-US/Red_Hat_Network_Satellite/5.5/html/API_Overview/files/html/handlers/ChannelSoftwareHandler.html#setSystemChannels

PR to follow



Discussion:
# Can You Help Us Out?

Thanks for filing a ticket! I am the friendly GitHub Ansibot. 

It looks like you might not have filled out the issue description based on our standard issue template.  You might not have known about that, and that's ok too, we'll tell you how to do it.

We have a standard template because Ansible is a really busy project and it helps to have some standard information in each ticket, and GitHub doesn't yet provide a standard facility to do this like some other bug trackers.  We hope you understand as this is really valuable to us!. 

Solving this is simple: please copy the contents of this [template](https://raw.githubusercontent.com/ansible/ansible/devel/ISSUE_TEMPLATE.md) and **paste it into the description** of your ticket.  That's it!

# If You Had A Question To Ask Instead

If you happened to have a "how do I do this in Ansible" type of question, that's probably more of a user-list question than a bug report, and you should probably ask this question on the project mailing list instead.  

However, if you think you have a bug, the report is the way to go!  We definitely want all the bugs filed :)  Just trying to help!

# About Priority Tags

Since you're here, we'll also share some useful information at this time.

In general tickets will be assigned a priority between P1 (highest) and P5, and then worked in priority order. We may also have some follow up questions along the way, so keeping up with follow up comments via GitHub notifications is a good idea.

Due to large interest in Ansible, humans may not comment on your ticket immediately.  

# Mailing Lists

If you have concerns or questions, you're welcome to stop by the ansible-project or ansible-development mailing lists, as appropriate.  Here are the links:
- https://groups.google.com/forum/#!forum/ansible-project - for discussion of bugs and how-to type questions
- https://groups.google.com/forum/#!forum/ansible-devel - for discussion on how to implement a code change, or feature brainstorming among developers

Thanks again for the interest in Ansible!


Resolving patch:
diff --git a/packaging/os/rhn_channel.py b/packaging/os/rhn_channel.py
--- a/packaging/os/rhn_channel.py
+++ b/packaging/os/rhn_channel.py
@@ -90,17 +90,17 @@ def get_systemid(client, session, sysname):
 
 # ------------------------------------------------------- #
 
-def subscribe_channels(channels, client, session, sysname, sys_id):
-    c = base_channels(client, session, sys_id)
-    c.append(channels)
-    return client.channel.software.setSystemChannels(session, sys_id, c)
+def subscribe_channels(channelname, client, session, sysname, sys_id):
+    channels = base_channels(client, session, sys_id)
+    channels.append(channelname)
+    return client.system.setChildChannels(session, sys_id, channels)
 
 # ------------------------------------------------------- #
 
-def unsubscribe_channels(channels, client, session, sysname, sys_id):
-    c = base_channels(client, session, sys_id)
-    c.remove(channels)
-    return client.channel.software.setSystemChannels(session, sys_id, c)
+def unsubscribe_channels(channelname, client, session, sysname, sys_id):
+    channels = base_channels(client, session, sys_id)
+    channels.remove(channelname)
+    return client.system.setChildChannels(session, sys_id, channels)
 
 # ------------------------------------------------------- #
 
@@ -167,3 +167,4 @@ def main():
 # import module snippets
 from ansible.module_utils.basic import *
 main()
+


Test patch: