mirror of
https://github.com/portainer/portainer.git
synced 2025-08-04 21:35:23 +02:00
fix(stack): fix an issue with stack migration
This commit is contained in:
parent
a5bd2743f3
commit
23b0d6f1dc
4 changed files with 24 additions and 4 deletions
|
@ -9,6 +9,6 @@ angular.module('portainer.app')
|
|||
update: { method: 'PUT', params: { id: '@id' }, ignoreLoadingBar: true },
|
||||
remove: { method: 'DELETE', params: { id: '@id', external: '@external', endpointId: '@endpointId' } },
|
||||
getStackFile: { method: 'GET', params: { id : '@id', action: 'file' } },
|
||||
migrate: { method: 'POST', params: { id : '@id', action: 'migrate' }, ignoreLoadingBar: true }
|
||||
migrate: { method: 'POST', params: { id : '@id', action: 'migrate', endpointId: '@endpointId' }, ignoreLoadingBar: true }
|
||||
});
|
||||
}]);
|
||||
|
|
|
@ -46,7 +46,7 @@ function StackServiceFactory($q, Stack, ResourceControlService, FileUploadServic
|
|||
return;
|
||||
}
|
||||
|
||||
return Stack.migrate({ id: stack.Id }, { EndpointID: targetEndpointId, SwarmID: swarm.Id }).$promise;
|
||||
return Stack.migrate({ id: stack.Id, endpointId: stack.EndpointId }, { EndpointID: targetEndpointId, SwarmID: swarm.Id }).$promise;
|
||||
})
|
||||
.then(function success(data) {
|
||||
deferred.resolve();
|
||||
|
@ -66,7 +66,7 @@ function StackServiceFactory($q, Stack, ResourceControlService, FileUploadServic
|
|||
|
||||
EndpointProvider.setEndpointID(targetEndpointId);
|
||||
|
||||
Stack.migrate({ id: stack.Id }, { EndpointID: targetEndpointId }).$promise
|
||||
Stack.migrate({ id: stack.Id, endpointId: stack.EndpointId }, { EndpointID: targetEndpointId }).$promise
|
||||
.then(function success(data) {
|
||||
deferred.resolve();
|
||||
})
|
||||
|
|
|
@ -54,6 +54,15 @@ function ($q, $scope, $state, $transition$, StackService, NodeService, ServiceSe
|
|||
migrateRequest = StackService.migrateComposeStack;
|
||||
}
|
||||
|
||||
// TODO: this is a work-around for stacks created with Portainer version >= 1.17.1
|
||||
// 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.
|
||||
var endpointId = EndpointProvider.endpointID();
|
||||
if (stack.EndpointId === 0) {
|
||||
stack.EndpointId = endpointId;
|
||||
}
|
||||
|
||||
$scope.state.migrationInProgress = true;
|
||||
migrateRequest(stack, targetEndpointId)
|
||||
.then(function success(data) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue