mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-19 05:37:51 +00:00
Fix target state construction with livepush
When constructing the target state after a reported change from livepush, the handler function would not pass all build tasks to the function that constructs the target state, causing a TypeError when trying to obtain the target image name for each service. This updates the handler to pass all build tasks, ensuring the information is available to construct the target state. Relates-to: #2724 Change-type: patch
This commit is contained in:
parent
4b2602676b
commit
8d6a621bfb
@ -627,17 +627,10 @@ export function generateTargetState(
|
||||
};
|
||||
|
||||
opts.environment = _.merge(opts.environment, env[name]);
|
||||
// This function can be called with a subset of the
|
||||
// build tasks, when a single dockerfile has changed
|
||||
// when livepushing, so check the build task exists for
|
||||
// this composition entry (everything else in this
|
||||
// function comes from the composition which doesn't
|
||||
// change)
|
||||
let contract;
|
||||
if (name in keyedBuildTasks) {
|
||||
contract = keyedBuildTasks[name].contract;
|
||||
}
|
||||
|
||||
// This function should always be called with all the build tasks
|
||||
// so we can construct the correct target state so we don't really need
|
||||
// to check that the key exists on the `keyedBuildTasks` object
|
||||
const contract = keyedBuildTasks[name].contract;
|
||||
const task = keyedBuildTasks[name];
|
||||
|
||||
services[idx] = {
|
||||
|
@ -423,7 +423,12 @@ export class LivepushManager {
|
||||
// If we re-apply the target state, the supervisor
|
||||
// should recreate the container
|
||||
await this.api.setTargetState(
|
||||
generateTargetState(currentState, this.composition, [buildTask], {}),
|
||||
generateTargetState(
|
||||
currentState,
|
||||
this.composition,
|
||||
this.buildTasks,
|
||||
{},
|
||||
),
|
||||
);
|
||||
|
||||
await this.awaitDeviceStateSettle();
|
||||
|
Loading…
Reference in New Issue
Block a user