mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-06-01 15:20:51 +00:00
Dump target-state to hostOS tmp dir
This change is mainly for the hostOS to know if update locks should be ignored when updating to a newer version. Change-type: patch Signed-off-by: jaomaloy <jao.maloy@balena.io>
This commit is contained in:
parent
1e54d66ffe
commit
ab513cc021
@ -43,6 +43,12 @@ import type {
|
|||||||
CompositionStepT,
|
CompositionStepT,
|
||||||
CompositionStepAction,
|
CompositionStepAction,
|
||||||
} from './compose/composition-steps';
|
} from './compose/composition-steps';
|
||||||
|
import * as fsUtils from './lib/fs-utils';
|
||||||
|
import { pathOnRoot } from './lib/host-utils';
|
||||||
|
|
||||||
|
const TARGET_STATE_CONFIG_DUMP = pathOnRoot(
|
||||||
|
'/tmp/balena-supervisor/target-state-config',
|
||||||
|
);
|
||||||
|
|
||||||
function parseTargetState(state: unknown): TargetState {
|
function parseTargetState(state: unknown): TargetState {
|
||||||
const res = TargetState.decode(state);
|
const res = TargetState.decode(state);
|
||||||
@ -331,6 +337,11 @@ export async function setTarget(target: TargetState, localSource?: boolean) {
|
|||||||
|
|
||||||
const localTarget = target[uuid];
|
const localTarget = target[uuid];
|
||||||
|
|
||||||
|
await fsUtils.writeAndSyncFile(
|
||||||
|
TARGET_STATE_CONFIG_DUMP,
|
||||||
|
JSON.stringify(localTarget.config),
|
||||||
|
);
|
||||||
|
|
||||||
await usingWriteLockTarget(async () => {
|
await usingWriteLockTarget(async () => {
|
||||||
await db.transaction(async (trx) => {
|
await db.transaction(async (trx) => {
|
||||||
await config.set({ name: localTarget.name }, trx);
|
await config.set({ name: localTarget.name }, trx);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user