summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2019-01-10 12:15:33 -0600
committerbaude <bbaude@redhat.com>2019-01-11 11:30:28 -0600
commit43c6da22b976b6050f86dca50564a4c2b08caee0 (patch)
treeb8cc80c9e8318ee72031c74a401567a5d5f68392 /libpod
parent28c35cab8750f379a418e87ed6bd874a12ec158d (diff)
downloadpodman-43c6da22b976b6050f86dca50564a4c2b08caee0.tar.gz
podman-43c6da22b976b6050f86dca50564a4c2b08caee0.tar.bz2
podman-43c6da22b976b6050f86dca50564a4c2b08caee0.zip
Add darwin support for remote-client
Add the ability to cross-compile podman remote for OSX. Also, add image exists and tag to remote-client. Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'libpod')
-rw-r--r--libpod/adapter/runtime_remote.go18
-rw-r--r--libpod/container_api.go20
-rw-r--r--libpod/container_attach_linux.go (renamed from libpod/container_attach.go)21
-rw-r--r--libpod/container_attach_unsupported.go11
-rw-r--r--libpod/lock/shm_lock_manager_unsupported.go4
-rw-r--r--libpod/runtime_volume_unsupported.go19
6 files changed, 69 insertions, 24 deletions
diff --git a/libpod/adapter/runtime_remote.go b/libpod/adapter/runtime_remote.go
index 2f22dd36b..0fe5c449a 100644
--- a/libpod/adapter/runtime_remote.go
+++ b/libpod/adapter/runtime_remote.go
@@ -66,6 +66,7 @@ type remoteImage struct {
Names []string
Digest digest.Digest
isParent bool
+ Runtime *LocalRuntime
}
// GetImages returns a slice of containerimages over a varlink connection
@@ -80,7 +81,7 @@ func (r *LocalRuntime) GetImages() ([]*ContainerImage, error) {
if len(i.RepoTags) > 1 {
name = i.RepoTags[0]
}
- newImage, err := imageInListToContainerImage(i, name)
+ newImage, err := imageInListToContainerImage(i, name, r)
if err != nil {
return nil, err
}
@@ -89,7 +90,7 @@ func (r *LocalRuntime) GetImages() ([]*ContainerImage, error) {
return newImages, nil
}
-func imageInListToContainerImage(i iopodman.ImageInList, name string) (*ContainerImage, error) {
+func imageInListToContainerImage(i iopodman.ImageInList, name string, runtime *LocalRuntime) (*ContainerImage, error) {
imageParts, err := image.DecomposeString(name)
if err != nil {
return nil, err
@@ -111,6 +112,7 @@ func imageInListToContainerImage(i iopodman.ImageInList, name string) (*Containe
Repository: imageParts.Registry,
Names: i.RepoTags,
isParent: i.IsParent,
+ Runtime: runtime,
}
return &ContainerImage{ri}, nil
}
@@ -121,7 +123,7 @@ func (r *LocalRuntime) NewImageFromLocal(name string) (*ContainerImage, error) {
if err != nil {
return nil, err
}
- return imageInListToContainerImage(img, name)
+ return imageInListToContainerImage(img, name, r)
}
@@ -173,3 +175,13 @@ func (ci *ContainerImage) Labels(ctx context.Context) (map[string]string, error)
func (ci *ContainerImage) Dangling() bool {
return len(ci.Names()) == 0
}
+
+// TagImage ...
+func (ci *ContainerImage) TagImage(tag string) error {
+ _, err := iopodman.TagImage().Call(ci.Runtime.Conn, ci.ID(), tag)
+ return err
+}
+
+func (r RemoteRuntime) RemoveImage(force bool) error {
+ return nil
+}
diff --git a/libpod/container_api.go b/libpod/container_api.go
index 4eaf737b0..149867759 100644
--- a/libpod/container_api.go
+++ b/libpod/container_api.go
@@ -3,6 +3,7 @@ package libpod
import (
"context"
"fmt"
+ "io"
"io/ioutil"
"os"
"strconv"
@@ -413,6 +414,25 @@ func (c *Container) Exec(tty, privileged bool, env, cmd []string, user, workDir
return waitErr
}
+// AttachStreams contains streams that will be attached to the container
+type AttachStreams struct {
+ // OutputStream will be attached to container's STDOUT
+ OutputStream io.WriteCloser
+ // ErrorStream will be attached to container's STDERR
+ ErrorStream io.WriteCloser
+ // InputStream will be attached to container's STDIN
+ InputStream io.Reader
+ // AttachOutput is whether to attach to STDOUT
+ // If false, stdout will not be attached
+ AttachOutput bool
+ // AttachError is whether to attach to STDERR
+ // If false, stdout will not be attached
+ AttachError bool
+ // AttachInput is whether to attach to STDIN
+ // If false, stdout will not be attached
+ AttachInput bool
+}
+
// Attach attaches to a container
func (c *Container) Attach(streams *AttachStreams, keys string, resize <-chan remotecommand.TerminalSize) error {
if !c.batched {
diff --git a/libpod/container_attach.go b/libpod/container_attach_linux.go
index f925c3897..1d6f0bd96 100644
--- a/libpod/container_attach.go
+++ b/libpod/container_attach_linux.go
@@ -1,3 +1,5 @@
+//+build linux
+
package libpod
import (
@@ -27,25 +29,6 @@ const (
AttachPipeStderr = 3
)
-// AttachStreams contains streams that will be attached to the container
-type AttachStreams struct {
- // OutputStream will be attached to container's STDOUT
- OutputStream io.WriteCloser
- // ErrorStream will be attached to container's STDERR
- ErrorStream io.WriteCloser
- // InputStream will be attached to container's STDIN
- InputStream io.Reader
- // AttachOutput is whether to attach to STDOUT
- // If false, stdout will not be attached
- AttachOutput bool
- // AttachError is whether to attach to STDERR
- // If false, stdout will not be attached
- AttachError bool
- // AttachInput is whether to attach to STDIN
- // If false, stdout will not be attached
- AttachInput bool
-}
-
// Attach to the given container
// Does not check if state is appropriate
func (c *Container) attach(streams *AttachStreams, keys string, resize <-chan remotecommand.TerminalSize, startContainer bool) error {
diff --git a/libpod/container_attach_unsupported.go b/libpod/container_attach_unsupported.go
new file mode 100644
index 000000000..068652b29
--- /dev/null
+++ b/libpod/container_attach_unsupported.go
@@ -0,0 +1,11 @@
+//+build !linux
+
+package libpod
+
+import (
+ "k8s.io/client-go/tools/remotecommand"
+)
+
+func (c *Container) attach(streams *AttachStreams, keys string, resize <-chan remotecommand.TerminalSize, startContainer bool) error {
+ return ErrNotImplemented
+}
diff --git a/libpod/lock/shm_lock_manager_unsupported.go b/libpod/lock/shm_lock_manager_unsupported.go
index a1340fcd1..cbdb2f7bc 100644
--- a/libpod/lock/shm_lock_manager_unsupported.go
+++ b/libpod/lock/shm_lock_manager_unsupported.go
@@ -9,12 +9,12 @@ import "fmt"
type SHMLockManager struct{}
// NewSHMLockManager is not supported on this platform
-func NewSHMLockManager(numLocks uint32) (Manager, error) {
+func NewSHMLockManager(path string, numLocks uint32) (Manager, error) {
return nil, fmt.Errorf("not supported")
}
// OpenSHMLockManager is not supported on this platform
-func OpenSHMLockManager(numLocks uint32) (Manager, error) {
+func OpenSHMLockManager(path string, numLocks uint32) (Manager, error) {
return nil, fmt.Errorf("not supported")
}
diff --git a/libpod/runtime_volume_unsupported.go b/libpod/runtime_volume_unsupported.go
new file mode 100644
index 000000000..d87459759
--- /dev/null
+++ b/libpod/runtime_volume_unsupported.go
@@ -0,0 +1,19 @@
+// +build !linux
+
+package libpod
+
+import (
+ "context"
+)
+
+func (r *Runtime) removeVolume(ctx context.Context, v *Volume, force, prune bool) error {
+ return ErrNotImplemented
+}
+
+func (r *Runtime) newVolume(ctx context.Context, options ...VolumeCreateOption) (*Volume, error) {
+ return nil, ErrNotImplemented
+}
+
+func (r *Runtime) NewVolume(ctx context.Context, options ...VolumeCreateOption) (*Volume, error) {
+ return nil, ErrNotImplemented
+}