Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1244904 - API: Support task search by parent_task_id
Summary: API: Support task search by parent_task_id
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: API
Version: 6.1.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: Unspecified
Assignee: Brad Buckingham
QA Contact: jaudet
David O'Brien
URL: http://projects.theforeman.org/issues...
Whiteboard:
Depends On:
Blocks: rhci-common-installer
TreeView+ depends on / blocked
 
Reported: 2015-07-20 18:05 UTC by Brad Buckingham
Modified: 2019-06-13 21:25 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-09-15 07:22:15 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 11162 0 None None None 2016-04-22 16:46:48 UTC
Red Hat Product Errata RHBA-2015:1786 0 normal SHIPPED_LIVE Satellite 6.1.2 bug fix update 2015-09-15 11:20:04 UTC

Description Brad Buckingham 2015-07-20 18:05:49 UTC
Description of problem:

Update foreman-tasks so that a user can search for tasks associated with a given parent_task_id.  This is useful for users that know the parent task and need to get access to it's children tasks.   This is needed to support RHCI and potentially other use cases.

E.g.

curl -k -u admin:password -H "Content-Type:application/json" -H "Accept:application/json,version=2" -X GET -d "{\"search\": \"parent_task_id=e3d1bd0e-652b-43f6-bb26-a9d389e7b466\"}" https://sat61fusor.example.com/foreman_tasks/api/tasks | json_reformat

Comment 1 RHEL Program Management 2015-07-20 18:14:34 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 Brad Buckingham 2015-07-21 14:03:32 UTC
Upstream PR: 
https://github.com/theforeman/foreman-tasks/pull/127

Comment 4 Bryan Kearney 2015-07-22 08:04:37 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/11162 has been closed
-------------
Brad Buckingham
Applied in changeset commit:ef6d2c311ccc1c6c21536c8f312c6b678ed69c23.

Comment 5 David O'Brien 2015-08-20 05:26:56 UTC
Is this valid rel note material? Looks like just an RFE that's in the process of being addressed.

If valid, can someone provide suitable doc text? If not, pls remove the release note blocker flag.

thanks

Comment 6 Brad Buckingham 2015-08-20 13:13:58 UTC
This one is an RFE that is being added to support dependent projects; therefore, a rel note should not be needed.  I'll remove the sat61-release-notes blocker.

Comment 8 jaudet 2015-09-09 17:20:50 UTC
It's definitely possible to search for foreman tasks using the `parent_task_id`
filter. I can make no guarantees that the searches are semantically correct, but
it's definitely true that the form of the returned data appears sane.

I don't know how to definitively trigger parent and child tasks. Instead, I use
heuristics to verify this bug. I gather 1,000 foreman task IDs and perform a
search on each of those IDs, and then analyze the search results. 996 of the
searches return zero children, but 4 return one child. The search results appear
to have a sane form (at least the first one has an ID).

When Satellite receives an invalid search term, it typically ignores that search
term. If that was the case, then the 1,000 searches would have returned far, far
more results.

    >>> from nailgun.entities import ForemanTask
    >>> foreman_tasks = ForemanTask().search(query={'per_page': 1000})
    >>> len(foreman_tasks)
    1000
    >>> child_tasks = [
    ...     ForemanTask().search(query={
    ...         'search': 'parent_task_id={}'.format(foreman_task.id)
    ...     })
    ...     for foreman_task in foreman_tasks
    ... ]
    >>> len(child_tasks)
    1000
    >>> child_task_lengths = {}
    >>> for child_task in child_tasks:
    ...     child_task_len = len(child_task)
    ...     if child_task_len not in child_task_lengths:
    ...         child_task_lengths[child_task_len] = 1
    ...     else:
    ...         child_task_lengths[child_task_len] += 1
    ...
    >>> child_task_lengths  # Over 99% of tasks are childless.
    {0: 996, 1: 4}
    >>> [
    ...     i
    ...     for i, child_task in enumerate(child_tasks)
    ...     if len(child_task) > 0
    ... ]
    [298, 857, 863, 869]
    >>> child_tasks[298][0].id  # This is a sanity check on the returned data.
    u'bc41fef8-2028-4a19-8b54-2e683927658d'

Comment 10 errata-xmlrpc 2015-09-15 07:22:15 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/RHBA-2015:1786


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