MCPcopy Index your code
hub / github.com/kopia/kopia / run

Method run

cli/command_repository_change_password.go:25–50  ·  view source on GitHub ↗
(ctx context.Context, rep repo.DirectRepositoryWriter)

Source from the content-addressed store, hash-verified

23}
24
25func (c *commandRepositoryChangePassword) run(ctx context.Context, rep repo.DirectRepositoryWriter) error {
26 var newPass string
27
28 if c.newPassword == "" {
29 n, err := askForChangedRepositoryPassword(c.svc.stdout())
30 if err != nil {
31 return err
32 }
33
34 newPass = n
35 } else {
36 newPass = c.newPassword
37 }
38
39 if err := rep.FormatManager().ChangePassword(ctx, newPass); err != nil {
40 return errors.Wrap(err, "unable to change password")
41 }
42
43 log(ctx).Infof(`NOTE: Repository password has been changed.`)
44
45 if err := c.svc.passwordPersistenceStrategy().PersistPassword(ctx, c.svc.repositoryConfigFileName(), newPass); err != nil {
46 return errors.Wrap(err, "unable to persist password")
47 }
48
49 return nil
50}

Callers

nothing calls this directly

Calls 7

ChangePasswordMethod · 0.80
stdoutMethod · 0.65
FormatManagerMethod · 0.65
PersistPasswordMethod · 0.65

Tested by

no test coverage detected