Skip to content

Commit

Permalink
Merge pull request #3888 from jwhonce/wip/api
Browse files Browse the repository at this point in the history
Update varlink doc and code for images
  • Loading branch information
openshift-merge-robot authored Aug 27, 2019
2 parents cec354a + 02cda40 commit f221c61
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
2 changes: 2 additions & 0 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -1361,6 +1361,8 @@ pids [int](https://godoc.org/builtin#int)
### <a name="Create"></a>type Create

Create is an input structure for creating containers.
args[0] is the image name or id
args[1-] are the new commands if changed

args [[]string](#[]string)

Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/shared/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func CreateContainer(ctx context.Context, c *GenericCLIResults, runtime *libpod.
if len(c.InputArgs) != 0 {
name = c.InputArgs[0]
} else {
return nil, nil, errors.Errorf("error, no input arguments were provided")
return nil, nil, errors.Errorf("error, image name not provided")
}

pullType, err := util.ValidatePullType(c.String("pull"))
Expand Down
4 changes: 3 additions & 1 deletion cmd/podman/varlink/io.podman.varlink
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,8 @@ type Sockets(
)

# Create is an input structure for creating containers.
# args[0] is the image name or id
# args[1-] are the new commands if changed
type Create (
args: []string,
addHost: ?[]string,
Expand Down Expand Up @@ -1281,4 +1283,4 @@ error WantsMoreRequired (reason: string)
error ErrCtrStopped (id: string)

# This function requires CGroupsV2 to run in rootless mode.
error ErrRequiresCgroupsV2ForRootless(reason: string)
error ErrRequiresCgroupsV2ForRootless(reason: string)
15 changes: 11 additions & 4 deletions pkg/varlinkapi/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ func (i *LibpodAPI) PushImage(call iopodman.VarlinkCall, name, tag string, compr
dockerRegistryOptions := image.DockerRegistryOptions{}
if format != "" {
switch format {
case "oci": //nolint
case "oci": // nolint
manifestType = v1.MediaTypeImageManifest
case "v2s1":
manifestType = manifest.DockerV2Schema1SignedMediaType
Expand All @@ -360,7 +360,12 @@ func (i *LibpodAPI) PushImage(call iopodman.VarlinkCall, name, tag string, compr
output := bytes.NewBuffer([]byte{})
c := make(chan error)
go func() {
err := newImage.PushImageToHeuristicDestination(getContext(), destname, manifestType, "", "", "", output, compress, so, &dockerRegistryOptions, nil)
writer := bytes.NewBuffer([]byte{})
err := newImage.PushImageToHeuristicDestination(getContext(), destname, manifestType, "", "", "", writer, compress, so, &dockerRegistryOptions, nil)
if err != nil {
c <- err
}
_, err = io.CopyBuffer(output, writer, nil)
c <- err
close(c)
}()
Expand Down Expand Up @@ -388,6 +393,7 @@ func (i *LibpodAPI) PushImage(call iopodman.VarlinkCall, name, tag string, compr
}
br := iopodman.MoreResponse{
Logs: log,
Id: newImage.ID(),
}
call.ReplyPushImage(br)
log = []string{}
Expand All @@ -403,6 +409,7 @@ func (i *LibpodAPI) PushImage(call iopodman.VarlinkCall, name, tag string, compr

br := iopodman.MoreResponse{
Logs: log,
Id: newImage.ID(),
}
return call.ReplyPushImage(br)
}
Expand Down Expand Up @@ -530,7 +537,7 @@ func (i *LibpodAPI) Commit(call iopodman.VarlinkCall, name, imageName string, ch
}
sc := image.GetSystemContext(rtc.SignaturePolicyPath, "", false)
switch manifestType {
case "oci", "": //nolint
case "oci", "": // nolint
mimeType = buildah.OCIv1ImageManifest
case "docker":
mimeType = manifest.DockerV2Schema2MediaType
Expand Down Expand Up @@ -821,7 +828,7 @@ func (i *LibpodAPI) ImageSave(call iopodman.VarlinkCall, options iopodman.ImageS
// Image has been saved to `output`
if outputToDir {
// If the output is a directory, we need to tar up the directory to send it back
//Create a tempfile for the directory tarball
// Create a tempfile for the directory tarball
outputFile, err := ioutil.TempFile("", "varlink_save_dir")
if err != nil {
return err
Expand Down

0 comments on commit f221c61

Please sign in to comment.