Instead of passing the values as strings, pass them as ints exactly with a map
of string -> interface{}. This induces a fair amount of overhead to parse
everywhere but still enables us to relatively easily add new keys/resource
types, assuming those types don't need special formatting like the memory does
with units.
Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
Use a more proper error kind for quota conflicts, supporting the error type
*servicestate.QuotaChangeConflictError inside errToResponse and indicating what
sort of change the conflict is being used for.
Also update the unit tests for the daemon error response to check for this.
Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
The CLI has organization where the current and constraint keys are maps of the
unit of measure for the quota group to the value, so update the REST API to
match this.
Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
The exported methods from the servicestate package all return tasksets now,
which is expected to be put into changes that are executed by the overlord
loop. This involves changes in many parts that use quotas, such as the tests,
where a new mock function to create a quota group in state without running any
servicectl commands as well as changes to the client side.
Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
This will be necessary to use when quota handlers no longer directly perform
the operation and instead return a task set.
Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
Merge pull request #10308 from jhenstridge/access-check-daemon-arg
We want to make the theme installation REST API available to selected snaps over the snapd-snap.socket socket. At present, the idea is to control which snaps have access to these calls through a marker interface. That means the access checker will need to be able to check whether a given snap has a connected plug of the marker interface. I've done this by passing the Daemon as an argument to theCheckAccess method.
had to make the comment in wrappers/services_test.go a one-liner
otherwise half of it is lost
last set of files needing changing (as per current master)