1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-21 22:39:41 +02:00

feat(dataservices): unify access methods and abstract away redundant code [EE-5628] (#9115)

This commit is contained in:
andres-portainer 2023-06-22 18:28:07 -03:00 committed by GitHub
parent 4c6bbe9a2f
commit 4cc96b4b30
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
171 changed files with 714 additions and 1590 deletions

View file

@ -28,7 +28,7 @@ func (e *StackAuthorMissingErr) Error() string {
func RedeployWhenChanged(stackID portainer.StackID, deployer StackDeployer, datastore dataservices.DataStore, gitService portainer.GitService) error {
log.Debug().Int("stack_id", int(stackID)).Msg("redeploying stack")
stack, err := datastore.Stack().Stack(stackID)
stack, err := datastore.Stack().Read(stackID)
if err != nil {
return errors.WithMessagef(err, "failed to get the stack %v", stackID)
}
@ -116,7 +116,7 @@ func RedeployWhenChanged(stackID portainer.StackID, deployer StackDeployer, data
return errors.Errorf("cannot update stack, type %v is unsupported", stack.Type)
}
if err := datastore.Stack().UpdateStack(stack.ID, stack); err != nil {
if err := datastore.Stack().Update(stack.ID, stack); err != nil {
return errors.WithMessagef(err, "failed to update the stack %v", stack.ID)
}
@ -124,7 +124,7 @@ func RedeployWhenChanged(stackID portainer.StackID, deployer StackDeployer, data
}
func getUserRegistries(datastore dataservices.DataStore, user *portainer.User, endpointID portainer.EndpointID) ([]portainer.Registry, error) {
registries, err := datastore.Registry().Registries()
registries, err := datastore.Registry().ReadAll()
if err != nil {
return nil, errors.WithMessage(err, "unable to retrieve registries from the database")
}