LP: #1507712 - cli: maas logout causes KeyError for other profiles
There is a race where when profiles are being deleted, if this happens
between the __iter__ and __getitem__ (of a different invocation of the
cli) which are two different SQL queries, there is an inconsistent view.
So instead use a cache with a consistent view of the data. This
guarantees correct -- if stale behavior in the cli.
Note that this is acceptable because when running two commands at the
same time ordering is unknown and the cache only lives for the lifetime
of a single command.
Backport 0a9d968925552226479a80333240943f3cb504af from master.
LP: #1715634 - Prefetch all node data in the tags API so SQL queries are consistent.
With the nodes, machines, devices, rack_controllers, and region_controllers on the tags endpoint returning the correct objects Piston will convert them into the correct result object which results in large number of queries per node. This prefetches all the required data making the number of queries consistent.
Backport 404d1299a735e57670609f27005f00cad7bc6c28 from master.
Fixes LP: #1711700 - Improve DNS reloading so its happens only when required.
This refactors all the the database triggers that alert all the active regions that DNS needs to be reloaded. The refactor ensures that DNS actually needs to be reloaded by checking to ensure that data was adjusted that requires a reload.
Trigger also now provide a proper message on what caused it to request the reload to be perform. The reload code now looks at the reasons and prints a log message each time it actually performs a reload for the reason it was performed.
LP: #1710681 - Allow architecture to be deselected in the UI.
The UI was preventing architectures from being deselected because removing the architecture meant removing the commissioning series for that architecture. The user is now allowed to deselect an architecture as long as another architecture is selected.
This is a backport of 79247ae722b4abe84154a1305b9be69e6158b490