Unable to create or use a subcloud group called "patch" but can use (almost) any other value

Bug #1996507 reported by Gustavo Herzmann
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
StarlingX
Fix Released
Low
Gustavo Herzmann

Bug Description

Brief Description
-----------------
Unable to use the command "dcmanager subcloud-group list-subclouds --<name of subcloud group>" if name of the subcloud is patch, index, get, etc.
This is a conflict with how pecan routes the request.

Severity
--------
Minor: System/Feature is usable with minor issue

Steps to Reproduce
------------------
(We create 2 groups. ‘patch’ and ‘foo’)

Steps:

dcmanager subcloud-group add --name patch

--------------------{}{}{}{}------------------------+
Field Value

--------------------{}{}{}{}------------------------+
id 2
name patch
description No description provided
update apply type parallel
max parallel subclouds 2
created_at 2022-09-16 19:34:27.526813
updated_at None

--------------------{}{}{}{}------------------------+

dcmanager subcloud-group add --name foo

--------------------{}{}{}{}------------------------+
Field Value

--------------------{}{}{}{}------------------------+
id 3
name foo
description No description provided
update apply type parallel
max parallel subclouds 2
created_at 2022-09-16 20:43:57.607121
updated_at None

--------------------{}{}{}{}------------------------+

dcmanager subcloud-group list

{}{}{}{}-{}{}{}++{}{}{}---------------------
id name description

{}{}{}{}-{}{}{}++{}{}{}---------------------
  1 Default Default Subcloud Group
  2 patch No description provided
  3 foo No description provided

{}{}{}{}-{}{}{}++{}{}{}---------------------

dcmanager subcloud-group list-subclouds patch

ERROR (app) 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>'

dcmanager subcloud-group list-subclouds foo

----{}{}{}{}{}{}{}{}{}{}{}-----{}{}{}{}{}{}--{}{}{}{}{}{}{}----------{}{}{}{}{}{}----{}{}{}{}{}{}{}------{}{}{}{}{}{}-------{}{}{}{}{}{}{}-----------{}{}{}{}{}{}-------------{}{}{}{}{}{}{}-----------{}{}{}{}{}{}---------------{}{}{}{}{}{}{}---------------------{}{}{}{}{}{}--{}{}{}{}{}{}{}----{}{}{}{}{}{}--------{+}
id name description location software_version management availability deploy_status management_subnet management_start_ip management_end_ip management_gateway_ip systemcontroller_gateway_ip group_id created_at updated_at

----{}{}{}{}{}{}{}{}{}{}{}-----{}{}{}{}{}{}--{}{}{}{}{}{}{}----------{}{}{}{}{}{}----{}{}{}{}{}{}{}------{}{}{}{}{}{}-------{}{}{}{}{}{}{}-----------{}{}{}{}{}{}-------------{}{}{}{}{}{}{}-----------{}{}{}{}{}{}---------------{}{}{}{}{}{}{}---------------------{}{}{}{}{}{}--{}{}{}{}{}{}{}----{}{}{}{}{}{}--------{+}
<none> <none> <none> <none> <none> <none> <none> <none> <none> <none> <none> <none> <none> <none> <none> <none>

----{}{}{}{}{}{}{}{}{}{}{}-----{}{}{}{}{}{}--{}{}{}{}{}{}{}----------{}{}{}{}{}{}----{}{}{}{}{}{}{}------{}{}{}{}{}{}-------{}{}{}{}{}{}{}-----------{}{}{}{}{}{}-------------{}{}{}{}{}{}{}-----------{}{}{}{}{}{}---------------{}{}{}{}{}{}{}---------------------{}{}{}{}{}{}--{}{}{}{}{}{}{}----{}{}{}{}{}{}--------{+}

Expected Behavior
------------------
The information about the patch group should be returned correctly.

Actual Behavior
----------------
Command fails stating that the resource could not be found.

Reproducibility
---------------
Reproducible

System Configuration
--------------------
Distributed Cloud

Branch/Pull Time/Commit
-----------------------
Various builds: confirmed on 21.12 and latest Debian build (22.12 dev)

Last Pass
---------
Not sure, probably a new test scenario.

Workaround
----------
No workaround besides not using those specific names.

Changed in starlingx:
assignee: nobody → Gustavo Herzmann (gherzman)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to distcloud (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/starlingx/distcloud/+/864414

Changed in starlingx:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to distcloud (master)

Reviewed: https://review.opendev.org/c/starlingx/distcloud/+/864414
Committed: https://opendev.org/starlingx/distcloud/commit/00f5a5361151b279dea7a932f74afb1465483800
Submitter: "Zuul (22348)"
Branch: master

commit 00f5a5361151b279dea7a932f74afb1465483800
Author: Gustavo Herzmann <email address hidden>
Date: Mon Nov 14 11:05:52 2022 -0300

    Fix subcloud-group endpoint routing conflict

    Pecan default routing algorithm fails to find the requested resource
    when the requested URL contains keywords that match the name of any
    method declared inside of a pecan controller decorated with the
    @expose(generic=True, ...) or @index.when() decorators.

    This commit implements a custom routing through the use of pecan's
    _route() method, where the routing is redirected to the generic index
    method, allowing the keywords to be correctly passed as arguments to
    the correct method handler based on the request method (GET, POST,
    PATCH, DELETE, etc.).

    Test plan:
    PASS: Execute all of the subcloud-group sub-commands (add, delete, list,
    list-subclouds, show and update) with the following group names: get,
    post, patch, delete, index, _validate_name, _route and foo.

    Closes-Bug: #1996507

    Signed-off-by: Gustavo Herzmann <email address hidden>
    Change-Id: I98a22f2bf1da205b68ee4199fb339776dd3d8dde

Changed in starlingx:
status: In Progress → Fix Released
Ghada Khalil (gkhalil)
Changed in starlingx:
importance: Undecided → Low
tags: added: stx.8.0 stx.distcloud
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.