Bug 1122438

Summary: Syntax Error in SQL-Statement "subscribe_sql" in "rhnChannel.py"
Product: [Community] Spacewalk Reporter: DaniloE <endesfelder>
Component: ServerAssignee: Milan Zázrivec <mzazrivec>
Status: CLOSED CURRENTRELEASE QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 2.2CC: Dan.Creed, fabiano.martins, johan.tornroos, markus_blesgen, redhat, reseau.locreal, thefiguras
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-04-14 19:04:00 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: 1207293    
Attachments:
Description Flags
syntax error in sql request none

Description DaniloE 2014-07-23 09:13:12 UTC
Description of problem:

There is a Syntax-failure in the SQL-statement _query_parent_channel_subscribed in rhnChannel.py:

select 1
  from rhnChannel c,
       join rhnServerChannel sc on c.parent_channel = sc.channel_id
  where sc.server_id = :sid
    and c.label = :channel

it should be 

select 1
  from rhnChannel c
       join rhnServerChannel sc on c.parent_channel = sc.channel_id
  where sc.server_id = :sid
    and c.label = :channel

The comma is too much. This rises an SQL-Exception.

Version-Release number of selected component (if applicable):

min. 2.2 

How reproducible:

Just one example, how we found the problem, i think, there are more ways to do it.

Steps to Reproduce:
1. try to add a channel via spacewalk-channel -a -c $NAME in a client
2. look in the rhn_server_xmlrpc.log on the server
3. you will see a message like 
"server/apacheRequest.call_function('ERROR', 'rhnSQL.SQLError caught', SQLStatementPrepareError('FEHLER: ... ... "

Actual results:

The client recieves an internal error from the server and nothing happens.

Expected results:

The channel should be added.

Additional info:

nope

Comment 1 Milan Zázrivec 2014-08-05 08:44:51 UTC
spacewalk.git master: 4bf063f97ae66d889236e11ea237dfd785dbce29

Comment 2 Dimitar Yordanov 2014-08-26 12:26:58 UTC
*** Bug 1126877 has been marked as a duplicate of this bug. ***

Comment 3 Johan Tornroos 2014-09-17 11:51:04 UTC
Any progress on this, we also encountered this after upgrade to 2.2.

Comment 4 Dan Creed 2014-11-10 14:38:47 UTC
Come on RedHat.. this bug has been around for almost 4 months... and still no movement... This bug is a major show stopper for the project I am working on.. please give us a workaround or bug fix.

Comment 5 reseau.locreal 2014-11-18 11:19:32 UTC
Created attachment 958521 [details]
syntax error in sql request

Comment 6 reseau.locreal 2014-11-18 11:22:50 UTC
The attachment proposed in comment #5 looks to fix the issue.

Comment 7 Marcin 2015-02-24 16:56:41 UTC
(In reply to Dan Creed from comment #4)
> Come on RedHat.. this bug has been around for almost 4 months... and still
> no movement... This bug is a major show stopper for the project I am working
> on.. please give us a workaround or bug fix.

Dan, I am using workaround with 'spacecmd'

spacecmd {SSM:0}> system_addchildchannels
system_addchildchannels: Add child channels to a system
usage: system_addchildchannels <SYSTEMS> <CHANNEL ...>

Comment 8 Grant Gainey 2015-03-23 16:59:31 UTC
Moving bugs to ON_QA as we move to release Spacewalk 2.3

Comment 9 Grant Gainey 2015-04-14 19:04:00 UTC
Spacewalk 2.3 has been released. See

https://fedorahosted.org/spacewalk/wiki/ReleaseNotes23