fix(swarm/services): avoid sending credSpec object when empty EE-6178 (#10441)

pull/10459/head
matias-portainer 1 year ago committed by GitHub
parent 35dfde70de
commit da5a4d6714
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -475,7 +475,7 @@ angular.module('portainer.docker').controller('ServiceController', [
'';
if (oldCredSpecId && !credSpecId) {
delete config.TaskTemplate.ContainerSpec.Privileges.CredentialSpec;
} else if (oldCredSpecId !== credSpec) {
} else if (credSpec && oldCredSpecId !== credSpec) {
config.TaskTemplate.ContainerSpec.Privileges = {
...(config.TaskTemplate.ContainerSpec.Privileges || {}),
CredentialSpec: {
@ -855,6 +855,10 @@ angular.module('portainer.docker').controller('ServiceController', [
$scope.filterConfigs = filterConfigs;
function filterConfigs(configs) {
if (!configs) {
return [];
}
return configs.filter((config) => $scope.service.ServiceConfigs.every((serviceConfig) => config.Id !== serviceConfig.Id));
}

Loading…
Cancel
Save