Bug 758697

Summary: Method listTrusts in API org.trusts crashed with syntax error
Product: [Community] Spacewalk Reporter: Pavel Studeník <pstudeni>
Component: APIAssignee: Šimon Lukašík <slukasik>
Status: CLOSED CURRENTRELEASE QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 1.6CC: slukasik
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: 2011-12-22 16:49:47 UTC Type: ---
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: 723481    

Description Pavel Studeník 2011-11-30 13:48:22 UTC
Description of problem:
I create new organizations. I add other organization to the list of trusted organizations for this new organization. When I used method listTrusts from API org.trusts, that method crashed. 

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

How reproducible:
always on postgresql 

Steps to Reproduce:
1. I create organization. In webUI I clicked on admin -> Organizations -> create new organization
2. I add other organization to list of trusted for this organization. In webUI  I clicked on admin -> Organizations -> <name organization> -> trusts -> choose some org -> modify trust
3. I used method org.trusts.listTrusts(sessionKey,orgId) 
  
Actual results:
Traceback (most recent call last):
  File "/mnt/tests/CoreOS/RHN-Satellite/Helper/manage-org.py", line 123, in ?
    for t in client.org.trusts.listTrusts(key, int(ORG)):
  File "/usr/lib64/python2.4/xmlrpclib.py", line 1096, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib64/python2.4/xmlrpclib.py", line 1383, in __request
    verbose=self.__verbose
  File "/usr/lib64/python2.4/xmlrpclib.py", line 1147, in request
    return self._parse_response(h.getfile(), sock)
  File "/usr/lib64/python2.4/xmlrpclib.py", line 1286, in _parse_response
    return u.close()
  File "/usr/lib64/python2.4/xmlrpclib.py", line 744, in close
    raise Fault(**self._stack[0])
xmlrpclib.Fault: <Fault -1: 'redstone.xmlrpc.XmlRpcFault: unhandled internal exception: ERROR: syntax error at or near "trusted"'>


Additional info:
WARNING: redstone.xmlrpc.XmlRpcFault: unhandled internal exception: ERROR: syntax error at or near "trusted"
2011-11-30 08:18:39,852 [TP-Processor1] ERROR com.redhat.rhn.common.db.datasource.CachedStatement - Error while processing cached statement sql: SELECT org.id,
       org.name,
       (SELECT count(*)
            FROM rhnTrustedOrgs tr
            WHERE tr.org_trust_id = org.id AND
                  tr.org_id = ?) trusted
FROM   web_customer org
WHERE  org.id != ?
com.redhat.rhn.common.db.WrappedSQLException: ERROR: syntax error at or near "trusted"
	at com.redhat.rhn.common.translation.SqlExceptionTranslator.postgreSqlException(SqlExceptionTranslator.java:56)
	at com.redhat.rhn.common.translation.SqlExceptionTranslator.sqlException(SqlExceptionTranslator.java:45)
...
cut
...
Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at or near "trusted"
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1525)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1309)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:188)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:354)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:347)
	at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.execute(NewProxyPreparedStatement.java:651)
	at com.redhat.rhn.common.db.NamedPreparedStatement.execute(NamedPreparedStatement.java:138)
	... 50 more
Nov 30, 2011 8:22:44 AM redstone.xmlrpc.XmlRpcDispatcher writeError
WARNING: redstone.xmlrpc.XmlRpcFault: unhandled internal exception: ERROR: syntax error at or near "trusted"

Comment 1 Šimon Lukašík 2011-12-01 07:56:51 UTC
spacewalk.git 17cf0aa87ebc5d2b783846e70dcc36e224f565ba

Comment 2 Milan Zázrivec 2011-12-22 16:49:47 UTC
Spacewalk 1.6 has been released.