boot-source-selections api allows adding bogus and duplicated values

Bug #1360280 reported by Diogo Matsubara
28
This bug affects 3 people
Affects Status Importance Assigned to Milestone
MAAS
Fix Released
High
Julian Edwards

Bug Description

Not sure if this is by design or what are the specific consequences of this but one can add duplicated boot source entries in the MAAS db if one runs the following command multiple times:

maas maas boot-source-selections create 1ed50935-a572-4542-8db5-9be4f6fab764 1 release=utopic labels=daily arches=* subarches=*

and get:

    {
        "labels": [
            "daily"
        ],
        "arches": [
            "*"
        ],
        "subarches": [
            "*"
        ],
        "release": "utopic",
        "id": 5,
        "resource_uri": "/MAAS/api/1.0/nodegroups/1ed50935-a572-4542-8db5-9be4f6fab764/boot-sources/1/selections/5/"
    },
    {
        "labels": [
            "daily"
        ],
        "arches": [
            "*"
        ],
        "subarches": [
            "*"
        ],
        "release": "utopic",
        "id": 6,
        "resource_uri": "/MAAS/api/1.0/nodegroups/1ed50935-a572-4542-8db5-9be4f6fab764/boot-sources/1/selections/6/"
    }

Or if one runs:

maas maas boot-source-selections create 1ed50935-a572-4542-8db5-9be4f6fab764 1

the db ends up with an empty entry like:

    {
        "labels": [],
        "arches": [],
        "subarches": [],
        "release": "",
        "id": 3,
        "resource_uri": "/MAAS/api/1.0/nodegroups/1ed50935-a572-4542-8db5-9be4f6fab764/boot-sources/1/selections/3/"
    },

Tags: boot-images

Related branches

Revision history for this message
Blake Rouse (blake-rouse) wrote :

No it is not by design. It is incorrect.

Changed in maas:
status: New → Triaged
importance: Undecided → Critical
importance: Critical → High
assignee: nobody → Blake Rouse (blake-rouse)
Changed in maas:
milestone: none → 1.7.0
tags: added: boot-images
Revision history for this message
Blake Rouse (blake-rouse) wrote :

This can now use the BootSourceCache to check if the values are correct for the given resource.

Changed in maas:
milestone: 1.7.0 → next
assignee: Blake Rouse (blake-rouse) → nobody
Revision history for this message
Christian Reis (kiko) wrote :

Blake, is this not a dupe of bug 1376812?

Christian Reis (kiko)
Changed in maas:
milestone: next → 1.7.1
Changed in maas:
assignee: nobody → Julian Edwards (julian-edwards)
status: Triaged → In Progress
Changed in maas:
status: In Progress → Fix Committed
Changed in maas:
status: Fix Committed → Fix Released
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.