mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-02-21 10:01:55 +00:00
Merge pull request #2192 from balena-os/jaomaloy/dump-target-state
Dump target-state to hostOS tmp dir
This commit is contained in:
commit
8262cfac28
@ -43,6 +43,12 @@ import type {
|
||||
CompositionStepT,
|
||||
CompositionStepAction,
|
||||
} 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 {
|
||||
const res = TargetState.decode(state);
|
||||
@ -331,6 +337,11 @@ export async function setTarget(target: TargetState, localSource?: boolean) {
|
||||
|
||||
const localTarget = target[uuid];
|
||||
|
||||
await fsUtils.writeAndSyncFile(
|
||||
TARGET_STATE_CONFIG_DUMP,
|
||||
JSON.stringify(localTarget.config),
|
||||
);
|
||||
|
||||
await usingWriteLockTarget(async () => {
|
||||
await db.transaction(async (trx) => {
|
||||
await config.set({ name: localTarget.name }, trx);
|
||||
|
Loading…
x
Reference in New Issue
Block a user