Bug 1166365 - Deleting a repo should either block until done or return a task
Summary: Deleting a repo should either block until done or return a task
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Content Management
Version: Nightly
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: Unspecified
Assignee: Walden Raines
QA Contact: jaudet
URL: http://projects.theforeman.org/issues...
Whiteboard:
: 1163494 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-11-20 22:16 UTC by jaudet
Modified: 2017-02-23 20:47 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-08-12 05:19:46 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
A snippet from /var/log/foreman/production.log showing a DELETE, GET and GET request (30.53 KB, text/plain)
2014-11-20 22:16 UTC, jaudet
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 9583 0 None None None 2016-04-22 16:25:54 UTC
Red Hat Product Errata RHSA-2015:1592 0 normal SHIPPED_LIVE Important: Red Hat Satellite 6.1.1 on RHEL 6 2015-08-12 09:04:35 UTC

Description jaudet 2014-11-20 22:16:41 UTC
Created attachment 959503 [details]
A snippet from /var/log/foreman/production.log showing a DELETE, GET and GET request

Description of problem:
Deleting a repository is an asynchronous task, and there's no way to monitor the progress of the deletion except by polling to see if that repository still exists. This is problematic, and it's exacerbated by the fact that the task can take a significant (10+ seconds) amount of time. When a client deletes a repository, Satellite should either block until the deletion is done, or it should return a task that can be monitored.

Version-Release number of selected component (if applicable):
Tested against a machine running a nightly version of Foreman 1.8.0-develop, with the following packages installed:

* candlepin-0.9.34-1.el7.noarch
* candlepin-common-1.0.14-1.el7.noarch
* candlepin-selinux-0.9.34-1.el7.noarch
* candlepin-tomcat-0.9.34-1.el7.noarch
* elasticsearch-0.90.10-7.el7.noarch
* foreman-1.8.0-0.develop.201411201054gitbe4602e.el7.noarch
* foreman-compute-1.8.0-0.develop.201411201054gitbe4602e.el7.noarch
* foreman-gce-1.8.0-0.develop.201411201054gitbe4602e.el7.noarch
* foreman-libvirt-1.8.0-0.develop.201411201054gitbe4602e.el7.noarch
* foreman-ovirt-1.8.0-0.develop.201411201054gitbe4602e.el7.noarch
* foreman-postgresql-1.8.0-0.develop.201411201054gitbe4602e.el7.noarch
* foreman-proxy-1.8.0-0.develop.201411121327gitab6edc2.el7.noarch
* foreman-release-1.8.0-0.develop.201411201054gitbe4602e.el7.noarch
* foreman-selinux-1.8.0-0.develop.201410280941git10de1c5.el7.noarch
* foreman-vmware-1.8.0-0.develop.201411201054gitbe4602e.el7.noarch
* katello-2.1.0-1.201411061509gitb0b8f43.el7.noarch
* katello-certs-tools-2.0.1-1.el7.noarch
* katello-default-ca-1.0-1.noarch
* katello-installer-2.1.0-1.201411172212git9d6f424.el7.noarch
* katello-repos-2.1.1-1.el7.noarch
* katello-server-ca-1.0-1.noarch
* openldap-2.4.39-3.el7.x86_64
* pulp-docker-plugins-0.2.1-0.2.beta.el7.noarch
* pulp-katello-0.3-3.el7.noarch
* pulp-nodes-common-2.5.0-0.7.beta.el7.noarch
* pulp-nodes-parent-2.5.0-0.7.beta.el7.noarch
* pulp-puppet-plugins-2.5.0-0.7.beta.el7.noarch
* pulp-puppet-tools-2.5.0-0.7.beta.el7.noarch
* pulp-rpm-plugins-2.5.0-0.7.beta.el7.noarch
* pulp-selinux-2.5.0-0.7.beta.el7.noarch
* pulp-server-2.5.0-0.7.beta.el7.noarch
* python-ldap-2.4.6-6.el7.x86_64
* ruby193-rubygem-ldap_fluff-0.3.3-1.el7.noarch
* ruby193-rubygem-net-ldap-0.3.1-2.el7.noarch
* ruby193-rubygem-runcible-1.3.0-1.el7.noarch

How reproducible:
Very frequent, but varies depending on server load.

Steps to Reproduce:
1. Create (POST) a repository and take note of its ID.
2. DELETE that repository.
3. GET that repository. Check the contents of the response.

Actual results:
Either an HTTP 200 or HTTP 500 response. Immediately after the deletion, an HTTP 200 response is received, which indicates that the repository still exists. After the deletion process starts, an HTTP 500 response is received with the following error message:

    undefined method `[]' for nil:NilClass

Expected results:
An HTTP 404.

Additional info:
Here's a simple script that I've used to test this issue (it depends on some robottelo code):

    #!/usr/bin/env python2
    from robottelo.entities import Repository
    from time import sleep
    repo_id = Repository().create_json()['id']
    repo = Repository(id=repo_id)
    print('Target: 200, actual: {0}'.format(repo.read_raw().status_code))
    repo.delete()
    print('Target: 404, actual: {0}'.format(repo.read_raw().status_code))
    sleep(10)
    print('Target: 404, actual: {0}'.format(repo.read_raw().status_code))

And here's some output I've received:

    Target: 200, actual: 200
    Target: 404, actual: 200
    Target: 404, actual: 500

Comment 1 RHEL Program Management 2014-11-20 22:23:28 UTC
Since this issue was entered in Red Hat Bugzilla, the release flag has been
set to ? to ensure that it is properly evaluated for this release.

Comment 3 jaudet 2014-11-24 14:20:57 UTC
Tests are already in place for this bug, and they are now being skipped due to it. See here: https://github.com/SatelliteQE/robottelo/pull/1741

Comment 4 jaudet 2014-11-25 15:59:24 UTC
*** Bug 1163494 has been marked as a duplicate of this bug. ***

Comment 7 Walden Raines 2015-02-27 18:57:19 UTC
Created redmine issue http://projects.theforeman.org/issues/9583 from this bug

Comment 8 Walden Raines 2015-02-27 20:03:30 UTC
Decided to handle this by doing a synchronous task on a single repo delete and an async parent task on a bulk delete.

Comment 9 Walden Raines 2015-03-02 16:58:10 UTC
PR: https://github.com/Katello/katello/pull/5067

Comment 10 jaudet 2015-03-05 15:05:47 UTC
Similar to: https://bugzilla.redhat.com/show_bug.cgi?id=1199150

Comment 11 Bryan Kearney 2015-03-10 14:04:30 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/9583 has been closed
-------------
Walden Raines
Applied in changeset commit:katello|b222c9bb5f44ae054fd0d36aaf89ea18cce0ff79.

Comment 14 jaudet 2015-03-18 18:08:25 UTC
Tested against Satellite-6.1.0-RHEL-6-20150317.0 and
Satellite-6.1.0-RHEL-7-20150317.0. Output, where `test.py` is the script listed
in #c0:

    $ ./test.py
    Target: 200, actual: 200
    Target: 404, actual: 404
    Target: 404, actual: 404
    $ nosetests tests/foreman/api/test_repository.py -m test_delete
    ...........
    ----------------------------------------------------------------------
    Ran 11 tests in 44.991s

    OK

Comment 15 Bryan Kearney 2015-08-11 13:24:05 UTC
This bug is slated to be released with Satellite 6.1.

Comment 16 errata-xmlrpc 2015-08-12 05:19:46 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2015:1592


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