multi-value attributes in declarations are not properly validated

Bug #1981637 reported by Emilia Torino
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
review-tools
Fix Released
Undecided
Emilia Torino

Bug Description

Given a snap.yaml that contains multiple values in attributes, such as:

fram-devices:
  interface: custom-device
  devices:
  - /dev/mtd[0-9]
  - /dev/chunkfs/chunkfs[0-2]
  read-devices:
  - /dev/chunkfs/geom
  - /dev/chunkfs/stats
  - /dev/chunkfs/sizes

And a declaration which supports this definition:

"custom-device": {
 "allow-installation": [
      {
        "on-store": [
          "honeywell-international-inc"
        ],
        "slot-attributes": {
          "devices": [
            "/dev/mtd\\[0-9\\]",
            "/dev/chunkfs/chunkfs\\[0-2\\]"
          ],
          "read-devices": [
            "/dev/chunkfs/geom",
            "/dev/chunkfs/stats",
            "/dev/chunkfs/sizes"
          ]
        },
        "slot-names": [
          "fram-devices"
        ]
      }
    ]
}

review-tools fails to review with the following error:
declaration-snap-v2:slots_installation:fram-devices:custom-device
    human review required due to 'allow-installation' constraint (slot-names)

Related branches

Revision history for this message
Alex Murray (alexmurray) wrote :

I think this is expected - the snap declaration should use regex's for matching these attributes - something like the following I think (off the top of my head, this is untested):

"custom-device": {
 "allow-installation": [
      {
        "on-store": [
          "honeywell-international-inc"
        ],
        "slot-attributes": {
          "devices": "/dev/(mtd\\[0-9\\]|chunkfs/chunkfs\\[0-2\\])",
          "read-devices": "/dev/chunkfs/(geom|stats|sizes)"
        },
        "slot-names": [
          "fram-devices"
        ]
      }
    ]
}

Changed in review-tools:
assignee: nobody → Emilia Torino (emitorino)
status: New → In Progress
Changed in review-tools:
status: In Progress → Fix Committed
Changed in review-tools:
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.