Skip to content
This repository was archived by the owner on Feb 16, 2023. It is now read-only.

Commit 6eff871

Browse files
committed
Simplify warning message creation for migration planning
Simplify the logic of creating the warning messages in the migration planning process based on error type.
1 parent c36fbe2 commit 6eff871

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

internals/secrethub/migrate.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ func (cmd *MigratePlanCommand) addDirToPlan(client secrethub.ClientInterface, pa
256256
fmt.Fprintf(cmd.io.Output(), "Planning migration for %s\n", path)
257257

258258
tree, err := client.Dirs().GetTree(path, -1, false)
259-
if err == api.ErrForbidden {
259+
if err == api.ErrForbidden || api.IsErrNotFound(err) {
260260
fmt.Fprintf(os.Stderr, "WARN: Skipping '%s' because you do not have read access. ", path)
261261
accessLevels, err := client.AccessRules().ListLevels(path)
262262
if err == nil {
@@ -272,10 +272,6 @@ func (cmd *MigratePlanCommand) addDirToPlan(client secrethub.ClientInterface, pa
272272
}
273273
return nil
274274
}
275-
if err != nil {
276-
fmt.Fprintf(os.Stderr, "WARN: Skipping '%s' because it is either not valid or you do not have read access. Ask an admin to migrate the skipped secrets if the path is valid.\n", path)
277-
return nil
278-
}
279275

280276
err = addTreeToPlan(tree, plan)
281277
if err != nil {

0 commit comments

Comments
 (0)