Getting cron trigger by name is returning 404 even if the cron exists

Bug #1987418 reported by Arnaud Morin
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Mistral
Fix Released
Undecided
Arnaud Morin

Bug Description

When getting a cron trigger by name, it can fail if the name is ending with .pl (but also other extensions) because the pecan core thinks we are asking for a perl file.

How to reproduce
================

# create cron trigger:
openstack cron trigger create --pattern '* * * * *' test.pl std.delete_instance '{"instance_id": "ec156981-b81a-42dc-b877-ca4df848f060"}'

# list the cron triggers:
openstack cron trigger list
+---------+---------------------+--------+-----------+---------------------+----------------------+---------------------+---------------------+
| Name | Workflow | Params | Pattern | Next execution time | Remaining executions | Created at | Updated at |
+---------+---------------------+--------+-----------+---------------------+----------------------+---------------------+---------------------+
| test.pl | std.delete_instance | {} | * * * * * | 2022-08-23 16:08:00 | None | 2022-08-23 15:22:16 | 2022-08-23 16:07:34 |
+---------+---------------------+--------+-----------+---------------------+----------------------+---------------------+---------------------+

# grab it from name:
openstack cron trigger show 'test.pl'
b'<html>\n <head>\n <title>404 Not Found</title>\n </head>\n <body>\n <h1>404 Not Found</h1>\n The resource could not be found.<br /><br />\n\n\n\n </body>\n</html>'

In mistral-api.log you can see:
ERROR pecan.core [-] Controller 'get' defined does not support content_type 'text/x-perl'. Supported type(s): dict_keys(['application/xml', 'text/xml', 'application/json'])

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to mistral (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/mistral/+/854240

Changed in mistral:
status: New → In Progress
Changed in mistral:
assignee: nobody → Arnaud Morin (arnaud-morin)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to mistral (master)

Reviewed: https://review.opendev.org/c/openstack/mistral/+/854240
Committed: https://opendev.org/openstack/mistral/commit/2a312cc81446c9e3ac98e6bc698fb44a82cba2b0
Submitter: "Zuul (22348)"
Branch: master

commit 2a312cc81446c9e3ac98e6bc698fb44a82cba2b0
Author: Arnaud Morin <email address hidden>
Date: Tue Aug 23 18:11:39 2022 +0200

    Do not guess content from extension on API

    When getting a cron trigger (but also any other object) by name, pecan
    core will try to guess the content_type from the extension.
    While for most name, the guess will fail, it may succeed, e.g. when a
    name is ending with '.pl'.
    Pecan guess it as a perl file and then reject the call (with a 404
    error).

    The fix is to tell pecan to not guess any content_type from extension by
    setting guess_content_type_from_ext to False on initialisation.

    Closes-Bug: 1987418

    Signed-off-by: Arnaud Morin <email address hidden>
    Change-Id: I1bc20b953787cae9b42d12bb5eb3c7a94ed4bbdd

Changed in mistral:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/mistral 15.0.0.0rc1

This issue was fixed in the openstack/mistral 15.0.0.0rc1 release candidate.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.