mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-06-09 11:01:43 +00:00
Allow getting the target state when not in local mode
Change-type: patch Closes: #1176 Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
parent
6bb7a5fd57
commit
3ff3bce605
@ -922,7 +922,9 @@ Response:
|
|||||||
These endpoints are mainly for use by the CLI, for working with a local mode device.
|
These endpoints are mainly for use by the CLI, for working with a local mode device.
|
||||||
As such they are not recommended for general use.
|
As such they are not recommended for general use.
|
||||||
|
|
||||||
The device must be in local mode before these endpoints are called.
|
The device must be in local mode before these endpoints are
|
||||||
|
called, with the exception of `GET /v2/local/target-state`,
|
||||||
|
which can be called when the device is not in local mode.
|
||||||
|
|
||||||
#### Get current target state (GET /v2/local/target-state)
|
#### Get current target state (GET /v2/local/target-state)
|
||||||
|
|
||||||
|
@ -234,14 +234,6 @@ export function createV2Api(router: Router, applications: ApplicationManager) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
router.get('/v2/local/target-state', async (_req, res) => {
|
router.get('/v2/local/target-state', async (_req, res) => {
|
||||||
const localMode = await deviceState.config.get('localMode');
|
|
||||||
if (!localMode) {
|
|
||||||
return res.status(400).json({
|
|
||||||
status: 'failed',
|
|
||||||
message: 'Target state can only be retrieved when in local mode',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const targetState = await deviceState.getTarget();
|
const targetState = await deviceState.getTarget();
|
||||||
|
|
||||||
// We avoid using cloneDeep here, as the class
|
// We avoid using cloneDeep here, as the class
|
||||||
|
Loading…
x
Reference in New Issue
Block a user