Skip to content

Commit

Permalink
Module deduplication invalidation, provisioning
Browse files Browse the repository at this point in the history
  • Loading branch information
petergrlica committed Dec 20, 2023
1 parent d3bd801 commit ede0dd1
Show file tree
Hide file tree
Showing 7 changed files with 137 additions and 52 deletions.
8 changes: 8 additions & 0 deletions server/compose/service/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,10 @@ func (svc module) handleUpdate(ctx context.Context, upd *types.Module) moduleUpd
return moduleUnchanged, err
}

if err = validateModuleDedupRules(ctx, upd); err != nil {
return moduleUnchanged, ModuleErrDedupConfigurationInvalidMissingConstraint()
}

if !svc.ac.CanUpdateModule(ctx, res) {
return moduleUnchanged, ModuleErrNotAllowedToUpdate()
}
Expand Down Expand Up @@ -1094,6 +1098,10 @@ func loadModuleLabels(ctx context.Context, s store.Labels, set ...*types.Module)
return nil
}

func validateModuleDedupRules(ctx context.Context, m *types.Module) error {
return m.Config.RecordDeDup.Rules.Validate()
}

// DalModelReload reloads all defined compose modules into the DAL
func DalModelReload(ctx context.Context, s store.Storer, am schemaAltManager, dmm dalModelManager) (err error) {
// Get all available namespaces
Expand Down
84 changes: 34 additions & 50 deletions server/compose/service/module_actions.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions server/compose/service/module_actions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,7 @@ errors:
- error: notAllowedToUndelete
message: "not allowed to undelete this module"
log: "could not undelete {{module}}; insufficient permissions"

- error: dedupConfigurationInvalidMissingConstraint
message: "invalid deduplication configuration - constraint not defined"
log: "missing constraint on deduplication configuration for module"
Loading

0 comments on commit ede0dd1

Please sign in to comment.