Bug 687970

Summary: Currently no way to delete a content source from a product
Product: [Community] Candlepin Reporter: Justin Sherrill <jsherril>
Component: candlepinAssignee: Jesus M. Rodriguez <jesusr>
Status: CLOSED CURRENTRELEASE QA Contact: John Sefler <jsefler>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 0.5CC: jesusr
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Solaris   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-07-17 13:03:48 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Justin Sherrill 2011-03-15 21:11:33 UTC
Description of problem:

You can create a content source, but currently there is no way to delete it.  Requests of  DELETE http://localhost:8080/candlepin/content/26   don't seem to work, as the call is not implemented.

Comment 3 John Sefler 2011-08-01 21:23:39 UTC
Verifying Version...
[root@jsefler-onprem-62candlepin proxy]# git show-ref | grep master
0a6ef47c330b8cca18feeb92667db6ee30f3a65e refs/heads/master
0a6ef47c330b8cca18feeb92667db6ee30f3a65e refs/remotes/origin/master


Creating content....
[jsefler@jsefler ~]$ curl -u admin:admin -k --request POST https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/content --header "Content-type: application/json" -d '{"contentUrl":"/foo/path","label":"foolabel","type":"yum","gpgUrl":"/foo/path/gpg","id":"99999","name":"fooname","vendor":"Foo Vendor"}' | python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
209   283  141   283    0   135    708    337 --:--:-- --:--:-- --:--:--  1396
{
    "contentUrl": "/foo/path", 
    "created": "2011-08-01T19:50:22.227+0000", 
    "gpgUrl": "/foo/path/gpg", 
    "id": "99999", 
    "label": "foolabel", 
    "metadataExpire": null, 
    "modifiedProductIds": [], 
    "name": "fooname", 
    "requiredTags": null, 
    "type": "yum", 
    "updated": "2011-08-01T19:50:22.227+0000", 
    "vendor": "Foo Vendor"
}


Getting content....
[jsefler@jsefler ~]$ curl -u admin:admin -k --request GET https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/content/99999 | python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
141   283  141   283    0     0    650      0 --:--:-- --:--:-- --:--:--  2801
{
    "contentUrl": "/foo/path", 
    "created": "2011-08-01T19:50:22.227+0000", 
    "gpgUrl": "/foo/path/gpg", 
    "id": "99999", 
    "label": "foolabel", 
    "metadataExpire": null, 
    "modifiedProductIds": [], 
    "name": "fooname", 
    "requiredTags": null, 
    "type": "yum", 
    "updated": "2011-08-01T19:50:22.227+0000", 
    "vendor": "Foo Vendor"
}


Deleteing content....
[jsefler@jsefler ~]$ curl -u admin:admin -k --request DELETE https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/content/99999
[jsefler@jsefler ~]$


Verifying content is gone...
[jsefler@jsefler ~]$ curl -u admin:admin -k --request GET https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/content/99999 | python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0    61    0    61    0     0    179      0 --:--:-- --:--:-- --:--:--   968
{
    "displayMessage": "Content with id 99999 could not be found"
}


moving to VERIFIED




Note: if the content is use by a product, then the content delete will be blocked.  For example:

Create the content...
[jsefler@jsefler ~]$ curl -u admin:admin -k -X POST https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/content --header "Content-type: application/json" -d '{"contentUrl":"/foo/path","label":"foolabel","type":"yum","gpgUrl":"/foo/path/gpg","id":"99999","name":"fooname","vendor":"Foo Vendor"}' | python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
209   283  141   283    0   135   1147    547 --:--:-- --:--:-- --:--:--  2027
{
    "contentUrl": "/foo/path", 
    "created": "2011-08-01T20:56:12.347+0000", 
    "gpgUrl": "/foo/path/gpg", 
    "id": "99999", 
    "label": "foolabel", 
    "metadataExpire": null, 
    "modifiedProductIds": [], 
    "name": "fooname", 
    "requiredTags": null, 
    "type": "yum", 
    "updated": "2011-08-01T20:56:12.347+0000", 
    "vendor": "Foo Vendor"
}

Create a product...
[jsefler@jsefler ~]$ curl -u admin:admin -k -X POST https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/products --header "Content-type: application/json" -d '{"id":"fooproduct","name":"fooname"}' | python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
131   227  113   227    0    36   1363    216 --:--:-- --:--:-- --:--:--  5026
{
    "attributes": [], 
    "created": "2011-08-01T21:10:39.705+0000", 
    "dependentProductIds": [], 
    "href": "/products/fooproduct", 
    "id": "fooproduct", 
    "multiplier": null, 
    "name": "fooname", 
    "productContent": [], 
    "updated": "2011-08-01T21:10:39.705+0000"
}


Map the content to the product...
[jsefler@jsefler ~]$ curl -u admin:admin -k -X POST https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/products/fooproduct/content/99999?enabled=false | python -m json.tool  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
107   537  107   537    0     0   2973      0 --:--:-- --:--:-- --:--:-- 10132
{
    "attributes": [], 
    "created": "2011-08-01T21:10:39.705+0000", 
    "dependentProductIds": [], 
    "href": "/products/fooproduct", 
    "id": "fooproduct", 
    "multiplier": null, 
    "name": "fooname", 
    "productContent": [
        {
            "content": {
                "contentUrl": "/foo/path", 
                "created": "2011-08-01T20:56:12.347+0000", 
                "gpgUrl": "/foo/path/gpg", 
                "id": "99999", 
                "label": "foolabel", 
                "metadataExpire": null, 
                "modifiedProductIds": [], 
                "name": "fooname", 
                "requiredTags": null, 
                "type": "yum", 
                "updated": "2011-08-01T20:56:12.347+0000", 
                "vendor": "Foo Vendor"
            }, 
            "enabled": false
        }
    ], 
    "updated": "2011-08-01T21:10:39.705+0000"
}

Now attempting to delete the content is blocked...
[jsefler@jsefler ~]$ curl -u admin:admin -k --request DELETE https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/content/99999 | python -mjson.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
156   156  156   156    0     0    475      0 --:--:-- --:--:-- --:--:--  2260
{
    "displayMessage": "Runtime Error Error while commiting the transaction at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError:2,598"
}

Comment 4 Bryan Kearney 2012-07-17 13:03:48 UTC
Marking all community bugs modified or beyong as closed.