Bug 684941 - Deleting a product with a subscription gives ugly error
Summary: Deleting a product with a subscription gives ugly error
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Candlepin
Classification: Community
Component: candlepin
Version: 0.5
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: ---
Assignee: William Poteat
QA Contact: John Sefler
URL:
Whiteboard:
Depends On:
Blocks: rhsm-rhel62
TreeView+ depends on / blocked
 
Reported: 2011-03-14 20:39 UTC by Justin Sherrill
Modified: 2015-05-14 15:22 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-05-30 13:13:46 UTC
Embargoed:


Attachments (Terms of Use)

Description Justin Sherrill 2011-03-14 20:39:52 UTC
Description of problem:

When trying to delete a product with an attached subscription, i'm not given any indication as to why it fails, just an internal server error.  So from the client side, i can't figure out why it's failing.

Here's the candlepin traceback:




Mar 14 16:19:34 [http-8443-1] WARN  org.hibernate.util.JDBCExceptionReporter - SQL Error: 0, SQLState: 23503
Mar 14 16:19:34 [http-8443-1] ERROR org.hibernate.util.JDBCExceptionReporter - Batch entry 0 delete from cp_product where id='Foo7' was aborted.  Call getNextException to see the cause.
Mar 14 16:19:34 [http-8443-1] WARN  org.hibernate.util.JDBCExceptionReporter - SQL Error: 0, SQLState: 23503
Mar 14 16:19:34 [http-8443-1] ERROR org.hibernate.util.JDBCExceptionReporter - ERROR: update or delete on table "cp_product" violates foreign key constraint "fk_subscription_product" on table "cp_subscription"
  Detail: Key (id)=(Foo7) is still referenced from table "cp_subscription".
Mar 14 16:19:34 [http-8443-1] ERROR org.hibernate.event.def.AbstractFlushingEventListener - Could not synchronize database state with session
org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
	at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:94)
	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
	at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)
	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266)
	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:172)
	at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
	at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
	at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1028)
	at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:366)
	at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:137)
	at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:54)
	at com.wideplay.warp.persist.jpa.JpaLocalTxnInterceptor.invoke(JpaLocalTxnInterceptor.java:88)
	at com.google.inject.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:64)
	at com.google.inject.InterceptorStackCallback.intercept(InterceptorStackCallback.java:44)
	at org.fedoraproject.candlepin.model.ProductCurator$$EnhancerByGuice$$c8f19171.delete(<generated>)
	at org.fedoraproject.candlepin.service.impl.DefaultProductServiceAdapter.deleteProduct(DefaultProductServiceAdapter.java:93)
	at org.fedoraproject.candlepin.resource.ProductResource.deleteProduct(ProductResource.java:158)
	at org.fedoraproject.candlepin.resource.ProductResource$$EnhancerByGuice$$5598bde1.CGLIB$deleteProduct$3(<generated>)
	at org.fedoraproject.candlepin.resource.ProductResource$$EnhancerByGuice$$5598bde1$$FastClassByGuice$$33ab40f4.invoke(<generated>)
	at com.google.inject.internal.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
	at com.google.inject.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:64)
	at org.fedoraproject.candlepin.auth.interceptor.SecurityInterceptor.invoke(SecurityInterceptor.java:91)
	at com.google.inject.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:64)
	at com.google.inject.InterceptorStackCallback.intercept(InterceptorStackCallback.java:44)
	at org.fedoraproject.candlepin.resource.ProductResource$$EnhancerByGuice$$5598bde1.deleteProduct(<generated>)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:140)
	at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:248)
	at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:216)
	at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:205)
	at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:489)
	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:466)
	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:120)
	at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:200)
	at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:48)
	at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:43)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:216)
	at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:141)
	at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:93)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:63)
	at org.fedoraproject.candlepin.servlet.filter.logging.LoggingFilter.doFilter(LoggingFilter.java:60)
	at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:129)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:59)
	at com.wideplay.warp.persist.PersistenceFilter$3.run(PersistenceFilter.java:141)
	at com.wideplay.warp.persist.internal.Lifecycles.failEarlyAndLeaveNoOneBehind(Lifecycles.java:29)
	at com.wideplay.warp.persist.PersistenceFilter.doFilter(PersistenceFilter.java:155)
	at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:129)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:59)
	at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:122)
	at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:110)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
	at java.lang.Thread.run(Thread.java:636)
Caused by: java.sql.BatchUpdateException: Batch entry 0 delete from cp_product where id='Foo7' was aborted.  Call getNextException to see the cause.
	at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2569)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1796)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:407)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:2708)
	at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)
	at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)
	... 63 more
Mar 14 16:19:34 [http-8443-1] ERROR org.fedoraproject.candlepin.exceptions.CandlepinExceptionMapper - Runtime exception:
org.jboss.resteasy.spi.ApplicationException: javax.persistence.RollbackException: Error while commiting the transaction
	at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:154)
	at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:248)
	at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:216)
	at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:205)
	at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:489)
	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:466)
	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:120)
	at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:200)
	at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:48)
	at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:43)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:216)
	at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:141)
	at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:93)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:63)
	at org.fedoraproject.candlepin.servlet.filter.logging.LoggingFilter.doFilter(LoggingFilter.java:60)
	at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:129)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:59)
	at com.wideplay.warp.persist.PersistenceFilter$3.run(PersistenceFilter.java:141)
	at com.wideplay.warp.persist.internal.Lifecycles.failEarlyAndLeaveNoOneBehind(Lifecycles.java:29)
	at com.wideplay.warp.persist.PersistenceFilter.doFilter(PersistenceFilter.java:155)
	at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:129)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:59)
	at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:122)
	at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:110)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
	at java.lang.Thread.run(Thread.java:636)
Caused by: javax.persistence.RollbackException: Error while commiting the transaction
	at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:71)
	at com.wideplay.warp.persist.jpa.JpaLocalTxnInterceptor.invoke(JpaLocalTxnInterceptor.java:88)
	at com.google.inject.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:64)
	at com.google.inject.InterceptorStackCallback.intercept(InterceptorStackCallback.java:44)
	at org.fedoraproject.candlepin.model.ProductCurator$$EnhancerByGuice$$c8f19171.delete(<generated>)
	at org.fedoraproject.candlepin.service.impl.DefaultProductServiceAdapter.deleteProduct(DefaultProductServiceAdapter.java:93)
	at org.fedoraproject.candlepin.resource.ProductResource.deleteProduct(ProductResource.java:158)
	at org.fedoraproject.candlepin.resource.ProductResource$$EnhancerByGuice$$5598bde1.CGLIB$deleteProduct$3(<generated>)
	at org.fedoraproject.candlepin.resource.ProductResource$$EnhancerByGuice$$5598bde1$$FastClassByGuice$$33ab40f4.invoke(<generated>)
	at com.google.inject.internal.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
	at com.google.inject.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:64)
	at org.fedoraproject.candlepin.auth.interceptor.SecurityInterceptor.invoke(SecurityInterceptor.java:91)
	at com.google.inject.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:64)
	at com.google.inject.InterceptorStackCallback.intercept(InterceptorStackCallback.java:44)
	at org.fedoraproject.candlepin.resource.ProductResource$$EnhancerByGuice$$5598bde1.deleteProduct(<generated>)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:140)
	... 36 more
Caused by: org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
	at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:94)
	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
	at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)
	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266)
	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:172)
	at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
	at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
	at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1028)
	at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:366)
	at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:137)
	at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:54)
	... 55 more
Caused by: java.sql.BatchUpdateException: Batch entry 0 delete from cp_product where id='Foo7' was aborted.  Call getNextException to see the cause.
	at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2569)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1796)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:407)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:2708)
	at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)
	at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)

Comment 1 William Poteat 2011-03-28 15:41:55 UTC
Added exception handling for this scenario. Matches behavoir of attempting a delete of a nonexistent product.

Comment 2 John Sefler 2011-07-12 20:44:59 UTC
I am not able to verify the fix for this bug.
I am also not confident that I am following the exact same path as the original defect in comment #0.  Nevertheless, I am running into the following bug using these recreate steps based on comment #0 ....

Using master candlepin server with the TESTDATA deployed....

[root@jsefler-onprem-62candlepin proxy]# git branch
  0.3
* master
[root@jsefler-onprem-62candlepin proxy]# git show-ref | grep master
1be84d3971b32d03aea4d4ab363902e3ef4f377a refs/heads/master
1be84d3971b32d03aea4d4ab363902e3ef4f377a refs/remotes/origin/master


Initial recreate steps from the client...

[root@jsefler-onprem-62server ~]# subscription-manager list --avail | grep management-100 -A1
ProductId:         	management-100           
PoolId:            	8a90f8c6311de31701311de46a570261
--
ProductId:         	management-100           
PoolId:            	8a90f8c6311de31701311de46aa80262
[root@jsefler-onprem-62server ~]# subscription-manager subscribe --pool=8a90f8c6311de31701311de46a570261 --pool=8a90f8c6311de31701311de46aa80262
Successfully subscribed the system to Pool 8a90f8c6311de31701311de46a570261
Successfully subscribed the system to Pool 8a90f8c6311de31701311de46aa80262


[root@jsefler-onprem-62server ~]# curl -k -u admin:admin --request GET https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/products/management-100 | python -mjson.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
106  1066  106  1066    0     0   9503      0 --:--:-- --:--:-- --:--:--  104k
{
    "attributes": [
        {
            "created": "2011-07-12T10:28:53.196+0000", 
            "name": "version", 
            "updated": "2011-07-12T10:28:53.196+0000", 
            "value": "1.0"
        }, 
        {
            "created": "2011-07-12T10:28:53.196+0000", 
            "name": "variant", 
            "updated": "2011-07-12T10:28:53.196+0000", 
            "value": "ALL"
        }, 
        {
            "created": "2011-07-12T10:28:53.196+0000", 
            "name": "arch", 
            "updated": "2011-07-12T10:28:53.196+0000", 
            "value": "ALL"
        }, 
        {
            "created": "2011-07-12T10:28:53.196+0000", 
            "name": "management_enabled", 
            "updated": "2011-07-12T10:28:53.196+0000", 
            "value": "1"
        }, 
        {
            "created": "2011-07-12T10:28:53.196+0000", 
            "name": "warning_period", 
            "updated": "2011-07-12T10:28:53.196+0000", 
            "value": "90"
        }, 
        {
            "created": "2011-07-12T10:28:53.196+0000", 
            "name": "type", 
            "updated": "2011-07-12T10:28:53.196+0000", 
            "value": "MKT"
        }, 
        {
            "created": "2011-07-12T10:28:53.196+0000", 
            "name": "multi-entitlement", 
            "updated": "2011-07-12T10:28:53.196+0000", 
            "value": "no"
        }
    ], 
    "created": "2011-07-12T10:28:53.196+0000", 
    "dependentProductIds": [], 
    "href": "/products/management-100", 
    "id": "management-100", 
    "multiplier": 100, 
    "name": "Management Add-On", 
    "productContent": [], 
    "updated": "2011-07-12T10:28:53.196+0000"
}
[root@jsefler-onprem-62server ~]# curl -k -u admin:admin --request DELETE https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/products/management-100 | python -mjson.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
156   156  156   156    0     0   1141      0 --:--:-- --:--:-- --:--:--  4000
{
    "displayMessage": "Runtime Error Error while commiting the transaction at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError:2,598"
}


^^^^ BANG, DID NOT EXPECT THAT RUNTIME ERROR.  EXPECTED SOMETHING LIKE...  Cannot delete product X from which subscriptions are being consumed.


Here is the stack trace from catalina.out...
Jul 12 16:34:10 [http-8443-3] DEBUG org.fedoraproject.candlepin.servlet.filter.logging.LoggingFilter - 
Request: DELETE  https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/products/management-100
====Headers====
  authorization: Basic YWRtaW46YWRtaW4=
  user-agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.12.9.0 zlib/1.2.3 libidn/1.18 libssh2/1.2.2
  host: jsefler-onprem-62candlepin.usersys.redhat.com:8443
  accept: */*
====Headers====
Jul 12 16:34:10 [http-8443-3] DEBUG org.fedoraproject.candlepin.servlet.filter.logging.LoggingFilter - ====RequestBody====
Jul 12 16:34:10 [http-8443-3] DEBUG org.fedoraproject.candlepin.servlet.filter.logging.LoggingFilter - 
Jul 12 16:34:10 [http-8443-3] DEBUG org.fedoraproject.candlepin.guice.I18nProvider - Getting i18n engine for locale en_US
Jul 12 16:34:10 [http-8443-3] DEBUG org.fedoraproject.candlepin.resteasy.interceptor.AuthInterceptor - Authentication check for /products/management-100
Jul 12 16:34:10 [http-8443-3] DEBUG org.fedoraproject.candlepin.resteasy.interceptor.OAuth - Checking for oauth authentication
Jul 12 16:34:10 [http-8443-3] DEBUG org.fedoraproject.candlepin.guice.I18nProvider - Getting i18n engine for locale en_US
Jul 12 16:34:10 [http-8443-3] DEBUG org.fedoraproject.candlepin.resteasy.interceptor.BasicAuth - check for: admin - password of length #5 = <omitted>
Jul 12 16:34:10 [http-8443-3] DEBUG org.fedoraproject.candlepin.resteasy.interceptor.BasicAuth - principal created for user 'admin
Jul 12 16:34:10 [http-8443-3] DEBUG org.fedoraproject.candlepin.auth.interceptor.SecurityInterceptor - Invoked security interceptor public void org.fedoraproject.candlepin.resource.ProductResource.deleteProduct(java.lang.String)
Jul 12 16:34:10 [http-8443-3] DEBUG org.fedoraproject.candlepin.guice.I18nProvider - Getting i18n engine for locale en_US
Jul 12 16:34:10 [http-8443-3] DEBUG org.fedoraproject.candlepin.service.impl.DefaultProductServiceAdapter - called getProductById
Jul 12 16:34:10 [http-8443-3] WARN  org.hibernate.util.JDBCExceptionReporter - SQL Error: 0, SQLState: 23503
Jul 12 16:34:10 [http-8443-3] ERROR org.hibernate.util.JDBCExceptionReporter - Batch entry 0 delete from cp_product where id='management-100' was aborted.  Call getNextException to see the cause.
Jul 12 16:34:10 [http-8443-3] WARN  org.hibernate.util.JDBCExceptionReporter - SQL Error: 0, SQLState: 23503
Jul 12 16:34:10 [http-8443-3] ERROR org.hibernate.util.JDBCExceptionReporter - ERROR: update or delete on table "cp_product" violates foreign key constraint "fk_subscription_product" on table "cp_subscription"
  Detail: Key (id)=(management-100) is still referenced from table "cp_subscription".
Jul 12 16:34:10 [http-8443-3] ERROR org.hibernate.event.def.AbstractFlushingEventListener - Could not synchronize database state with session
org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
	at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:94)
	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
	at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)
	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266)
	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:172)
	at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
	at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
	at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1028)
	at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:366)
	at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:137)
	at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:54)
	at com.wideplay.warp.persist.jpa.JpaLocalTxnInterceptor.invoke(JpaLocalTxnInterceptor.java:88)
	at com.google.inject.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:64)
	at com.google.inject.InterceptorStackCallback.intercept(InterceptorStackCallback.java:44)
	at org.fedoraproject.candlepin.model.ProductCurator$$EnhancerByGuice$$c80c3eb3.delete(<generated>)
	at org.fedoraproject.candlepin.service.impl.DefaultProductServiceAdapter.deleteProduct(DefaultProductServiceAdapter.java:108)
	at org.fedoraproject.candlepin.resource.ProductResource.deleteProduct(ProductResource.java:176)
	at org.fedoraproject.candlepin.resource.ProductResource$$EnhancerByGuice$$4f1ca610.CGLIB$deleteProduct$3(<generated>)
	at org.fedoraproject.candlepin.resource.ProductResource$$EnhancerByGuice$$4f1ca610$$FastClassByGuice$$e09171df.invoke(<generated>)
	at com.google.inject.internal.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
	at com.google.inject.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:64)
	at org.fedoraproject.candlepin.auth.interceptor.SecurityInterceptor.invoke(SecurityInterceptor.java:110)
	at com.google.inject.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:64)
	at com.google.inject.InterceptorStackCallback.intercept(InterceptorStackCallback.java:44)
	at org.fedoraproject.candlepin.resource.ProductResource$$EnhancerByGuice$$4f1ca610.deleteProduct(<generated>)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:140)
	at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:248)
	at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:216)
	at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:205)
	at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:489)
	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:466)
	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:120)
	at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:200)
	at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:48)
	at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:43)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:216)
	at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:141)
	at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:93)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:63)
	at org.fedoraproject.candlepin.servlet.filter.VersionFilter.doFilter(VersionFilter.java:47)
	at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:129)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:59)
	at org.fedoraproject.candlepin.servlet.filter.logging.LoggingFilter.doFilter(LoggingFilter.java:55)
	at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:129)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:59)
	at com.wideplay.warp.persist.PersistenceFilter$3.run(PersistenceFilter.java:141)
	at com.wideplay.warp.persist.internal.Lifecycles.failEarlyAndLeaveNoOneBehind(Lifecycles.java:29)
	at com.wideplay.warp.persist.PersistenceFilter.doFilter(PersistenceFilter.java:155)
	at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:129)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:59)
	at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:122)
	at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:110)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
	at java.lang.Thread.run(Thread.java:679)
Caused by: java.sql.BatchUpdateException: Batch entry 0 delete from cp_product where id='management-100' was aborted.  Call getNextException to see the cause.
	at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2598)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1836)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:407)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:2737)
	at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)
	at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)
	... 66 more
Jul 12 16:34:10 [http-8443-3] ERROR org.fedoraproject.candlepin.exceptions.CandlepinExceptionMapper - Runtime exception:
org.jboss.resteasy.spi.ApplicationException: javax.persistence.RollbackException: Error while commiting the transaction
	at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:154)
	at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:248)
	at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:216)
	at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:205)
	at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:489)
	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:466)
	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:120)
	at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:200)
	at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:48)
	at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:43)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:216)
	at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:141)
	at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:93)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:63)
	at org.fedoraproject.candlepin.servlet.filter.VersionFilter.doFilter(VersionFilter.java:47)
	at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:129)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:59)
	at org.fedoraproject.candlepin.servlet.filter.logging.LoggingFilter.doFilter(LoggingFilter.java:55)
	at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:129)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:59)
	at com.wideplay.warp.persist.PersistenceFilter$3.run(PersistenceFilter.java:141)
	at com.wideplay.warp.persist.internal.Lifecycles.failEarlyAndLeaveNoOneBehind(Lifecycles.java:29)
	at com.wideplay.warp.persist.PersistenceFilter.doFilter(PersistenceFilter.java:155)
	at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:129)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:59)
	at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:122)
	at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:110)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
	at java.lang.Thread.run(Thread.java:679)
Caused by: javax.persistence.RollbackException: Error while commiting the transaction
	at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:71)
	at com.wideplay.warp.persist.jpa.JpaLocalTxnInterceptor.invoke(JpaLocalTxnInterceptor.java:88)
	at com.google.inject.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:64)
	at com.google.inject.InterceptorStackCallback.intercept(InterceptorStackCallback.java:44)
	at org.fedoraproject.candlepin.model.ProductCurator$$EnhancerByGuice$$c80c3eb3.delete(<generated>)
	at org.fedoraproject.candlepin.service.impl.DefaultProductServiceAdapter.deleteProduct(DefaultProductServiceAdapter.java:108)
	at org.fedoraproject.candlepin.resource.ProductResource.deleteProduct(ProductResource.java:176)
	at org.fedoraproject.candlepin.resource.ProductResource$$EnhancerByGuice$$4f1ca610.CGLIB$deleteProduct$3(<generated>)
	at org.fedoraproject.candlepin.resource.ProductResource$$EnhancerByGuice$$4f1ca610$$FastClassByGuice$$e09171df.invoke(<generated>)
	at com.google.inject.internal.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
	at com.google.inject.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:64)
	at org.fedoraproject.candlepin.auth.interceptor.SecurityInterceptor.invoke(SecurityInterceptor.java:110)
	at com.google.inject.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:64)
	at com.google.inject.InterceptorStackCallback.intercept(InterceptorStackCallback.java:44)
	at org.fedoraproject.candlepin.resource.ProductResource$$EnhancerByGuice$$4f1ca610.deleteProduct(<generated>)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:140)
	... 39 more
Caused by: org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
	at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:94)
	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
	at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)
	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266)
	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:172)
	at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
	at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
	at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1028)
	at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:366)
	at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:137)
	at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:54)
	... 58 more
Caused by: java.sql.BatchUpdateException: Batch entry 0 delete from cp_product where id='management-100' was aborted.  Call getNextException to see the cause.
	at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2598)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1836)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:407)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:2737)
	at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)
	at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)
	... 66 more
Jul 12 16:34:10 [http-8443-3] DEBUG org.fedoraproject.candlepin.guice.I18nProvider - Getting i18n engine for locale en_US
Jul 12 16:34:10 [http-8443-3] DEBUG org.fedoraproject.candlepin.servlet.filter.logging.LoggingFilter - 
====Response====
  Status: 500
  Content-type: application/json
====Response====
Jul 12 16:34:10 [http-8443-3] DEBUG org.fedoraproject.candlepin.servlet.filter.logging.LoggingFilter - ====ResponseBody====
Jul 12 16:34:10 [http-8443-3] DEBUG org.fedoraproject.candlepin.servlet.filter.logging.LoggingFilter - {"displayMessage":"Runtime Error Error while commiting the transaction at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError:2,598"}



moving back to NEW

Comment 3 John Sefler 2011-07-12 20:47:12 UTC
A related question...  Why doesn't the following DELETE request fill in the variable substitution for {0}?...

[root@jsefler-onprem-62server ~]# curl -k -u admin:admin --request DELETE https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/products/FOOBAR | python -mjson.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0    61    0    61    0     0    445      0 --:--:-- --:--:-- --:--:--  6100
{
    "displayMessage": "Product with UUID {0} could not be found"
}

Comment 5 John Sefler 2011-07-26 21:54:34 UTC
Verifying Version...
[root@jsefler-onprem-62candlepin proxy]# git branch
  0.3
* master
[root@jsefler-onprem-62candlepin proxy]# git show-ref | grep master
b04de4d516d9f6b1036248db29c23a7b1e577c97 refs/heads/master
b04de4d516d9f6b1036248db29c23a7b1e577c97 refs/remotes/origin/master


[root@jsefler-onprem-62server ~]# curl -k -u admin:admin --request DELETE https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/products/FOOBAR
{"displayMessage":"Product with UUID 'FOOBAR' could not be found"}

                                      ^^^^^^ VERIFIED FIX TO comment 3

Comment 6 John Sefler 2011-07-26 22:51:59 UTC
Verifying Version...
[root@jsefler-onprem-62candlepin proxy]# git branch
  0.3
* master
[root@jsefler-onprem-62candlepin proxy]# git show-ref | grep master
b04de4d516d9f6b1036248db29c23a7b1e577c97 refs/heads/master
b04de4d516d9f6b1036248db29c23a7b1e577c97 refs/remotes/origin/master


[root@jsefler-onprem-62server ~]# subscription-manager list --avail | grep management-100 -A1
ProductId:         	management-100           
PoolId:            	8a90f8c631680f14013168107b620278
--
ProductId:         	management-100           
PoolId:            	8a90f8c631680f14013168107b970280
[root@jsefler-onprem-62server ~]# subscription-manager subscribe --pool=8a90f8c631680f14013168107b620278 --pool=8a90f8c631680f14013168107b970280
Successfully subscribed the system to Pool 8a90f8c631680f14013168107b620278
Successfully subscribed the system to Pool 8a90f8c631680f14013168107b970280
[root@jsefler-onprem-62server ~]# 
[root@jsefler-onprem-62server ~]# curl -k -u admin:admin --request DELETE https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/products/management-100 | python -mjson.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0   100    0   100    0     0    993      0 --:--:-- --:--:-- --:--:--  6666
{
    "displayMessage": "Product with UUID 'management-100' cannot be deleted while subscriptions exist."
}

^^^ VERIFIED THE DELETE REQUEST WAS BLOCKED AND A REASON WHY WAS RETURNED



Now, for the fun sake of testing, let's find the subscriptionId for the pool to which we subscribed and try to delete the subscription....

[root@jsefler-onprem-62server ~]# curl -k -u admin:admin --request GET https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/pools/8a90f8c631680f14013168107b620278 | python -mjson.tool | grep subscriptionId
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2012  100  2012    0     0   9450      0 --:--:-- --:--:-- --:--:-- 22863
    "subscriptionId": "8a90f8c631680f14013168107979026d", 

[root@jsefler-onprem-62server ~]# curl -k -u admin:admin --request DELETE https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/subscriptions/8a90f8c631680f14013168107979026d | python -mjson.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
No JSON object could be decoded
[root@jsefler-onprem-62server ~]# curl -k -u admin:admin --request DELETE https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/subscriptions/8a90f8c631680f14013168107979026d | python -mjson.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0    93    0    93    0     0    808      0 --:--:-- --:--:-- --:--:--  6200
{
    "displayMessage": "Subscription with id 8a90f8c631680f14013168107979026d could not be found"
}
[root@jsefler-onprem-62server ~]# 

^^^^ THE DELETE APPEARS TO HAVE WORKED.

Let's make sure all the subscriptions for this product are deleted...

[root@jsefler-onprem-62server ~]# curl -k -u admin:admin --request GET https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/subscriptions | python -mjson.tool | grep management-100  -B61
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  573k    0  573k    0     0   982k      0 --:--:-- --:--:-- --:--:-- 1172k
    {
        "accountNumber": "12331131231", 
        "certificate": null, 
        "contractNumber": "72", 
        "created": "2011-07-26T20:08:55.301+0000", 
        "endDate": "2012-07-25T00:00:00.000+0000", 
        "id": "8a90f8c631680f14013168107905026c", 
        "modified": null, 
        "owner": {
            "displayName": "Admin Owner", 
            "href": "/owners/admin", 
            "id": "8a90f8c631680f140131680f7be70006", 
            "key": "admin"
        }, 
        "product": {
            "attributes": [
                {
                    "created": "2011-07-26T20:08:55.168+0000", 
                    "name": "version", 
                    "updated": "2011-07-26T20:08:55.168+0000", 
                    "value": "1.0"
                }, 
                {
                    "created": "2011-07-26T20:08:55.169+0000", 
                    "name": "variant", 
                    "updated": "2011-07-26T20:08:55.169+0000", 
                    "value": "ALL"
                }, 
                {
                    "created": "2011-07-26T20:08:55.169+0000", 
                    "name": "arch", 
                    "updated": "2011-07-26T20:08:55.169+0000", 
                    "value": "ALL"
                }, 
                {
                    "created": "2011-07-26T20:08:55.169+0000", 
                    "name": "management_enabled", 
                    "updated": "2011-07-26T20:08:55.169+0000", 
                    "value": "1"
                }, 
                {
                    "created": "2011-07-26T20:08:55.169+0000", 
                    "name": "warning_period", 
                    "updated": "2011-07-26T20:08:55.169+0000", 
                    "value": "90"
                }, 
                {
                    "created": "2011-07-26T20:08:55.170+0000", 
                    "name": "type", 
                    "updated": "2011-07-26T20:08:55.170+0000", 
                    "value": "MKT"
                }, 
                {
                    "created": "2011-07-26T20:08:55.170+0000", 
                    "name": "multi-entitlement", 
                    "updated": "2011-07-26T20:08:55.170+0000", 
                    "value": "no"
                }
            ], 
            "created": "2011-07-26T20:08:55.168+0000", 
            "dependentProductIds": [], 
            "href": "/products/management-100", 
            "id": "management-100", 
--
    {
        "accountNumber": "12331131231", 
        "certificate": null, 
        "contractNumber": "73", 
        "created": "2011-07-26T20:08:55.538+0000", 
        "endDate": "2013-07-15T00:00:00.000+0000", 
        "id": "8a90f8c631680f140131681079f2026e", 
        "modified": null, 
        "owner": {
            "displayName": "Admin Owner", 
            "href": "/owners/admin", 
            "id": "8a90f8c631680f140131680f7be70006", 
            "key": "admin"
        }, 
        "product": {
            "attributes": [
                {
                    "created": "2011-07-26T20:08:55.168+0000", 
                    "name": "version", 
                    "updated": "2011-07-26T20:08:55.168+0000", 
                    "value": "1.0"
                }, 
                {
                    "created": "2011-07-26T20:08:55.169+0000", 
                    "name": "variant", 
                    "updated": "2011-07-26T20:08:55.169+0000", 
                    "value": "ALL"
                }, 
                {
                    "created": "2011-07-26T20:08:55.169+0000", 
                    "name": "arch", 
                    "updated": "2011-07-26T20:08:55.169+0000", 
                    "value": "ALL"
                }, 
                {
                    "created": "2011-07-26T20:08:55.169+0000", 
                    "name": "management_enabled", 
                    "updated": "2011-07-26T20:08:55.169+0000", 
                    "value": "1"
                }, 
                {
                    "created": "2011-07-26T20:08:55.169+0000", 
                    "name": "warning_period", 
                    "updated": "2011-07-26T20:08:55.169+0000", 
                    "value": "90"
                }, 
                {
                    "created": "2011-07-26T20:08:55.170+0000", 
                    "name": "type", 
                    "updated": "2011-07-26T20:08:55.170+0000", 
                    "value": "MKT"
                }, 
                {
                    "created": "2011-07-26T20:08:55.170+0000", 
                    "name": "multi-entitlement", 
                    "updated": "2011-07-26T20:08:55.170+0000", 
                    "value": "no"
                }
            ], 
            "created": "2011-07-26T20:08:55.168+0000", 
            "dependentProductIds": [], 
            "href": "/products/management-100", 
            "id": "management-100", 
[root@jsefler-onprem-62server ~]# 
[root@jsefler-onprem-62server ~]# curl -k -u admin:admin --request DELETE https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/subscriptions/8a90f8c631680f14013168107905026c | python -mjson.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
No JSON object could be decoded
[root@jsefler-onprem-62server ~]# curl -k -u admin:admin --request DELETE https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/subscriptions/8a90f8c631680f140131681079f2026e | python -mjson.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
No JSON object could be decoded
[root@jsefler-onprem-62server ~]# 



With all the subscriptions deleted, let's try and delete the product again...

[root@jsefler-onprem-62server ~]# curl -k -u admin:admin --request DELETE https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/products/management-100 | python -mjson.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
No JSON object could be decoded
[root@jsefler-onprem-62server ~]# curl -k -u admin:admin --request DELETE https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/products/management-100 | python -mjson.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0    74    0    74    0     0   1111      0 --:--:-- --:--:-- --:--:--  8222
{
    "displayMessage": "Product with UUID 'management-100' could not be found"
}


^^^ SUCCESS... WITH ALL THE SUBSCRIPTIONS DELETED, THE PRODUCT COULD BE DELETED SUCCESSFULLY.


moving to VERIFIED


Note You need to log in before you can comment on or make changes to this bug.