Bug 1126877

Summary: subscribeChannels() don't work
Product: [Community] Spacewalk Reporter: Fabiano Martins <fabiano.martins>
Component: APIAssignee: Tomáš Kašpárek <tkasparek>
Status: CLOSED DUPLICATE QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 2.2CC: dyordano, markus_blesgen, redhat
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-08-26 12:26:58 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:
Bug Depends On:    
Bug Blocks: 1484117    
Attachments:
Description Flags
Sample code that reproduces the problem none

Description Fabiano Martins 2014-08-05 13:57:39 UTC
Created attachment 924219 [details]
Sample code that reproduces the problem

Description of problem:
The subscribeChannels() function does not work. This occurs in spacewalk-channel program, and calling also the function directly.

Version-Release number of selected component (if applicable):
- client: rhn-client-tools-2.2.7-1.el6.noarch
- server: spacewalk-backend-xmlrpc-2.2.43-1.el6.noarch

How reproducible:
Always

Steps to Reproduce:
Call "spacewalk-channel -a -c <CHANNEL> -u <USER>", or made a Python program that call subscribeChannels() funcion.
I attached a sample code that reproduces the problem: fill TEST_CHANNEL, TEST_USER and TEST_PASSWORD variables in it.
===========================================================
On my environment, the output of sample code is:
[root@centos6 fabiano]# python test.py 
---------- channel_list()
centos6-x86_64
centos6-x86_64-extras
centos6-x86_64-updates
epel6-centos6-x86_64
spacewalk22-client-centos6-x86_64
---------- channel_del()
vou chamar unsubscribeChannels("['epel6-centos6-x86_64']", "admin", "m1pnmq2ns")
Channel(s): epel6-centos6-x86_64 successfully removed
---------- channel_list()
centos6-x86_64
centos6-x86_64-extras
centos6-x86_64-updates
epel6-centos6-x86_64
spacewalk22-client-centos6-x86_64
---------- channel_add()
Traceback (most recent call last):
  File "test.py", line 65, in <module>
    channel_add(TEST_CHANNEL, TEST_USER, TEST_PASSWORD)
  File "test.py", line 34, in channel_add
    result = subscribeChannels(channels, user, password)
  File "/usr/share/rhn/up2date_client/rhnChannel.py", line 129, in subscribeChannels
    passwd)
  File "/usr/share/rhn/up2date_client/rhnserver.py", line 63, in __call__
    return rpcServer.doCall(method, *args, **kwargs)
  File "/usr/share/rhn/up2date_client/rpcServer.py", line 203, in doCall
    ret = method(*args, **kwargs)
  File "/usr/lib64/python2.6/xmlrpclib.py", line 1199, in __call__
    return self.__send(self.__name, args)
  File "/usr/share/rhn/up2date_client/rpcServer.py", line 37, in _request1
    ret = self._request(methodname, params)
  File "/usr/lib/python2.6/site-packages/rhn/rpclib.py", line 384, in _request
    self._handler, request, verbose=self._verbose)
  File "/usr/lib/python2.6/site-packages/rhn/transports.py", line 170, in request
    headers, fd = req.send_http(host, handler)
  File "/usr/lib/python2.6/site-packages/rhn/transports.py", line 729, in send_http
    response.status, response.reason, response.msg)
up2date_client.up2dateErrors.CommunicationError: Erro ao comunicar com o servidor. A mensagem foi:
Internal Server Error
===========================================================
Looking at /var/log/rhn/rhn_server_xmlrpc.log on server, the output is:
2014/08/05 10:28:51 -02:00 20803 10.4.251.49: xmlrpc/up2date.listChannels(1000010008,)
2014/08/05 10:28:52 -02:00 20805 10.4.251.49: xmlrpc/up2date.unsubscribeChannels(1000010008, ['epel6-centos6-x86_64'])
2014/08/05 10:28:52 -02:00 10029 10.4.251.49: xmlrpc/up2date.subscribeChannels(1000010008, ['epel6-centos6-x86_64'])
2014/08/05 10:28:52 -02:00 10029 10.4.251.49: server/apacheRequest.call_function('ERROR', 'rhnSQL.SQLError caught', SQLStatementPrepareError('ERROR:  syntax error at or near "rhnServerChannel"\nLINE 4:        join rhnServerChannel sc on c.parent_channel = sc.cha...\n                    ^\n', <connection object at 0x7f5939b119f0; dsn: 'password=xxxxx dbname=rhnschema user=rhnuser', closed: 0>, '\nselect 1\n  from rhnChannel c,\n       join rhnServerChannel sc on c.parent_channel = sc.channel_id\n  where sc.server_id = %(sid)s\n    and c.label = %(channel)s\n'))
===========================================================

Actual results:
Exception when I try add a valid channel.

Expected results:
Success on add the channel.


Additional info:
Making the same action on Web UI works fine.

Comment 1 redhat 2014-08-12 09:36:36 UTC
I have the same problem and a almost identical setup. The only difference are the client-tools are rhn-client-tools-2.2.7-5.1 for SUSE SLE 11 SP3.

Comment 2 markus_blesgen 2014-08-18 09:00:19 UTC
same problem here, also with a identical setup.

Spacewalk-Server and Client are running under Centos 6.5 with actual updates.

Spacewalk-Client:
# rhn-channel -c centos-6-extras-x86_64 -a --user $usr --password $pw
Error communicating with server. The message was:
Internal Server Error

Spacewalk-Server:
/var/log/rhn/rhn_server_xmlrpc.log

2014/08/18 10:45:33 +02:00 25818 172.25.52.14: xmlrpc/up2date.subscribeChannels(1000010035, ['centos-6-extras-x86_64'])
2014/08/18 10:45:34 +02:00 25818 172.25.52.14: server/apacheRequest.call_function('ERROR', 'rhnSQL.SQLError caught', SQLStatementPrepareError('ERROR:  syntax error at or near "rhnServerChannel"\nLINE 4:        join rhnServerChannel sc on c.parent_channel = sc.cha...\n                    ^\n', <connection object at 0x7fe2fa9739f0; dsn: 'password=xxxxxx dbname=spaceschema user=spaceuser', closed: 0>, '\nselect 1\n  from rhnChannel c,\n       join rhnServerChannel sc on c.parent_channel = sc.channel_id\n  where sc.server_id = %(sid)s\n    and c.label = %(channel)s\n'))


Packages installed on the Client:

spacewalk-client-repo-2.2-1.el6.noarch
rhn-client-tools-2.2.7-1.el6.noarch
yum-rhn-plugin-2.2.7-1.el6.noarch
rhn-check-2.2.7-1.el6.noarch
rhn-setup-2.2.7-1.el6.noarch
rhnlib-2.5.65-1.el6.noarch
rhnsd-5.0.14-1.el6.x86_64

Comment 3 Dimitar Yordanov 2014-08-26 12:26:58 UTC

*** This bug has been marked as a duplicate of bug 1122438 ***

Comment 4 Eric Herget 2017-09-28 18:12:05 UTC
This BZ closed some time during 2.5, 2.6 or 2.7.  Adding to 2.7 tracking bug.