fix(stacks): check properly if endpoint id is defined in the stacks object EE-6118 (#10302)

pull/10358/head
matias-portainer 2023-09-21 10:12:43 -03:00 committed by GitHub
parent 2b47b84e5e
commit dfce48cd5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View File

@ -1178,6 +1178,11 @@ class KubernetesCreateApplicationController {
if (this.state.isEdit) {
this.nodesLimits.excludesPods(this.application.Pods, this.formValues.CpuLimit, KubernetesResourceReservationHelper.bytesValue(this.formValues.MemoryLimit));
// Workaround for EE-6118
if (this.stack && !this.stack.EndpointId) {
this.stack.EndpointId = this.endpoint.Id;
}
}
this.oldFormValues = angular.copy(this.formValues);

View File

@ -176,7 +176,7 @@ angular.module('portainer.app').controller('StackController', [
// The EndpointID property is not available for these stacks, we can pass
// the current endpoint identifier as a part of the migrate request. It will be used if
// the EndpointID property is not defined on the stack.
if (stack.EndpointId === 0) {
if (!stack.EndpointId) {
stack.EndpointId = endpoint.Id;
}
@ -248,7 +248,7 @@ angular.module('portainer.app').controller('StackController', [
// The EndpointID property is not available for these stacks, we can pass
// the current endpoint identifier as a part of the update request. It will be used if
// the EndpointID property is not defined on the stack.
if (stack.EndpointId === 0) {
if (!stack.EndpointId) {
stack.EndpointId = endpoint.Id;
}
@ -347,6 +347,11 @@ angular.module('portainer.app').controller('StackController', [
resourcesPromise = stack.Type === 1 ? retrieveSwarmStackResources(stack.Name, agentProxy) : retrieveComposeStackResources(stack.Name);
}
// Workaround for EE-6118
if (!stack.EndpointId) {
stack.EndpointId = endpoint.Id;
}
return $q.all({
stackFile: StackService.getStackFile(id),
resources: resourcesPromise,