manifest create,add,inspect#5843
Conversation
There was a problem hiding this comment.
| case 0, 1: | |
| return errors.New("At least a list image and an image to add must be specified") |
Args: cobra.MinimumNArgs(2) Ensures this case will never be true.
There was a problem hiding this comment.
Given this default, I would change to Args.ExactArgs(2) and remove the switch.
There was a problem hiding this comment.
| if len(args) == 0 { | |
| return errors.New("At least a name must be specified for the list") | |
| } | |
| `` | |
| Args: cobra.MinimumNArgs(1) ensures this is always false. |
There was a problem hiding this comment.
| switch len(args) { | |
| case 0: | |
| return errors.New("At least a source list ID must be specified") | |
| case 1: | |
| if args[0] == "" { | |
| return errors.Errorf(`Invalid image name "%s"`, args[0]) | |
| } | |
| default: | |
| return errors.New("Only one argument is necessary for inspect: an image name") | |
| } |
Args: cobra.ExactArgs(1) will take care of this switch
There was a problem hiding this comment.
| PersistentPreRunE: preRunE, |
As of #5848 this is no longer required.
There was a problem hiding this comment.
Cannot use Printf() in this layer. Need to return data to caller.
There was a problem hiding this comment.
| _, err = alltransports.ParseImageName(fmt.Sprintf("%s%s", dockerPrefix, name)) | |
| _, err = alltransports.ParseImageName(dockerPrefix + name) |
There was a problem hiding this comment.
| fmt.Printf("%s\n", buf) | |
| return buf, nil |
This needs to be returned to caller, not printed at this layer.
There was a problem hiding this comment.
| ManifestCreate(ctx context.Context, names, images []string, opts ManifestCreateOptions) error | |
| ManifestInspect(ctx context.Context, name string) error | |
| ManifestAdd(ctx context.Context, opts ManifestAddOptions) error | |
| ManifestCreate(ctx context.Context, names, images []string, opts ManifestCreateOptions) (<report>, error) | |
| ManifestInspect(ctx context.Context, name string) (<report>, error) | |
| ManifestAdd(ctx context.Context, opts ManifestAddOptions) (<report>, error) |
You cannot present data to user in these functions, needs to be done in the manifest/*.go files.
There was a problem hiding this comment.
You should print out err to help with debugging issues.
There was a problem hiding this comment.
I checked other tests. Integration tests don't log errors in BeforeEach(). Does this need for manifest?
|
☔ The latest upstream changes (presumably #5848) made this pull request unmergeable. Please resolve the merge conflicts. |
3a20523 to
42ba884
Compare
5d1c59d to
768bd6b
Compare
768bd6b to
f5e5801
Compare
|
@jwhonce PTAL |
cc2ff7d to
8880f60
Compare
There was a problem hiding this comment.
Did you mean to have an extra couple of spaces before the last three lines here?
|
A couple of spacing/tab nits, otherwise LGTM |
Implememts manifest subcommands create, add, inspect. Signed-off-by: Qi Wang <qiwan@redhat.com>
8880f60 to
17783dd
Compare
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: QiWang19, rhatdan The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
| flags := addCmd.Flags() | ||
| flags.BoolVar(&manifestAddOpts.All, "all", false, "add all of the list's images if the image is a list") | ||
| flags.StringSliceVar(&manifestAddOpts.Annotation, "annotation", nil, "set an `annotation` for the specified image") | ||
| flags.StringVar(&manifestAddOpts.Arch, "arch", "", "override the `architecture` of the specified image") |
There was a problem hiding this comment.
Need to change libpod/image/manifests.go to support --os, I can fix it in another PR.
|
Buildah also has |
I plan to finish the rest implementation in a different PR. |
|
/lgtm |
Implememts manifest subcommands create, add, inspect.
Signed-off-by: Qi Wang qiwan@redhat.com