API renderings do not contain fields necessary to construct self-referential URI

Bug #1643552 reported by Gavin Panella
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Fix Released
High
Gavin Panella
2.1
Fix Released
Undecided
Gavin Panella

Bug Description

The following API handlers do not render one or more fields for their
respective object classes that are required in order to render URIs for
instances of their object classes:

        BcacheCacheSetHandler: cache_set_id system_id
       BcacheCacheSetsHandler: system_id
                BcacheHandler: bcache_id system_id
               BcachesHandler: system_id
           BlockDeviceHandler: device_id system_id
          BlockDevicesHandler: system_id
          BootResourceHandler: id
   BootSourceSelectionHandler: boot_source_id
  BootSourceSelectionsHandler: boot_source_id
           DHCPSnippetHandler: dhcp_snippet_id
           DNSResourceHandler: dnsresource_id
     DNSResourceRecordHandler: dnsresourcerecord_id
                DomainHandler: domain_id
                FabricHandler: fabric_id
            FanNetworkHandler: fannetwork_id
               IPRangeHandler: iprange_id
             InterfaceHandler: interface_id system_id
            InterfacesHandler: system_id
               NetworkHandler: name
                  NodeHandler: system_id
     PackageRepositoryHandler: package_repository_id
             PartitionHandler: device_id partition_id system_id
            PartitionsHandler: device_id system_id
                  RaidHandler: raid_id system_id
                 RaidsHandler: system_id
                SSHKeyHandler: keyid
                SSLKeyHandler: keyid
                 SpaceHandler: space_id
           StaticRouteHandler: staticroute_id
                SubnetHandler: subnet_id
                  VlanHandler: fabric_id
                 VlansHandler: fabric_id
           VolumeGroupHandler: system_id volume_group_id
          VolumeGroupsHandler: system_id

For example, DomainHandler's resource URI template is:

  /api/2.0/domains/{domain_id}/

but DomainHandler.fields does not contain `domain_id`. For DomainHandler
the problem is that the template URI should be:

  /api/2.0/domains/{id}/

because a Domain's `id` field _is_ in DomainHandler.fields.

For another example, BootSourceSelectionHandler's URI template is:

  /api/2.0/boot-sources/{boot_source_id}/selections/{id}/

but BootSourceSelectionHandler.fields contains only `id` and not
`boot_source_id`. The latter is an important part of a
BootSourceSelection's identity and relationship to other objects in MAAS
so should be rendered as part of its API representation.

This is proving important to implementation of the new client library
(and would likely be important to any client library).

Tags: api

Related branches

Gavin Panella (allenap)
Changed in maas:
status: Triaged → In Progress
assignee: nobody → Gavin Panella (allenap)
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.