From a34a1f873b75e07564d74e33e93e5256d05bfbd5 Mon Sep 17 00:00:00 2001 From: Uwe Krueger Date: Wed, 21 Dec 2022 17:27:20 +0100 Subject: [PATCH] fix non-create mode of add components (#230) --- cmds/ocm/commands/ocmcmds/components/add/cmd.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmds/ocm/commands/ocmcmds/components/add/cmd.go b/cmds/ocm/commands/ocmcmds/components/add/cmd.go index b5c74a5e2..feeba7ee6 100644 --- a/cmds/ocm/commands/ocmcmds/components/add/cmd.go +++ b/cmds/ocm/commands/ocmcmds/components/add/cmd.go @@ -189,6 +189,7 @@ func (o *Command) Run() error { if err != nil { return errors.Wrapf(err, "cannot remove old %q", fp) } + o.Create = true } } @@ -196,7 +197,7 @@ func (o *Command) Run() error { if o.Create { repo, err = ctf.Create(o.Context.OCMContext(), accessobj.ACC_CREATE, fp, mode, o.Handler, fs) } else { - repo, err = ctf.Open(o.Context.OCMContext(), accessobj.ACC_CREATE, fp, mode, fs) + repo, err = ctf.Open(o.Context.OCMContext(), accessobj.ACC_WRITABLE, fp, mode, fs) } if err == nil {