Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Cannot List Systemwide Tasks #522

Closed
jhunt opened this issue May 14, 2019 · 2 comments
Closed

[BUG] Cannot List Systemwide Tasks #522

jhunt opened this issue May 14, 2019 · 2 comments
Assignees
Labels
Milestone

Comments

@jhunt
Copy link
Contributor

jhunt commented May 14, 2019

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Run a SHIELD for a while
  2. Run shield tasks as a system engineer (site-wide)
  3. Pick a task UUID
  4. Run shield task $uuid
  5. Note failure.
  6. Weep.

Expected behavior
I expected to see the log and metadata details of the task.

Screenshots

→  ./shield tasks -L | tail -n 5
9edb4cfa-a91f-4282-9a90-51cc441b8e49  test-store       done    system       2019-05-14 14:19:12-0400  2019-05-14 14:19:14-0400  2019-05-14 14:19:16-0400
e6dd83ae-880e-4840-b697-d37ffa4b3f39  backup           done    admin@local  2019-05-14 14:19:12-0400  2019-05-14 14:19:14-0400  2019-05-14 14:19:16-0400
48a69616-ed2a-4ff1-9609-bbfa469090cc  test-store       done    system       2019-05-14 14:19:11-0400  2019-05-14 14:19:14-0400  2019-05-14 14:19:16-0400
6208163e-28b6-4c13-83c6-e730df94f3d6  test-store       done    system       2019-05-14 14:19:11-0400  2019-05-14 14:19:14-0400  2019-05-14 14:19:16-0400
b4118328-5637-476a-9be7-20b6ceb147bd  agent-status     done    system       2019-05-14 14:19:03-0400  2019-05-14 14:19:04-0400  2019-05-14 14:19:04-0400

→  ./shield task b4118328-5637-476a-9be7-20b6ceb147bd
!!! No such task (no further diagnostic information available)

SHIELD versions (please complete the following information):

  • SHIELD Core: 8.1+
  • SHIELD CLI: same

Additional context
Found while trying to test short UUID support in new 8.2.x CLI.

@jhunt jhunt added the triage Issues that are pending triage / validation by a SHIELD contributor label May 14, 2019
@jhunt
Copy link
Contributor Author

jhunt commented May 15, 2019

I think I found the root cause, since this unexpectedly worked this morning while I was tracking down some issues with a test-store task. Consider:

→  ./shield -c localdev tasks -s failed -L | grep test-store | tail -n 5
7414c483-f252-4f9c-8feb-5821059607bc  test-store  failed  system       2019-05-15 08:10:47-0400  2019-05-15 08:10:52-0400  2019-05-15 08:10:56-0400
98960a50-83bf-40ee-a13b-8675475c79d0  test-store  failed  system       2019-05-15 08:09:43-0400  2019-05-15 08:09:44-0400  2019-05-15 08:09:44-0400
07822665-a587-48ff-9e38-bbe504754c2b  test-store  failed  system       2019-05-15 08:09:03-0400  2019-05-15 08:09:03-0400  2019-05-15 08:09:07-0400
b3ba00d8-6054-42d6-b43f-fdbbde5c12b2  test-store  failed  system       2019-05-15 08:08:23-0400  2019-05-15 08:08:23-0400  2019-05-15 08:08:26-0400
0e87fc91-f142-46f6-9392-18e6b05f584e  test-store  failed  system       2019-05-15 08:07:43-0400  2019-05-15 08:07:48-0400  2019-05-15 08:07:53-0400

→  ./shield -c localdev task 7414c483-f252-4f9c-8feb-5821059607bc | head -n 5
UUID:       7414c483-f252-4f9c-8feb-5821059607bc
Owner:      system
Type:       test-store
Status:     failed

The difference between the failing case (as initially reported) and this working case is that the failing case was looking for an agent-status task, whereas the successful case is looking for a test-store task.

Need to determine, via -T if the CLI is always using /v2/tasks/:uuid for the non-tenant invocation (as all of these are), and if there are system-wide tasks that cannot be looked up that way.

Indeed, on the same system, with the same versions in play, a lookup of an agent-status task fails:

→  ./shield -c localdev tasks -L | grep agent-status | tail -n 5
bc60afc8-f73b-419f-88c0-e3a7ae7d15fd  agent-status     done    system       2019-05-15 08:09:43-0400  2019-05-15 08:09:43-0400  2019-05-15 08:09:44-0400
94ef18a5-01c0-46fb-8801-b31ff130c459  agent-status     done    system       2019-05-15 08:09:03-0400  2019-05-15 08:09:03-0400  2019-05-15 08:09:04-0400
c5ee0585-f3ec-4cfa-b970-1c54f40b85f2  agent-status     done    system       2019-05-15 08:08:23-0400  2019-05-15 08:08:23-0400  2019-05-15 08:08:26-0400
e7c39b77-a95f-47a7-96b2-68b9d77ee3de  agent-status     done    system       2019-05-15 08:07:43-0400  2019-05-15 08:07:48-0400  2019-05-15 08:07:51-0400
a65f09db-91bc-4cc6-8ea7-29028921ef45  agent-status     done    system       2019-05-15 08:07:08-0400  2019-05-15 08:07:08-0400  2019-05-15 08:07:08-0400

→  ./shield -c localdev task bc60afc8-f73b-419f-88c0-e3a7ae7d15fd | head -n 5
!!! No such task (no further diagnostic information available)

@jhunt
Copy link
Contributor Author

jhunt commented May 15, 2019

Found this in the handler for /v2/tasks/:uuid:

        if task == nil || task.TenantUUID != db.GlobalTenantUUID {
            r.Fail(route.NotFound(err, "No such task"))
            return
        }

Sure enough, a quick SQL query for task types that have no tenant_uuid:

sqlite> SELECT op, COUNT(op) AS n FROM tasks WHERE tenant_uuid = '';
agent-status|34

I think that's the culprit. This will need a fix and a fixup.

@jhunt jhunt added bug and removed triage Issues that are pending triage / validation by a SHIELD contributor labels May 15, 2019
@jhunt jhunt closed this as completed in 7bb3e78 May 15, 2019
@jhunt jhunt added this to the v8.2 milestone May 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants