Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1244904 - API: Support task search by parent_task_id
API: Support task search by parent_task_id
Status: CLOSED ERRATA
Product: Red Hat Satellite 6
Classification: Red Hat
Component: API (Show other bugs)
6.1.0
Unspecified Unspecified
unspecified Severity high (vote)
: 6.1.2
: Unused
Assigned To: Brad Buckingham
jaudet
David O'Brien
http://projects.theforeman.org/issues...
: Triaged
Depends On:
Blocks: rhci-common-installer
  Show dependency treegraph
 
Reported: 2015-07-20 14:05 EDT by Brad Buckingham
Modified: 2017-02-23 14:49 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-09-15 03:22:15 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Foreman Issue Tracker 11162 None None None 2016-04-22 12:46 EDT
Red Hat Product Errata RHBA-2015:1786 normal SHIPPED_LIVE Satellite 6.1.2 bug fix update 2015-09-15 07:20:04 EDT

  None (edit)
Description Brad Buckingham 2015-07-20 14:05:49 EDT
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 Product and Program Management 2015-07-20 14:14:34 EDT
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 10:03:32 EDT
Upstream PR: 
https://github.com/theforeman/foreman-tasks/pull/127
Comment 4 Bryan Kearney 2015-07-22 04:04:37 EDT
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 01:26:56 EDT
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 09:13:58 EDT
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 13:20:50 EDT
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 03:22:15 EDT
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.