Description of problem: If you have a system with installed redhat-access-insights package, but NOT registered to Insights, Satellite Insights WebUI is unable to schedule package removal. Version-Release number of selected component (if applicable): redhat-access-plugin-sat5-2.1.0-54.el6sat How reproducible: always Steps to Reproduce: 1. Install the redhat-access-insights package to a system registered to Satellite server. DO NOT register the system to Insights after installation 2. Check the Systems->Insights->Setup page. System will be checked as ready to use insights, and there will be a green checkmark in "RPM Status" column. System will be marked as "not registered" in the "Last Check In" column. 3. Uncheck the system. According to the text on the page: "Deselecting a system with the RPM already installed will unregister the system from Red Hat Insights and schedule the RPM to be uninstalled." 4. Apply the changes. Actual results: There is a message "Applying changes..." followed by "Loading statuses...". When finished, the page will return to the same state as before - system which was just unchecked is checked again, redhat-access-insights package is not removed. There is following traceback in /var/log/rhn/rhai.log: 2017-02-07 08:30:32,580 524029999 [TP-Processor3] ERROR c.r.t.i.sat5.rest.ConfigService - Exception in POST /config/systems org.jboss.resteasy.spi.NotFoundException: Machine ID not found. Verify the system has been registered with 'redhat-access-insights --register' at com.redhat.telemetry.integration.sat5.portal.InsightsApiUtils.leafIdToMachineId(InsightsApiUtils.java:57) ~[InsightsApiUtils.class:na] at com.redhat.telemetry.integration.sat5.satellite.SatelliteSystem.unregister(SatelliteSystem.java:157) ~[SatelliteSystem.class:na] at com.redhat.telemetry.integration.sat5.rest.ConfigService.postSystems(ConfigService.java:204) ~[ConfigService.class:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95) ~[na:1.8.0] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55) ~[na:1.8.0] at java.lang.reflect.Method.invoke(Method.java:508) ~[na:2.6 (10-13-2016)] at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167) [resteasy-jaxrs-2.3.7.Final.jar:na] at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:269) [resteasy-jaxrs-2.3.7.Final.jar:na] at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:227) [resteasy-jaxrs-2.3.7.Final.jar:na] at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:216) [resteasy-jaxrs-2.3.7.Final.jar:na] at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542) [resteasy-jaxrs-2.3.7.Final.jar:na] at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524) [resteasy-jaxrs-2.3.7.Final.jar:na] at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126) [resteasy-jaxrs-2.3.7.Final.jar:na] at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208) [resteasy-jaxrs-2.3.7.Final.jar:na] at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) [resteasy-jaxrs-2.3.7.Final.jar:na] at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) [resteasy-jaxrs-2.3.7.Final.jar:na] at javax.servlet.http.HttpServlet.service(HttpServlet.java:723) [tomcat6-servlet-2.5-api-6.0.24.jar:na] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) [catalina-6.0.24.jar:na] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina-6.0.24.jar:na] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) [catalina-6.0.24.jar:na] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) [catalina-6.0.24.jar:na] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) [catalina-6.0.24.jar:na] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [catalina-6.0.24.jar:na] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [catalina-6.0.24.jar:na] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:299) [catalina-6.0.24.jar:na] at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190) [tomcat-coyote-6.0.24.jar:na] at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291) [tomcat-coyote-6.0.24.jar:na] at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:769) [tomcat-coyote-6.0.24.jar:na] at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:698) [tomcat-coyote-6.0.24.jar:na] at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:891) [tomcat-coyote-6.0.24.jar:na] at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690) [tomcat-coyote-6.0.24.jar:na] at java.lang.Thread.run(Thread.java:785) [na:1.8.0] Expected results: System is unchecked on subsequent load, redhat-access-insights package is removed. The traceback is probably necessary, as there really isn't a system with the given ID registered to Insights, and that's a genuine error. redhat-access-insights package should be removed, though.
Verified on redhat-access-plugin-sat5-2.1.0-56.el6sat. Tested using the reproducer from the original report. Systems->Insights->Setup correctly displayed systems with redhat-access-insights package installed as checked, and systems without the redhat-access-insights as unchecked. When scheduling package removal for a system not registered to Insights (uncheck and Update), the removal is correctly scheduled as an satellite scheduled action. No tracebacks in the /var/log/rhn/rhai.log, only a debug message: 2017-04-25 07:31:56,761 77917803 [TP-Processor11] DEBUG c.r.t.i.sat5.rest.ConfigService - System not found in Portal inventory, assuming it was never registered... 2017-04-25 07:31:56,811 77917853 [TP-Processor11] DEBUG c.r.t.i.sat5.rest.ConfigService - Uninstall action id for system (1000010001): 11 Both installation and removal (registered and unregistered) is performed without any problems. VERIFIED