Bug 1379296

Summary: Registration of Debian client failed during step setting entitlement
Product: [Community] Spacewalk Reporter: Pavel Studeník <pstudeni>
Component: ServerAssignee: Tomáš Kašpárek <tkasparek>
Status: CLOSED EOL QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 2.5CC: mmraka
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-03-06 13:42:21 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:

Description Pavel Studeník 2016-09-26 10:19:04 UTC
Description of problem:
I try to register client with Debian OS to Spacewalk and I received error:

"Service not enabled for system profile: <profile name>"

Profile is created in spacewalk and I can see it in webUI, but "Base Entitlement" can't be set and profile is not possible to manage. 

Version-Release number of selected component (if applicable):
spacewalk-backend-server-2.6.53-1.fc24.noarch

How reproducible:
always

Steps to Reproduce:
1. create channel and distribution mapping for Debian in Spacewalk
2. try to register system with Debian to Spacewalk
3. got to /rhn/systems/details/Edit.do?sid=<system_id> and try to set "Base Entitlement" to Management

Actual results:
registration failed during setting entitlement

Expected results:
it is possible to register Debian to Spacewalk

Additional info:
>> /var/log/tomcat/*.log
26-Sep-2016 06:04:20.631 SEVERE [ajp-nio-0:0:0:0:0:0:0:1-8009-exec-4] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [action] in context with path [/rhn] threw exception [com.redhat.rhn.common.db.WrappedSQLException: ERROR: -20287 : (invalid_entitlement) - The server can not be entitled to the specified level
  Where: SQL statement "SELECT rhn_exception.raise_exception ('invalid_entitlement')"
PL/pgSQL function rhn_entitlements.entitle_server(numeric,character varying) line 26 at PERFORM] with root cause
 org.postgresql.util.PSQLException: ERROR: -20287 : (invalid_entitlement) - The server can not be entitled to the specified level
  Where: SQL statement "SELECT rhn_exception.raise_exception ('invalid_entitlement')"
PL/pgSQL function rhn_entitlements.entitle_server(numeric,character varying) line 26 at PERFORM
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2198)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1927)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:565)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:420)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:413)
	at com.mchange.v2.c3p0.impl.NewProxyCallableStatement.execute(NewProxyCallableStatement.java:4441)
	at com.redhat.rhn.common.db.NamedPreparedStatement.execute(NamedPreparedStatement.java:117)
	at com.redhat.rhn.common.db.datasource.CachedStatement.executeCallable(CachedStatement.java:528)
	at com.redhat.rhn.common.db.datasource.CallableMode.execute(CallableMode.java:35)
	at com.redhat.rhn.manager.system.SystemManager.entitleServer(SystemManager.java:1678)
	at com.redhat.rhn.manager.system.SystemManager.entitleServer(SystemManager.java:1632)
	at com.redhat.rhn.domain.server.Server.setBaseEntitlement(Server.java:1368)
	at com.redhat.rhn.frontend.action.systems.sdc.SystemDetailsEditAction.processSubmission(SystemDetailsEditAction.java:143)
	at com.redhat.rhn.frontend.action.systems.sdc.SystemDetailsEditAction.execute(SystemDetailsEditAction.java:97)
	at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425)
	at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:229)
	at com.redhat.rhn.frontend.struts.RhnRequestProcessor.process(RhnRequestProcessor.java:105)
	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1926)
	at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:464)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
	at com.redhat.rhn.frontend.servlets.AuthFilter.doFilter(AuthFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
	at com.opensymphony.sitemesh.webapp.SiteMeshFilter.obtainContent(SiteMeshFilter.java:129)
	at com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:77)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
	at com.redhat.rhn.frontend.servlets.LocalizedEnvironmentFilter.doFilter(LocalizedEnvironmentFilter.java:67)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
	at com.redhat.rhn.frontend.servlets.EnvironmentFilter.doFilter(EnvironmentFilter.java:101)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
	at com.redhat.rhn.frontend.servlets.SessionFilter.doFilter(SessionFilter.java:57)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
	at com.redhat.rhn.frontend.servlets.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:97)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528)
	at org.apache.coyote.ajp.AbstractAjpProcessor.process(AbstractAjpProcessor.java:873)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:670)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:745)

Comment 2 Ales Dujicek 2016-11-15 14:54:55 UTC
now we cannot register debian to spacewalk:

# rhnreg_ks --username=<user> --password=<password> --force --serverUrl=https://spacewalk/XMLRPC
An error has occurred:

Error Message:
    Service not enabled for system profile: "deb"
Error Class Code: 31
Error Class Info: 
     This system does not have a valid entitlement for Red Hat Satellite.
     Please visit https://test03-64.sysmgmt.lab.eng.rdu2.redhat.com/rhn/systems/SystemEntitlements.do
     or login at https://test03-64.sysmgmt.lab.eng.rdu2.redhat.com, and from the "Overview" tab,
     select "Subscription Management" to enable the service for this system.
Explanation:
    Your organization does not have enough Management entitlements to register this
    system to Red Hat Network. Please notify your organization administrator of this error. 
    You should be able to register this system after your organization frees existing 
    or purchases additional entitlements. Additional entitlements may be purchased by your
    organization administrator by logging into Red Hat Network and visiting
    the 'Subscription Management' page in the 'Your RHN' section of RHN.
    
    A common cause of this error code is due to having mistakenly setup an
    Activation Key which is set as the universal default.  If an activation key is set
    on the account as a universal default, you can disable this key and retry to avoid
    requiring a Management entitlement.
See /var/log/up2date for more information


/var/log/up2date
[Tue Nov 15 14:44:07 2016] up2date
Traceback (most recent call last):
  File "/usr/sbin/rhn_check", line 425, in <module>
    cli.run()
  File "/usr/share/rhn/up2date_client/rhncli.py", line 96, in run
    sys.exit(self.main() or 0)
  File "/usr/sbin/rhn_check", line 86, in main
    self.__run_remote_actions()
  File "/usr/sbin/rhn_check", line 187, in __run_remote_actions
    action = self.__get_action(status_report)
  File "/usr/sbin/rhn_check", line 105, in __get_action
    ACTION_VERSION, status_report)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1233, in __call__
    return self.__send(self.__name, args)
  File "/usr/share/rhn/up2date_client/rpcServer.py", line 38, in _request1
    ret = self._request(methodname, params)
  File "/usr/lib/python2.7/dist-packages/rhn/rpclib.py", line 381, in _request
    self._handler, request, verbose=self._verbose)
  File "/usr/lib/python2.7/dist-packages/rhn/transports.py", line 167, in request
    headers, fd = req.send_http(host, handler)
  File "/usr/lib/python2.7/dist-packages/rhn/transports.py", line 698, in send_http
    self._connection.connect()
  File "/usr/lib/python2.7/dist-packages/rhn/connections.py", line 183, in connect
    self.sock.init_ssl()
  File "/usr/lib/python2.7/dist-packages/rhn/SSL.py", line 90, in init_ssl
    self._ctx.load_verify_locations(f)
  File "/usr/lib/python2.7/dist-packages/OpenSSL/SSL.py", line 303, in load_verify_locations
    raise TypeError("cafile must be None or a byte string")
<type 'exceptions.TypeError'>: cafile must be None or a byte string


which can be workarounded:

--- rpcServer.py	2016-11-15 13:03:38.852000000 +0000
+++ /usr/share/rhn/up2date_client/rpcServer.py	2016-11-15 14:25:45.260000000 +0000
@@ -171,7 +171,7 @@
                 raise up2dateErrors.SSLCertificateFileNotFound(msg)
 
             # force the validation of the SSL cert
-            s.add_trusted_cert(rhns_ca_cert)
+            s.add_trusted_cert(str(rhns_ca_cert))
 
     clientCaps.loadLocalCaps()

Comment 3 Pavel Studeník 2017-07-26 14:33:00 UTC
Currently I can see this error during registration (set entitlement management)

>> tail /var/log/tomcat/*.log -f

26-Jul-2017 16:27:28.802 SEVERE [ajp-nio-0:0:0:0:0:0:0:1-8009-exec-3] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [action] in context with path [/rhn] threw exception [com.redhat.rhn.common.db.WrappedSQLException: ORA-20287: (invalid_entitlement) - The server can not be entitled to the specified level
ORA-06512: at "SPACEUSER.RHN_EXCEPTION", line 31
ORA-06512: at "SPACEUSER.RHN_ENTITLEMENTS", line 199
ORA-06512: at line 1
] with root cause
 java.sql.SQLException: ORA-20287: (invalid_entitlement) - The server can not be entitled to the specified level
ORA-06512: at "SPACEUSER.RHN_EXCEPTION", line 31
ORA-06512: at "SPACEUSER.RHN_ENTITLEMENTS", line 199
ORA-06512: at line 1

	at oracle.jdbc.driver.T2CConnection.checkError(T2CConnection.java:777)
	at oracle.jdbc.driver.T2CConnection.checkError(T2CConnection.java:673)
...
	at com.redhat.rhn.common.db.NamedPreparedStatement.execute(NamedPreparedStatement.java:117)
	at com.redhat.rhn.common.db.datasource.CachedStatement.executeCallable(CachedStatement.java:474)
	at com.redhat.rhn.common.db.datasource.CallableMode.execute(CallableMode.java:39)

Comment 4 Michael Mráka 2020-03-06 13:42:21 UTC
Spacewalk 2.8 (and older) has already reached it's End Of Life.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before end of life. If you would still like
to see this bug fixed and are able to reproduce it against current version
of Spacewalk 2.9, you are encouraged change the 'version' and re-open it.