mirror of https://github.com/containers/podman.git
Rename varlink socket and interface
io.projectatomic.podman -> io.podman Signed-off-by: baude <bbaude@redhat.com> Closes: #1204 Approved by: mheon
This commit is contained in:
parent
ee89bc46eb
commit
bd9d3a8fa5
20
API.md
20
API.md
|
@ -1,4 +1,4 @@
|
||||||
# io.projectatomic.podman
|
# io.podman
|
||||||
Podman Service Interface and API description. The master version of this document can be found
|
Podman Service Interface and API description. The master version of this document can be found
|
||||||
in the [API.md](https://github.com/projectatomic/libpod/blob/master/API.md) file in the upstream libpod repository.
|
in the [API.md](https://github.com/projectatomic/libpod/blob/master/API.md) file in the upstream libpod repository.
|
||||||
## Index
|
## Index
|
||||||
|
@ -174,7 +174,7 @@ input required for CreateContainer is an image name. If the image name is not f
|
||||||
error will be returned. Otherwise, the ID of the newly created container will be returned.
|
error will be returned. Otherwise, the ID of the newly created container will be returned.
|
||||||
#### Example
|
#### Example
|
||||||
~~~
|
~~~
|
||||||
$ varlink call unix:/run/podman/io.projectatomic.podman/io.projectatomic.podman.CreateContainer '{"create": {"image": "alpine"}}'
|
$ varlink call unix:/run/podman/io.podman/io.podman.CreateContainer '{"create": {"image": "alpine"}}'
|
||||||
{
|
{
|
||||||
"container": "8759dafbc0a4dc3bcfb57eeb72e4331eb73c5cc09ab968e65ce45b9ad5c4b6bb"
|
"container": "8759dafbc0a4dc3bcfb57eeb72e4331eb73c5cc09ab968e65ce45b9ad5c4b6bb"
|
||||||
}
|
}
|
||||||
|
@ -223,7 +223,7 @@ second is a "control" socket where things like resizing the TTY events are sent.
|
||||||
found, a [ContainerNotFound](#ContainerNotFound) error will be returned.
|
found, a [ContainerNotFound](#ContainerNotFound) error will be returned.
|
||||||
#### Example
|
#### Example
|
||||||
~~~
|
~~~
|
||||||
$ varlink call -m unix:/run/io.projectatomic.podman/io.projectatomic.podman.GetAttachSockets '{"name": "b7624e775431219161"}'
|
$ varlink call -m unix:/run/io.podman/io.podman.GetAttachSockets '{"name": "b7624e775431219161"}'
|
||||||
{
|
{
|
||||||
"sockets": {
|
"sockets": {
|
||||||
"container_id": "b7624e7754312191613245ce1a46844abee60025818fe3c3f3203435623a1eca",
|
"container_id": "b7624e7754312191613245ce1a46844abee60025818fe3c3f3203435623a1eca",
|
||||||
|
@ -256,7 +256,7 @@ contains attributes like memory and cpu usage. If the container cannot be found
|
||||||
[ContainerNotFound](#ContainerNotFound) error will be returned.
|
[ContainerNotFound](#ContainerNotFound) error will be returned.
|
||||||
#### Example
|
#### Example
|
||||||
~~~
|
~~~
|
||||||
$ varlink call -m unix:/run/podman/io.projectatomic.podman/io.projectatomic.podman.GetContainerStats '{"name": "c33e4164f384"}'
|
$ varlink call -m unix:/run/podman/io.podman/io.podman.GetContainerStats '{"name": "c33e4164f384"}'
|
||||||
{
|
{
|
||||||
"container": {
|
"container": {
|
||||||
"block_input": 0,
|
"block_input": 0,
|
||||||
|
@ -344,7 +344,7 @@ arguments that represent ps options. If the container cannot be found, a [Conta
|
||||||
error will be returned.
|
error will be returned.
|
||||||
#### Example
|
#### Example
|
||||||
~~~
|
~~~
|
||||||
$ varlink call -m unix:/run/podman/io.projectatomic.podman/io.projectatomic.podman.ListContainerProcesses '{"name": "135d71b9495f", "opts": []}'
|
$ varlink call -m unix:/run/podman/io.podman/io.podman.ListContainerProcesses '{"name": "135d71b9495f", "opts": []}'
|
||||||
{
|
{
|
||||||
"container": [
|
"container": [
|
||||||
" UID PID PPID C STIME TTY TIME CMD",
|
" UID PID PPID C STIME TTY TIME CMD",
|
||||||
|
@ -380,7 +380,7 @@ method Ping() [StringResponse](#StringResponse)</div>
|
||||||
Ping provides a response for developers to ensure their varlink setup is working.
|
Ping provides a response for developers to ensure their varlink setup is working.
|
||||||
#### Example
|
#### Example
|
||||||
~~~
|
~~~
|
||||||
$ varlink call -m unix:/run/podman/io.projectatomic.podman/io.projectatomic.podman.Ping
|
$ varlink call -m unix:/run/podman/io.podman/io.podman.Ping
|
||||||
{
|
{
|
||||||
"ping": {
|
"ping": {
|
||||||
"message": "OK"
|
"message": "OK"
|
||||||
|
@ -395,7 +395,7 @@ PullImage pulls an image from a repository to local storage. After the pull is
|
||||||
is returned.
|
is returned.
|
||||||
#### Example
|
#### Example
|
||||||
~~~
|
~~~
|
||||||
$ varlink call -m unix:/run/podman/io.projectatomic.podman/io.projectatomic.podman.PullImage '{"name": "registry.fedoraproject.org/fedora"}'
|
$ varlink call -m unix:/run/podman/io.podman/io.podman.PullImage '{"name": "registry.fedoraproject.org/fedora"}'
|
||||||
{
|
{
|
||||||
"id": "426866d6fa419873f97e5cbd320eeb22778244c1dfffa01c944db3114f55772e"
|
"id": "426866d6fa419873f97e5cbd320eeb22778244c1dfffa01c944db3114f55772e"
|
||||||
}
|
}
|
||||||
|
@ -416,7 +416,7 @@ container can be stopped and removed. Upon successful removal of the container,
|
||||||
container cannot be found by name or ID, a [ContainerNotFound](#ContainerNotFound) error will be returned.
|
container cannot be found by name or ID, a [ContainerNotFound](#ContainerNotFound) error will be returned.
|
||||||
#### Example
|
#### Example
|
||||||
~~~
|
~~~
|
||||||
$ varlink call -m unix:/run/podman/io.projectatomic.podman/io.projectatomic.podman.RemoveContainer '{"name": "62f4fd98cb57"}'
|
$ varlink call -m unix:/run/podman/io.podman/io.podman.RemoveContainer '{"name": "62f4fd98cb57"}'
|
||||||
{
|
{
|
||||||
"container": "62f4fd98cb57f529831e8f90610e54bba74bd6f02920ffb485e15376ed365c20"
|
"container": "62f4fd98cb57f529831e8f90610e54bba74bd6f02920ffb485e15376ed365c20"
|
||||||
}
|
}
|
||||||
|
@ -430,7 +430,7 @@ should be deleted. If the image cannot be found, an [ImageNotFound](#ImageNotFo
|
||||||
ID of the removed image is returned when complete. See also [DeleteUnusedImages](DeleteUnusedImages).
|
ID of the removed image is returned when complete. See also [DeleteUnusedImages](DeleteUnusedImages).
|
||||||
#### Example
|
#### Example
|
||||||
~~~
|
~~~
|
||||||
varlink call -m unix:/run/podman/io.projectatomic.podman/io.projectatomic.podman.RemoveImage '{"name": "registry.fedoraproject.org/fedora", "force": true}'
|
varlink call -m unix:/run/podman/io.podman/io.podman.RemoveImage '{"name": "registry.fedoraproject.org/fedora", "force": true}'
|
||||||
{
|
{
|
||||||
"image": "426866d6fa419873f97e5cbd320eeb22778244c1dfffa01c944db3114f55772e"
|
"image": "426866d6fa419873f97e5cbd320eeb22778244c1dfffa01c944db3114f55772e"
|
||||||
}
|
}
|
||||||
|
@ -477,7 +477,7 @@ returns the container ID once stopped. If the container cannot be found, a [Cont
|
||||||
error will be returned instead. See also [KillContainer](KillContainer).
|
error will be returned instead. See also [KillContainer](KillContainer).
|
||||||
#### Error
|
#### Error
|
||||||
~~~
|
~~~
|
||||||
$ varlink call -m unix:/run/podman/io.projectatomic.podman/io.projectatomic.podman.StopContainer '{"name": "135d71b9495f", "timeout": 5}'
|
$ varlink call -m unix:/run/podman/io.podman/io.podman.StopContainer '{"name": "135d71b9495f", "timeout": 5}'
|
||||||
{
|
{
|
||||||
"container": "135d71b9495f7c3967f536edad57750bfdb569336cd107d8aabab45565ffcfb6"
|
"container": "135d71b9495f7c3967f536edad57750bfdb569336cd107d8aabab45565ffcfb6"
|
||||||
}
|
}
|
||||||
|
|
14
Makefile
14
Makefile
|
@ -20,7 +20,7 @@ SYSTEMDDIR ?= ${PREFIX}/lib/systemd/system
|
||||||
BUILDTAGS ?= seccomp $(shell hack/btrfs_tag.sh) $(shell hack/libdm_tag.sh) $(shell hack/btrfs_installed_tag.sh) $(shell hack/ostree_tag.sh) $(shell hack/selinux_tag.sh) $(shell hack/apparmor_tag.sh) varlink
|
BUILDTAGS ?= seccomp $(shell hack/btrfs_tag.sh) $(shell hack/libdm_tag.sh) $(shell hack/btrfs_installed_tag.sh) $(shell hack/ostree_tag.sh) $(shell hack/selinux_tag.sh) $(shell hack/apparmor_tag.sh) varlink
|
||||||
BUILDTAGS_CROSS ?= containers_image_openpgp containers_image_ostree_stub exclude_graphdriver_btrfs exclude_graphdriver_devicemapper exclude_graphdriver_overlay
|
BUILDTAGS_CROSS ?= containers_image_openpgp containers_image_ostree_stub exclude_graphdriver_btrfs exclude_graphdriver_devicemapper exclude_graphdriver_overlay
|
||||||
ifneq (,$(findstring varlink,$(BUILDTAGS)))
|
ifneq (,$(findstring varlink,$(BUILDTAGS)))
|
||||||
PODMAN_VARLINK_DEPENDENCIES = cmd/podman/varlink/ioprojectatomicpodman.go
|
PODMAN_VARLINK_DEPENDENCIES = cmd/podman/varlink/iopodman.go
|
||||||
endif
|
endif
|
||||||
|
|
||||||
PYTHON ?= /usr/bin/python3
|
PYTHON ?= /usr/bin/python3
|
||||||
|
@ -131,7 +131,7 @@ clean:
|
||||||
test/checkseccomp/checkseccomp \
|
test/checkseccomp/checkseccomp \
|
||||||
test/copyimg/copyimg \
|
test/copyimg/copyimg \
|
||||||
test/testdata/redis-image \
|
test/testdata/redis-image \
|
||||||
cmd/podman/varlink/ioprojectatomicpodman.go \
|
cmd/podman/varlink/iopodman.go \
|
||||||
$(MANPAGES) ||:
|
$(MANPAGES) ||:
|
||||||
ifdef HAS_PYTHON3
|
ifdef HAS_PYTHON3
|
||||||
$(MAKE) -C contrib/python/podman clean
|
$(MAKE) -C contrib/python/podman clean
|
||||||
|
@ -235,8 +235,8 @@ install.docker: docker-docs
|
||||||
install ${SELINUXOPT} -m 644 docs/docker*.1 -t $(MANDIR)/man1
|
install ${SELINUXOPT} -m 644 docs/docker*.1 -t $(MANDIR)/man1
|
||||||
|
|
||||||
install.systemd:
|
install.systemd:
|
||||||
install ${SELINUXOPT} -m 644 -D contrib/varlink/io.projectatomic.podman.socket ${SYSTEMDDIR}/io.projectatomic.podman.socket
|
install ${SELINUXOPT} -m 644 -D contrib/varlink/io.podman.socket ${SYSTEMDDIR}/io.podman.socket
|
||||||
install ${SELINUXOPT} -m 644 -D contrib/varlink/io.projectatomic.podman.service ${SYSTEMDDIR}/io.projectatomic.podman.service
|
install ${SELINUXOPT} -m 644 -D contrib/varlink/io.podman.service ${SYSTEMDDIR}/io.podman.service
|
||||||
install ${SELINUXOPT} -m 644 -D contrib/varlink/podman.conf ${TMPFILESDIR}/podman.conf
|
install ${SELINUXOPT} -m 644 -D contrib/varlink/podman.conf ${TMPFILESDIR}/podman.conf
|
||||||
|
|
||||||
install.python:
|
install.python:
|
||||||
|
@ -288,7 +288,7 @@ install.tools: .install.gitvalidation .install.gometalinter .install.md2man
|
||||||
make all install; \
|
make all install; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
varlink_generate: .gopathok cmd/podman/varlink/ioprojectatomicpodman.go
|
varlink_generate: .gopathok cmd/podman/varlink/iopodman.go
|
||||||
varlink_api_generate: .gopathok API.md
|
varlink_api_generate: .gopathok API.md
|
||||||
|
|
||||||
.PHONY: install.libseccomp.sudo
|
.PHONY: install.libseccomp.sudo
|
||||||
|
@ -298,10 +298,10 @@ install.libseccomp.sudo:
|
||||||
cd ../../seccomp/libseccomp && git checkout $(LIBSECCOMP_COMMIT) && ./autogen.sh && ./configure --prefix=/usr && make all && make install
|
cd ../../seccomp/libseccomp && git checkout $(LIBSECCOMP_COMMIT) && ./autogen.sh && ./configure --prefix=/usr && make all && make install
|
||||||
|
|
||||||
|
|
||||||
cmd/podman/varlink/ioprojectatomicpodman.go: cmd/podman/varlink/io.projectatomic.podman.varlink
|
cmd/podman/varlink/iopodman.go: cmd/podman/varlink/io.podman.varlink
|
||||||
$(GO) generate ./cmd/podman/varlink/...
|
$(GO) generate ./cmd/podman/varlink/...
|
||||||
|
|
||||||
API.md: cmd/podman/varlink/io.projectatomic.podman.varlink
|
API.md: cmd/podman/varlink/io.podman.varlink
|
||||||
$(GO) generate ./docs/...
|
$(GO) generate ./docs/...
|
||||||
|
|
||||||
validate: gofmt .gitvalidation
|
validate: gofmt .gitvalidation
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/projectatomic/libpod/cmd/podman/libpodruntime"
|
"github.com/projectatomic/libpod/cmd/podman/libpodruntime"
|
||||||
ioprojectatomicpodman "github.com/projectatomic/libpod/cmd/podman/varlink"
|
iopodman "github.com/projectatomic/libpod/cmd/podman/varlink"
|
||||||
"github.com/projectatomic/libpod/pkg/varlinkapi"
|
"github.com/projectatomic/libpod/pkg/varlinkapi"
|
||||||
"github.com/projectatomic/libpod/version"
|
"github.com/projectatomic/libpod/version"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
@ -52,7 +52,7 @@ func varlinkCmd(c *cli.Context) error {
|
||||||
}
|
}
|
||||||
defer runtime.Shutdown(false)
|
defer runtime.Shutdown(false)
|
||||||
|
|
||||||
var varlinkInterfaces = []*ioprojectatomicpodman.VarlinkInterface{varlinkapi.New(c, runtime)}
|
var varlinkInterfaces = []*iopodman.VarlinkInterface{varlinkapi.New(c, runtime)}
|
||||||
// Register varlink service. The metadata can be retrieved with:
|
// Register varlink service. The metadata can be retrieved with:
|
||||||
// $ varlink info [varlink address URI]
|
// $ varlink info [varlink address URI]
|
||||||
service, err := varlink.NewService(
|
service, err := varlink.NewService(
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
package ioprojectatomicpodman
|
package iopodman
|
||||||
|
|
||||||
//go:generate go run ../../../vendor/github.com/varlink/go/cmd/varlink-go-interface-generator/main.go io.projectatomic.podman.varlink
|
//go:generate go run ../../../vendor/github.com/varlink/go/cmd/varlink-go-interface-generator/main.go io.podman.varlink
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Podman Service Interface and API description. The master version of this document can be found
|
# Podman Service Interface and API description. The master version of this document can be found
|
||||||
# in the [API.md](https://github.com/projectatomic/libpod/blob/master/API.md) file in the upstream libpod repository.
|
# in the [API.md](https://github.com/projectatomic/libpod/blob/master/API.md) file in the upstream libpod repository.
|
||||||
interface io.projectatomic.podman
|
interface io.podman
|
||||||
|
|
||||||
|
|
||||||
# Version is the structure returned by GetVersion
|
# Version is the structure returned by GetVersion
|
||||||
|
@ -329,7 +329,7 @@ type BuildResponse (
|
||||||
# Ping provides a response for developers to ensure their varlink setup is working.
|
# Ping provides a response for developers to ensure their varlink setup is working.
|
||||||
# #### Example
|
# #### Example
|
||||||
# ~~~
|
# ~~~
|
||||||
# $ varlink call -m unix:/run/podman/io.projectatomic.podman/io.projectatomic.podman.Ping
|
# $ varlink call -m unix:/run/podman/io.podman/io.podman.Ping
|
||||||
# {
|
# {
|
||||||
# "ping": {
|
# "ping": {
|
||||||
# "message": "OK"
|
# "message": "OK"
|
||||||
|
@ -360,7 +360,7 @@ method GetContainer(name: string) -> (container: ListContainerData)
|
||||||
# error will be returned. Otherwise, the ID of the newly created container will be returned.
|
# error will be returned. Otherwise, the ID of the newly created container will be returned.
|
||||||
# #### Example
|
# #### Example
|
||||||
# ~~~
|
# ~~~
|
||||||
# $ varlink call unix:/run/podman/io.projectatomic.podman/io.projectatomic.podman.CreateContainer '{"create": {"image": "alpine"}}'
|
# $ varlink call unix:/run/podman/io.podman/io.podman.CreateContainer '{"create": {"image": "alpine"}}'
|
||||||
# {
|
# {
|
||||||
# "container": "8759dafbc0a4dc3bcfb57eeb72e4331eb73c5cc09ab968e65ce45b9ad5c4b6bb"
|
# "container": "8759dafbc0a4dc3bcfb57eeb72e4331eb73c5cc09ab968e65ce45b9ad5c4b6bb"
|
||||||
# }
|
# }
|
||||||
|
@ -378,7 +378,7 @@ method InspectContainer(name: string) -> (container: string)
|
||||||
# error will be returned.
|
# error will be returned.
|
||||||
# #### Example
|
# #### Example
|
||||||
# ~~~
|
# ~~~
|
||||||
# $ varlink call -m unix:/run/podman/io.projectatomic.podman/io.projectatomic.podman.ListContainerProcesses '{"name": "135d71b9495f", "opts": []}'
|
# $ varlink call -m unix:/run/podman/io.podman/io.podman.ListContainerProcesses '{"name": "135d71b9495f", "opts": []}'
|
||||||
# {
|
# {
|
||||||
# "container": [
|
# "container": [
|
||||||
# " UID PID PPID C STIME TTY TIME CMD",
|
# " UID PID PPID C STIME TTY TIME CMD",
|
||||||
|
@ -412,7 +412,7 @@ method ExportContainer(name: string, path: string) -> (tarfile: string)
|
||||||
# [ContainerNotFound](#ContainerNotFound) error will be returned.
|
# [ContainerNotFound](#ContainerNotFound) error will be returned.
|
||||||
# #### Example
|
# #### Example
|
||||||
# ~~~
|
# ~~~
|
||||||
# $ varlink call -m unix:/run/podman/io.projectatomic.podman/io.projectatomic.podman.GetContainerStats '{"name": "c33e4164f384"}'
|
# $ varlink call -m unix:/run/podman/io.podman/io.podman.GetContainerStats '{"name": "c33e4164f384"}'
|
||||||
# {
|
# {
|
||||||
# "container": {
|
# "container": {
|
||||||
# "block_input": 0,
|
# "block_input": 0,
|
||||||
|
@ -447,7 +447,7 @@ method StartContainer(name: string) -> (container: string)
|
||||||
# error will be returned instead. See also [KillContainer](KillContainer).
|
# error will be returned instead. See also [KillContainer](KillContainer).
|
||||||
# #### Error
|
# #### Error
|
||||||
# ~~~
|
# ~~~
|
||||||
# $ varlink call -m unix:/run/podman/io.projectatomic.podman/io.projectatomic.podman.StopContainer '{"name": "135d71b9495f", "timeout": 5}'
|
# $ varlink call -m unix:/run/podman/io.podman/io.podman.StopContainer '{"name": "135d71b9495f", "timeout": 5}'
|
||||||
# {
|
# {
|
||||||
# "container": "135d71b9495f7c3967f536edad57750bfdb569336cd107d8aabab45565ffcfb6"
|
# "container": "135d71b9495f7c3967f536edad57750bfdb569336cd107d8aabab45565ffcfb6"
|
||||||
# }
|
# }
|
||||||
|
@ -490,7 +490,7 @@ method AttachToContainer() -> (notimplemented: NotImplemented)
|
||||||
# found, a [ContainerNotFound](#ContainerNotFound) error will be returned.
|
# found, a [ContainerNotFound](#ContainerNotFound) error will be returned.
|
||||||
# #### Example
|
# #### Example
|
||||||
# ~~~
|
# ~~~
|
||||||
# $ varlink call -m unix:/run/io.projectatomic.podman/io.projectatomic.podman.GetAttachSockets '{"name": "b7624e775431219161"}'
|
# $ varlink call -m unix:/run/io.podman/io.podman.GetAttachSockets '{"name": "b7624e775431219161"}'
|
||||||
# {
|
# {
|
||||||
# "sockets": {
|
# "sockets": {
|
||||||
# "container_id": "b7624e7754312191613245ce1a46844abee60025818fe3c3f3203435623a1eca",
|
# "container_id": "b7624e7754312191613245ce1a46844abee60025818fe3c3f3203435623a1eca",
|
||||||
|
@ -511,7 +511,7 @@ method WaitContainer(name: string) -> (exitcode: int)
|
||||||
# container cannot be found by name or ID, a [ContainerNotFound](#ContainerNotFound) error will be returned.
|
# container cannot be found by name or ID, a [ContainerNotFound](#ContainerNotFound) error will be returned.
|
||||||
# #### Example
|
# #### Example
|
||||||
# ~~~
|
# ~~~
|
||||||
# $ varlink call -m unix:/run/podman/io.projectatomic.podman/io.projectatomic.podman.RemoveContainer '{"name": "62f4fd98cb57"}'
|
# $ varlink call -m unix:/run/podman/io.podman/io.podman.RemoveContainer '{"name": "62f4fd98cb57"}'
|
||||||
# {
|
# {
|
||||||
# "container": "62f4fd98cb57f529831e8f90610e54bba74bd6f02920ffb485e15376ed365c20"
|
# "container": "62f4fd98cb57f529831e8f90610e54bba74bd6f02920ffb485e15376ed365c20"
|
||||||
# }
|
# }
|
||||||
|
@ -562,7 +562,7 @@ method TagImage(name: string, tagged: string) -> (image: string)
|
||||||
# ID of the removed image is returned when complete. See also [DeleteUnusedImages](DeleteUnusedImages).
|
# ID of the removed image is returned when complete. See also [DeleteUnusedImages](DeleteUnusedImages).
|
||||||
# #### Example
|
# #### Example
|
||||||
# ~~~
|
# ~~~
|
||||||
# varlink call -m unix:/run/podman/io.projectatomic.podman/io.projectatomic.podman.RemoveImage '{"name": "registry.fedoraproject.org/fedora", "force": true}'
|
# varlink call -m unix:/run/podman/io.podman/io.podman.RemoveImage '{"name": "registry.fedoraproject.org/fedora", "force": true}'
|
||||||
# {
|
# {
|
||||||
# "image": "426866d6fa419873f97e5cbd320eeb22778244c1dfffa01c944db3114f55772e"
|
# "image": "426866d6fa419873f97e5cbd320eeb22778244c1dfffa01c944db3114f55772e"
|
||||||
# }
|
# }
|
||||||
|
@ -602,7 +602,7 @@ method ExportImage(name: string, destination: string, compress: bool, tags: []st
|
||||||
# is returned.
|
# is returned.
|
||||||
# #### Example
|
# #### Example
|
||||||
# ~~~
|
# ~~~
|
||||||
# $ varlink call -m unix:/run/podman/io.projectatomic.podman/io.projectatomic.podman.PullImage '{"name": "registry.fedoraproject.org/fedora"}'
|
# $ varlink call -m unix:/run/podman/io.podman/io.podman.PullImage '{"name": "registry.fedoraproject.org/fedora"}'
|
||||||
# {
|
# {
|
||||||
# "id": "426866d6fa419873f97e5cbd320eeb22778244c1dfffa01c944db3114f55772e"
|
# "id": "426866d6fa419873f97e5cbd320eeb22778244c1dfffa01c944db3114f55772e"
|
||||||
# }
|
# }
|
|
@ -22,8 +22,8 @@ if [[ $(id -u) != 0 ]]; then
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! systemctl --quiet is-active io.projectatomic.podman.socket; then
|
if ! systemctl --quiet is-active io.podman.socket; then
|
||||||
echo 1>&2 'podman is not running. systemctl enable --now io.projectatomic.podman.socket'
|
echo 1>&2 'podman is not running. systemctl enable --now io.podman.socket'
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ class BaseClient():
|
||||||
@classmethod
|
@classmethod
|
||||||
def factory(cls,
|
def factory(cls,
|
||||||
uri=None,
|
uri=None,
|
||||||
interface='io.projectatomic.podman',
|
interface='io.podman',
|
||||||
*args,
|
*args,
|
||||||
**kwargs):
|
**kwargs):
|
||||||
"""Construct a Client based on input."""
|
"""Construct a Client based on input."""
|
||||||
|
@ -153,18 +153,18 @@ class Client():
|
||||||
|
|
||||||
>>> import podman
|
>>> import podman
|
||||||
>>> c = podman.Client(uri='unix:/tmp/podman.sock',
|
>>> c = podman.Client(uri='unix:/tmp/podman.sock',
|
||||||
remote_uri='ssh://user@host/run/podman/io.projectatomic.podman',
|
remote_uri='ssh://user@host/run/podman/io.podman',
|
||||||
identity_file='~/.ssh/id_rsa')
|
identity_file='~/.ssh/id_rsa')
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
uri='unix:/run/podman/io.projectatomic.podman',
|
uri='unix:/run/podman/io.podman',
|
||||||
interface='io.projectatomic.podman',
|
interface='io.podman',
|
||||||
**kwargs):
|
**kwargs):
|
||||||
"""Construct a podman varlink Client.
|
"""Construct a podman varlink Client.
|
||||||
|
|
||||||
uri from default systemd unit file.
|
uri from default systemd unit file.
|
||||||
interface from io.projectatomic.podman.varlink, do not change unless
|
interface from io.podman.varlink, do not change unless
|
||||||
you are a varlink guru.
|
you are a varlink guru.
|
||||||
"""
|
"""
|
||||||
self._client = BaseClient.factory(uri, interface, **kwargs)
|
self._client = BaseClient.factory(uri, interface, **kwargs)
|
||||||
|
|
|
@ -50,10 +50,10 @@ class PodmanError(VarlinkErrorProxy):
|
||||||
|
|
||||||
|
|
||||||
ERROR_MAP = {
|
ERROR_MAP = {
|
||||||
'io.projectatomic.podman.ContainerNotFound': ContainerNotFound,
|
'io.podman.ContainerNotFound': ContainerNotFound,
|
||||||
'io.projectatomic.podman.ErrorOccurred': ErrorOccurred,
|
'io.podman.ErrorOccurred': ErrorOccurred,
|
||||||
'io.projectatomic.podman.ImageNotFound': ImageNotFound,
|
'io.podman.ImageNotFound': ImageNotFound,
|
||||||
'io.projectatomic.podman.RuntimeError': PodmanError,
|
'io.podman.RuntimeError': PodmanError,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ class TestClient(unittest.TestCase):
|
||||||
def test_local(self, mock_ping):
|
def test_local(self, mock_ping):
|
||||||
p = Client(
|
p = Client(
|
||||||
uri='unix:/run/podman',
|
uri='unix:/run/podman',
|
||||||
interface='io.projectatomic.podman',
|
interface='io.podman',
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertIsInstance(p._client, LocalClient)
|
self.assertIsInstance(p._client, LocalClient)
|
||||||
|
@ -27,7 +27,7 @@ class TestClient(unittest.TestCase):
|
||||||
def test_remote(self, mock_ping):
|
def test_remote(self, mock_ping):
|
||||||
p = Client(
|
p = Client(
|
||||||
uri='unix:/run/podman',
|
uri='unix:/run/podman',
|
||||||
interface='io.projectatomic.podman',
|
interface='io.podman',
|
||||||
remote_uri='ssh://user@hostname/run/podman/podman',
|
remote_uri='ssh://user@hostname/run/podman/podman',
|
||||||
identity_file='~/.ssh/id_rsa')
|
identity_file='~/.ssh/id_rsa')
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,7 @@ RUN chmod 755 /tmp/hello.sh
|
||||||
ENTRYPOINT ["/tmp/hello.sh"]
|
ENTRYPOINT ["/tmp/hello.sh"]
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
export PODMAN_HOST="unix:${TMPDIR}/podman/io.projectatomic.podman"
|
export PODMAN_HOST="unix:${TMPDIR}/podman/io.podman"
|
||||||
PODMAN_ARGS="--storage-driver=vfs \
|
PODMAN_ARGS="--storage-driver=vfs \
|
||||||
--root=${TMPDIR}/crio \
|
--root=${TMPDIR}/crio \
|
||||||
--runroot=${TMPDIR}/crio-run \
|
--runroot=${TMPDIR}/crio-run \
|
||||||
|
|
|
@ -56,7 +56,7 @@ class TestTunnel(unittest.TestCase):
|
||||||
|
|
||||||
context = Context(
|
context = Context(
|
||||||
'unix:/01',
|
'unix:/01',
|
||||||
'io.projectatomic.podman',
|
'io.podman',
|
||||||
'/tmp/user/socket',
|
'/tmp/user/socket',
|
||||||
'/run/podman/socket',
|
'/run/podman/socket',
|
||||||
'user',
|
'user',
|
||||||
|
|
|
@ -54,7 +54,7 @@ Default is None and will allow \f[C]ssh\f[] to follow it's default configuration
|
||||||
\f[B]\[en]remote\-socket\-path\f[]
|
\f[B]\[en]remote\-socket\-path\f[]
|
||||||
.PP
|
.PP
|
||||||
Path on remote host for podman service's \f[C]AF_UNIX\f[] socket. The default is
|
Path on remote host for podman service's \f[C]AF_UNIX\f[] socket. The default is
|
||||||
\f[C]/run/podman/io.projectatomic.podman\f[].
|
\f[C]/run/podman/io.podman\f[].
|
||||||
.PP
|
.PP
|
||||||
\f[B]\[en]identity\-file\f[]
|
\f[B]\[en]identity\-file\f[]
|
||||||
.PP
|
.PP
|
||||||
|
@ -92,7 +92,7 @@ From command line option, for example: \[en]run\-dir
|
||||||
This should provide Operators the ability to setup basic configurations
|
This should provide Operators the ability to setup basic configurations
|
||||||
and allow users to customize them.
|
and allow users to customize them.
|
||||||
.PP
|
.PP
|
||||||
\f[B]XDG_RUNTIME_DIR\f[] (\f[C]XDG_RUNTIME_DIR/io.projectatomic.podman\f[])
|
\f[B]XDG_RUNTIME_DIR\f[] (\f[C]XDG_RUNTIME_DIR/io.podman\f[])
|
||||||
.PP
|
.PP
|
||||||
Directory where pypodman stores non\-essential runtime files and other file
|
Directory where pypodman stores non\-essential runtime files and other file
|
||||||
objects (such as sockets, named pipes, \&...).
|
objects (such as sockets, named pipes, \&...).
|
||||||
|
|
|
@ -101,7 +101,7 @@ class PodmanArgumentParser(argparse.ArgumentParser):
|
||||||
'--remote-socket-path',
|
'--remote-socket-path',
|
||||||
metavar='PATH',
|
metavar='PATH',
|
||||||
help=('path of podman socket on remote host'
|
help=('path of podman socket on remote host'
|
||||||
' (default: /run/podman/io.projectatomic.podman)'))
|
' (default: /run/podman/io.podman)'))
|
||||||
self.add_argument(
|
self.add_argument(
|
||||||
'--identity-file',
|
'--identity-file',
|
||||||
'-i',
|
'-i',
|
||||||
|
@ -198,7 +198,7 @@ class PodmanArgumentParser(argparse.ArgumentParser):
|
||||||
getattr(args, 'remote_socket_path')
|
getattr(args, 'remote_socket_path')
|
||||||
or os.environ.get('REMOTE_SOCKET_PATH')
|
or os.environ.get('REMOTE_SOCKET_PATH')
|
||||||
or config['default'].get('remote_socket_path')
|
or config['default'].get('remote_socket_path')
|
||||||
or '/run/podman/io.projectatomic.podman'
|
or '/run/podman/io.podman'
|
||||||
) # yapf:disable
|
) # yapf:disable
|
||||||
|
|
||||||
reqattr(
|
reqattr(
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Podman Remote API Service
|
||||||
|
Requires=io.podman.socket
|
||||||
|
After=io.podman.socket
|
||||||
|
Documentation=man:podman-varlink(1)
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
ExecStart=/usr/bin/podman varlink unix:/run/podman/io.podman
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
Also=io.podman.socket
|
|
@ -3,7 +3,7 @@ Description=Podman Remote API Socket
|
||||||
Documentation=man:podman-varlink(1)
|
Documentation=man:podman-varlink(1)
|
||||||
|
|
||||||
[Socket]
|
[Socket]
|
||||||
ListenStream=/run/podman/io.projectatomic.podman
|
ListenStream=/run/podman/io.podman
|
||||||
SocketMode=0600
|
SocketMode=0600
|
||||||
|
|
||||||
[Install]
|
[Install]
|
|
@ -1,13 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=Podman Remote API Service
|
|
||||||
Requires=io.projectatomic.podman.socket
|
|
||||||
After=io.projectatomic.podman.socket
|
|
||||||
Documentation=man:podman-varlink(1)
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=simple
|
|
||||||
ExecStart=/usr/bin/podman varlink unix:/run/podman/io.projectatomic.podman
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
Also=io.projectatomic.podman.socket
|
|
|
@ -1,3 +1,3 @@
|
||||||
package docs
|
package docs
|
||||||
|
|
||||||
//go:generate go run varlink/apidoc.go ../cmd/podman/varlink/io.projectatomic.podman.varlink ../API.md
|
//go:generate go run varlink/apidoc.go ../cmd/podman/varlink/io.podman.varlink ../API.md
|
||||||
|
|
|
@ -26,24 +26,24 @@ second. A value of `0` means no timeout and the session will not expire.
|
||||||
Run the podman varlink service manually and accept the default timeout.
|
Run the podman varlink service manually and accept the default timeout.
|
||||||
|
|
||||||
```
|
```
|
||||||
# podman varlink unix:/run/podman/io.projectatomic.podman
|
$ podman varlink unix:/run/podman/io.podman
|
||||||
```
|
```
|
||||||
|
|
||||||
Run the podman varlink service manually with a 5 second timeout.
|
Run the podman varlink service manually with a 5 second timeout.
|
||||||
|
|
||||||
```
|
```
|
||||||
# podman varlink --timeout 5000 unix:/run/podman/io.projectatomic.podman
|
$ podman varlink --timeout 5000 unix:/run/podman/io.podman
|
||||||
```
|
```
|
||||||
|
|
||||||
## CONFIGURATION
|
## CONFIGURATION
|
||||||
|
|
||||||
Users of the podman varlink service should enable the _io.projectatomic.podman.socket_ and _io.projectatomic.podman.service_.
|
Users of the podman varlink service should enable the _io.podman.socket_ and _io.podman.service_.
|
||||||
This is the preferred method for running the varlink service.
|
This is the preferred method for running the varlink service.
|
||||||
|
|
||||||
You can do this via systemctl.
|
You can do this via systemctl.
|
||||||
|
|
||||||
```
|
```
|
||||||
# systemctl enable --now io.projectatomic.podman.socket
|
systemctl enable --now io.podman.socket
|
||||||
```
|
```
|
||||||
|
|
||||||
## SEE ALSO
|
## SEE ALSO
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package varlinkapi
|
package varlinkapi
|
||||||
|
|
||||||
import (
|
import (
|
||||||
ioprojectatomicpodman "github.com/projectatomic/libpod/cmd/podman/varlink"
|
iopodman "github.com/projectatomic/libpod/cmd/podman/varlink"
|
||||||
"github.com/projectatomic/libpod/libpod"
|
"github.com/projectatomic/libpod/libpod"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
@ -9,12 +9,12 @@ import (
|
||||||
// LibpodAPI is the basic varlink struct for libpod
|
// LibpodAPI is the basic varlink struct for libpod
|
||||||
type LibpodAPI struct {
|
type LibpodAPI struct {
|
||||||
Cli *cli.Context
|
Cli *cli.Context
|
||||||
ioprojectatomicpodman.VarlinkInterface
|
iopodman.VarlinkInterface
|
||||||
Runtime *libpod.Runtime
|
Runtime *libpod.Runtime
|
||||||
}
|
}
|
||||||
|
|
||||||
// New creates a new varlink client
|
// New creates a new varlink client
|
||||||
func New(cli *cli.Context, runtime *libpod.Runtime) *ioprojectatomicpodman.VarlinkInterface {
|
func New(cli *cli.Context, runtime *libpod.Runtime) *iopodman.VarlinkInterface {
|
||||||
lp := LibpodAPI{Cli: cli, Runtime: runtime}
|
lp := LibpodAPI{Cli: cli, Runtime: runtime}
|
||||||
return ioprojectatomicpodman.VarlinkNew(&lp)
|
return iopodman.VarlinkNew(&lp)
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,9 +17,9 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// ListContainers ...
|
// ListContainers ...
|
||||||
func (i *LibpodAPI) ListContainers(call ioprojectatomicpodman.VarlinkCall) error {
|
func (i *LibpodAPI) ListContainers(call iopodman.VarlinkCall) error {
|
||||||
var (
|
var (
|
||||||
listContainers []ioprojectatomicpodman.ListContainerData
|
listContainers []iopodman.ListContainerData
|
||||||
)
|
)
|
||||||
|
|
||||||
containers, err := i.Runtime.GetAllContainers()
|
containers, err := i.Runtime.GetAllContainers()
|
||||||
|
@ -42,7 +42,7 @@ func (i *LibpodAPI) ListContainers(call ioprojectatomicpodman.VarlinkCall) error
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetContainer ...
|
// GetContainer ...
|
||||||
func (i *LibpodAPI) GetContainer(call ioprojectatomicpodman.VarlinkCall, name string) error {
|
func (i *LibpodAPI) GetContainer(call iopodman.VarlinkCall, name string) error {
|
||||||
ctr, err := i.Runtime.LookupContainer(name)
|
ctr, err := i.Runtime.LookupContainer(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return call.ReplyContainerNotFound(name)
|
return call.ReplyContainerNotFound(name)
|
||||||
|
@ -59,7 +59,7 @@ func (i *LibpodAPI) GetContainer(call ioprojectatomicpodman.VarlinkCall, name st
|
||||||
}
|
}
|
||||||
|
|
||||||
// InspectContainer ...
|
// InspectContainer ...
|
||||||
func (i *LibpodAPI) InspectContainer(call ioprojectatomicpodman.VarlinkCall, name string) error {
|
func (i *LibpodAPI) InspectContainer(call iopodman.VarlinkCall, name string) error {
|
||||||
ctr, err := i.Runtime.LookupContainer(name)
|
ctr, err := i.Runtime.LookupContainer(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return call.ReplyContainerNotFound(name)
|
return call.ReplyContainerNotFound(name)
|
||||||
|
@ -80,7 +80,7 @@ func (i *LibpodAPI) InspectContainer(call ioprojectatomicpodman.VarlinkCall, nam
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListContainerProcesses ...
|
// ListContainerProcesses ...
|
||||||
func (i *LibpodAPI) ListContainerProcesses(call ioprojectatomicpodman.VarlinkCall, name string, opts []string) error {
|
func (i *LibpodAPI) ListContainerProcesses(call iopodman.VarlinkCall, name string, opts []string) error {
|
||||||
ctr, err := i.Runtime.LookupContainer(name)
|
ctr, err := i.Runtime.LookupContainer(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return call.ReplyContainerNotFound(name)
|
return call.ReplyContainerNotFound(name)
|
||||||
|
@ -107,7 +107,7 @@ func (i *LibpodAPI) ListContainerProcesses(call ioprojectatomicpodman.VarlinkCal
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetContainerLogs ...
|
// GetContainerLogs ...
|
||||||
func (i *LibpodAPI) GetContainerLogs(call ioprojectatomicpodman.VarlinkCall, name string) error {
|
func (i *LibpodAPI) GetContainerLogs(call iopodman.VarlinkCall, name string) error {
|
||||||
var logs []string
|
var logs []string
|
||||||
ctr, err := i.Runtime.LookupContainer(name)
|
ctr, err := i.Runtime.LookupContainer(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -168,12 +168,12 @@ func (i *LibpodAPI) GetContainerLogs(call ioprojectatomicpodman.VarlinkCall, nam
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListContainerChanges ...
|
// ListContainerChanges ...
|
||||||
func (i *LibpodAPI) ListContainerChanges(call ioprojectatomicpodman.VarlinkCall, name string) error {
|
func (i *LibpodAPI) ListContainerChanges(call iopodman.VarlinkCall, name string) error {
|
||||||
changes, err := i.Runtime.GetDiff("", name)
|
changes, err := i.Runtime.GetDiff("", name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return call.ReplyErrorOccurred(err.Error())
|
return call.ReplyErrorOccurred(err.Error())
|
||||||
}
|
}
|
||||||
result := ioprojectatomicpodman.ContainerChanges{}
|
result := iopodman.ContainerChanges{}
|
||||||
for _, change := range changes {
|
for _, change := range changes {
|
||||||
switch change.Kind {
|
switch change.Kind {
|
||||||
case archive.ChangeModify:
|
case archive.ChangeModify:
|
||||||
|
@ -188,7 +188,7 @@ func (i *LibpodAPI) ListContainerChanges(call ioprojectatomicpodman.VarlinkCall,
|
||||||
}
|
}
|
||||||
|
|
||||||
// ExportContainer ...
|
// ExportContainer ...
|
||||||
func (i *LibpodAPI) ExportContainer(call ioprojectatomicpodman.VarlinkCall, name, path string) error {
|
func (i *LibpodAPI) ExportContainer(call iopodman.VarlinkCall, name, path string) error {
|
||||||
ctr, err := i.Runtime.LookupContainer(name)
|
ctr, err := i.Runtime.LookupContainer(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return call.ReplyContainerNotFound(name)
|
return call.ReplyContainerNotFound(name)
|
||||||
|
@ -200,7 +200,7 @@ func (i *LibpodAPI) ExportContainer(call ioprojectatomicpodman.VarlinkCall, name
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetContainerStats ...
|
// GetContainerStats ...
|
||||||
func (i *LibpodAPI) GetContainerStats(call ioprojectatomicpodman.VarlinkCall, name string) error {
|
func (i *LibpodAPI) GetContainerStats(call iopodman.VarlinkCall, name string) error {
|
||||||
ctr, err := i.Runtime.LookupContainer(name)
|
ctr, err := i.Runtime.LookupContainer(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return call.ReplyContainerNotFound(name)
|
return call.ReplyContainerNotFound(name)
|
||||||
|
@ -209,7 +209,7 @@ func (i *LibpodAPI) GetContainerStats(call ioprojectatomicpodman.VarlinkCall, na
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return call.ReplyErrorOccurred(err.Error())
|
return call.ReplyErrorOccurred(err.Error())
|
||||||
}
|
}
|
||||||
cs := ioprojectatomicpodman.ContainerStats{
|
cs := iopodman.ContainerStats{
|
||||||
Id: ctr.ID(),
|
Id: ctr.ID(),
|
||||||
Name: ctr.Name(),
|
Name: ctr.Name(),
|
||||||
Cpu: containerStats.CPU,
|
Cpu: containerStats.CPU,
|
||||||
|
@ -228,12 +228,12 @@ func (i *LibpodAPI) GetContainerStats(call ioprojectatomicpodman.VarlinkCall, na
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResizeContainerTty ...
|
// ResizeContainerTty ...
|
||||||
func (i *LibpodAPI) ResizeContainerTty(call ioprojectatomicpodman.VarlinkCall) error {
|
func (i *LibpodAPI) ResizeContainerTty(call iopodman.VarlinkCall) error {
|
||||||
return call.ReplyMethodNotImplemented("ResizeContainerTty")
|
return call.ReplyMethodNotImplemented("ResizeContainerTty")
|
||||||
}
|
}
|
||||||
|
|
||||||
// StartContainer ...
|
// StartContainer ...
|
||||||
func (i *LibpodAPI) StartContainer(call ioprojectatomicpodman.VarlinkCall, name string) error {
|
func (i *LibpodAPI) StartContainer(call iopodman.VarlinkCall, name string) error {
|
||||||
ctr, err := i.Runtime.LookupContainer(name)
|
ctr, err := i.Runtime.LookupContainer(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return call.ReplyContainerNotFound(name)
|
return call.ReplyContainerNotFound(name)
|
||||||
|
@ -252,7 +252,7 @@ func (i *LibpodAPI) StartContainer(call ioprojectatomicpodman.VarlinkCall, name
|
||||||
}
|
}
|
||||||
|
|
||||||
// StopContainer ...
|
// StopContainer ...
|
||||||
func (i *LibpodAPI) StopContainer(call ioprojectatomicpodman.VarlinkCall, name string, timeout int64) error {
|
func (i *LibpodAPI) StopContainer(call iopodman.VarlinkCall, name string, timeout int64) error {
|
||||||
ctr, err := i.Runtime.LookupContainer(name)
|
ctr, err := i.Runtime.LookupContainer(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return call.ReplyContainerNotFound(name)
|
return call.ReplyContainerNotFound(name)
|
||||||
|
@ -264,7 +264,7 @@ func (i *LibpodAPI) StopContainer(call ioprojectatomicpodman.VarlinkCall, name s
|
||||||
}
|
}
|
||||||
|
|
||||||
// RestartContainer ...
|
// RestartContainer ...
|
||||||
func (i *LibpodAPI) RestartContainer(call ioprojectatomicpodman.VarlinkCall, name string, timeout int64) error {
|
func (i *LibpodAPI) RestartContainer(call iopodman.VarlinkCall, name string, timeout int64) error {
|
||||||
ctr, err := i.Runtime.LookupContainer(name)
|
ctr, err := i.Runtime.LookupContainer(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return call.ReplyContainerNotFound(name)
|
return call.ReplyContainerNotFound(name)
|
||||||
|
@ -277,7 +277,7 @@ func (i *LibpodAPI) RestartContainer(call ioprojectatomicpodman.VarlinkCall, nam
|
||||||
|
|
||||||
// KillContainer kills a running container. If you want to use the default SIGTERM signal, just send a -1
|
// KillContainer kills a running container. If you want to use the default SIGTERM signal, just send a -1
|
||||||
// for the signal arg.
|
// for the signal arg.
|
||||||
func (i *LibpodAPI) KillContainer(call ioprojectatomicpodman.VarlinkCall, name string, signal int64) error {
|
func (i *LibpodAPI) KillContainer(call iopodman.VarlinkCall, name string, signal int64) error {
|
||||||
killSignal := uint(syscall.SIGTERM)
|
killSignal := uint(syscall.SIGTERM)
|
||||||
if signal != -1 {
|
if signal != -1 {
|
||||||
killSignal = uint(signal)
|
killSignal = uint(signal)
|
||||||
|
@ -293,17 +293,17 @@ func (i *LibpodAPI) KillContainer(call ioprojectatomicpodman.VarlinkCall, name s
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateContainer ...
|
// UpdateContainer ...
|
||||||
func (i *LibpodAPI) UpdateContainer(call ioprojectatomicpodman.VarlinkCall) error {
|
func (i *LibpodAPI) UpdateContainer(call iopodman.VarlinkCall) error {
|
||||||
return call.ReplyMethodNotImplemented("UpdateContainer")
|
return call.ReplyMethodNotImplemented("UpdateContainer")
|
||||||
}
|
}
|
||||||
|
|
||||||
// RenameContainer ...
|
// RenameContainer ...
|
||||||
func (i *LibpodAPI) RenameContainer(call ioprojectatomicpodman.VarlinkCall) error {
|
func (i *LibpodAPI) RenameContainer(call iopodman.VarlinkCall) error {
|
||||||
return call.ReplyMethodNotImplemented("RenameContainer")
|
return call.ReplyMethodNotImplemented("RenameContainer")
|
||||||
}
|
}
|
||||||
|
|
||||||
// PauseContainer ...
|
// PauseContainer ...
|
||||||
func (i *LibpodAPI) PauseContainer(call ioprojectatomicpodman.VarlinkCall, name string) error {
|
func (i *LibpodAPI) PauseContainer(call iopodman.VarlinkCall, name string) error {
|
||||||
ctr, err := i.Runtime.LookupContainer(name)
|
ctr, err := i.Runtime.LookupContainer(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return call.ReplyContainerNotFound(name)
|
return call.ReplyContainerNotFound(name)
|
||||||
|
@ -315,7 +315,7 @@ func (i *LibpodAPI) PauseContainer(call ioprojectatomicpodman.VarlinkCall, name
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnpauseContainer ...
|
// UnpauseContainer ...
|
||||||
func (i *LibpodAPI) UnpauseContainer(call ioprojectatomicpodman.VarlinkCall, name string) error {
|
func (i *LibpodAPI) UnpauseContainer(call iopodman.VarlinkCall, name string) error {
|
||||||
ctr, err := i.Runtime.LookupContainer(name)
|
ctr, err := i.Runtime.LookupContainer(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return call.ReplyContainerNotFound(name)
|
return call.ReplyContainerNotFound(name)
|
||||||
|
@ -328,12 +328,12 @@ func (i *LibpodAPI) UnpauseContainer(call ioprojectatomicpodman.VarlinkCall, nam
|
||||||
|
|
||||||
// AttachToContainer ...
|
// AttachToContainer ...
|
||||||
// TODO: DO we also want a different one for websocket?
|
// TODO: DO we also want a different one for websocket?
|
||||||
func (i *LibpodAPI) AttachToContainer(call ioprojectatomicpodman.VarlinkCall) error {
|
func (i *LibpodAPI) AttachToContainer(call iopodman.VarlinkCall) error {
|
||||||
return call.ReplyMethodNotImplemented("AttachToContainer")
|
return call.ReplyMethodNotImplemented("AttachToContainer")
|
||||||
}
|
}
|
||||||
|
|
||||||
// WaitContainer ...
|
// WaitContainer ...
|
||||||
func (i *LibpodAPI) WaitContainer(call ioprojectatomicpodman.VarlinkCall, name string) error {
|
func (i *LibpodAPI) WaitContainer(call iopodman.VarlinkCall, name string) error {
|
||||||
ctr, err := i.Runtime.LookupContainer(name)
|
ctr, err := i.Runtime.LookupContainer(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return call.ReplyContainerNotFound(name)
|
return call.ReplyContainerNotFound(name)
|
||||||
|
@ -347,7 +347,7 @@ func (i *LibpodAPI) WaitContainer(call ioprojectatomicpodman.VarlinkCall, name s
|
||||||
}
|
}
|
||||||
|
|
||||||
// RemoveContainer ...
|
// RemoveContainer ...
|
||||||
func (i *LibpodAPI) RemoveContainer(call ioprojectatomicpodman.VarlinkCall, name string, force bool) error {
|
func (i *LibpodAPI) RemoveContainer(call iopodman.VarlinkCall, name string, force bool) error {
|
||||||
ctx := getContext()
|
ctx := getContext()
|
||||||
ctr, err := i.Runtime.LookupContainer(name)
|
ctr, err := i.Runtime.LookupContainer(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -361,7 +361,7 @@ func (i *LibpodAPI) RemoveContainer(call ioprojectatomicpodman.VarlinkCall, name
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteStoppedContainers ...
|
// DeleteStoppedContainers ...
|
||||||
func (i *LibpodAPI) DeleteStoppedContainers(call ioprojectatomicpodman.VarlinkCall) error {
|
func (i *LibpodAPI) DeleteStoppedContainers(call iopodman.VarlinkCall) error {
|
||||||
ctx := getContext()
|
ctx := getContext()
|
||||||
var deletedContainers []string
|
var deletedContainers []string
|
||||||
containers, err := i.Runtime.GetAllContainers()
|
containers, err := i.Runtime.GetAllContainers()
|
||||||
|
@ -384,7 +384,7 @@ func (i *LibpodAPI) DeleteStoppedContainers(call ioprojectatomicpodman.VarlinkCa
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetAttachSockets ...
|
// GetAttachSockets ...
|
||||||
func (i *LibpodAPI) GetAttachSockets(call ioprojectatomicpodman.VarlinkCall, name string) error {
|
func (i *LibpodAPI) GetAttachSockets(call iopodman.VarlinkCall, name string) error {
|
||||||
ctr, err := i.Runtime.LookupContainer(name)
|
ctr, err := i.Runtime.LookupContainer(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return call.ReplyContainerNotFound(name)
|
return call.ReplyContainerNotFound(name)
|
||||||
|
@ -403,7 +403,7 @@ func (i *LibpodAPI) GetAttachSockets(call ioprojectatomicpodman.VarlinkCall, nam
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
s := ioprojectatomicpodman.Sockets{
|
s := iopodman.Sockets{
|
||||||
Container_id: ctr.ID(),
|
Container_id: ctr.ID(),
|
||||||
Io_socket: ctr.AttachSocketPath(),
|
Io_socket: ctr.AttachSocketPath(),
|
||||||
Control_socket: ctr.ControlSocketPath(),
|
Control_socket: ctr.ControlSocketPath(),
|
||||||
|
|
|
@ -20,7 +20,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// CreateContainer ...
|
// CreateContainer ...
|
||||||
func (i *LibpodAPI) CreateContainer(call ioprojectatomicpodman.VarlinkCall, config ioprojectatomicpodman.Create) error {
|
func (i *LibpodAPI) CreateContainer(call iopodman.VarlinkCall, config iopodman.Create) error {
|
||||||
rtc := i.Runtime.GetConfig()
|
rtc := i.Runtime.GetConfig()
|
||||||
ctx := getContext()
|
ctx := getContext()
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ func (i *LibpodAPI) CreateContainer(call ioprojectatomicpodman.VarlinkCall, conf
|
||||||
|
|
||||||
// varlinkCreateToCreateConfig takes the varlink input struct and maps it to a pointer
|
// varlinkCreateToCreateConfig takes the varlink input struct and maps it to a pointer
|
||||||
// of a CreateConfig, which eventually can be used to create the OCI spec.
|
// of a CreateConfig, which eventually can be used to create the OCI spec.
|
||||||
func varlinkCreateToCreateConfig(ctx context.Context, create ioprojectatomicpodman.Create, runtime *libpod.Runtime, imageName string, data *inspect.ImageData) (*cc.CreateConfig, error) {
|
func varlinkCreateToCreateConfig(ctx context.Context, create iopodman.Create, runtime *libpod.Runtime, imageName string, data *inspect.ImageData) (*cc.CreateConfig, error) {
|
||||||
var (
|
var (
|
||||||
inputCommand, command []string
|
inputCommand, command []string
|
||||||
memoryLimit, memoryReservation, memorySwap, memoryKernel int64
|
memoryLimit, memoryReservation, memorySwap, memoryKernel int64
|
||||||
|
|
|
@ -26,18 +26,18 @@ import (
|
||||||
|
|
||||||
// ListImages lists all the images in the store
|
// ListImages lists all the images in the store
|
||||||
// It requires no inputs.
|
// It requires no inputs.
|
||||||
func (i *LibpodAPI) ListImages(call ioprojectatomicpodman.VarlinkCall) error {
|
func (i *LibpodAPI) ListImages(call iopodman.VarlinkCall) error {
|
||||||
images, err := i.Runtime.ImageRuntime().GetImages()
|
images, err := i.Runtime.ImageRuntime().GetImages()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return call.ReplyErrorOccurred(fmt.Sprintf("unable to get list of images %q", err))
|
return call.ReplyErrorOccurred(fmt.Sprintf("unable to get list of images %q", err))
|
||||||
}
|
}
|
||||||
var imageList []ioprojectatomicpodman.ImageInList
|
var imageList []iopodman.ImageInList
|
||||||
for _, image := range images {
|
for _, image := range images {
|
||||||
labels, _ := image.Labels(getContext())
|
labels, _ := image.Labels(getContext())
|
||||||
containers, _ := image.Containers()
|
containers, _ := image.Containers()
|
||||||
size, _ := image.Size(getContext())
|
size, _ := image.Size(getContext())
|
||||||
|
|
||||||
i := ioprojectatomicpodman.ImageInList{
|
i := iopodman.ImageInList{
|
||||||
Id: image.ID(),
|
Id: image.ID(),
|
||||||
ParentId: image.Parent,
|
ParentId: image.Parent,
|
||||||
RepoTags: image.Names(),
|
RepoTags: image.Names(),
|
||||||
|
@ -54,7 +54,7 @@ func (i *LibpodAPI) ListImages(call ioprojectatomicpodman.VarlinkCall) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetImage returns a single image in the form of a ImageInList
|
// GetImage returns a single image in the form of a ImageInList
|
||||||
func (i *LibpodAPI) GetImage(call ioprojectatomicpodman.VarlinkCall, name string) error {
|
func (i *LibpodAPI) GetImage(call iopodman.VarlinkCall, name string) error {
|
||||||
newImage, err := i.Runtime.ImageRuntime().NewFromLocal(name)
|
newImage, err := i.Runtime.ImageRuntime().NewFromLocal(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return call.ReplyErrorOccurred(err.Error())
|
return call.ReplyErrorOccurred(err.Error())
|
||||||
|
@ -72,7 +72,7 @@ func (i *LibpodAPI) GetImage(call ioprojectatomicpodman.VarlinkCall, name string
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
il := ioprojectatomicpodman.ImageInList{
|
il := iopodman.ImageInList{
|
||||||
Id: newImage.ID(),
|
Id: newImage.ID(),
|
||||||
ParentId: newImage.Parent,
|
ParentId: newImage.Parent,
|
||||||
RepoTags: newImage.Names(),
|
RepoTags: newImage.Names(),
|
||||||
|
@ -87,7 +87,7 @@ func (i *LibpodAPI) GetImage(call ioprojectatomicpodman.VarlinkCall, name string
|
||||||
}
|
}
|
||||||
|
|
||||||
// BuildImage ...
|
// BuildImage ...
|
||||||
func (i *LibpodAPI) BuildImage(call ioprojectatomicpodman.VarlinkCall, config ioprojectatomicpodman.BuildInfo) error {
|
func (i *LibpodAPI) BuildImage(call iopodman.VarlinkCall, config iopodman.BuildInfo) error {
|
||||||
var (
|
var (
|
||||||
memoryLimit int64
|
memoryLimit int64
|
||||||
memorySwap int64
|
memorySwap int64
|
||||||
|
@ -221,7 +221,7 @@ func (i *LibpodAPI) BuildImage(call ioprojectatomicpodman.VarlinkCall, config io
|
||||||
time.Sleep(1 * time.Second)
|
time.Sleep(1 * time.Second)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
br := ioprojectatomicpodman.BuildResponse{
|
br := iopodman.BuildResponse{
|
||||||
Logs: log,
|
Logs: log,
|
||||||
}
|
}
|
||||||
call.ReplyBuildImage(br)
|
call.ReplyBuildImage(br)
|
||||||
|
@ -239,7 +239,7 @@ func (i *LibpodAPI) BuildImage(call ioprojectatomicpodman.VarlinkCall, config io
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return call.ReplyErrorOccurred(err.Error())
|
return call.ReplyErrorOccurred(err.Error())
|
||||||
}
|
}
|
||||||
br := ioprojectatomicpodman.BuildResponse{
|
br := iopodman.BuildResponse{
|
||||||
Logs: log,
|
Logs: log,
|
||||||
Id: newImage.ID(),
|
Id: newImage.ID(),
|
||||||
}
|
}
|
||||||
|
@ -259,13 +259,13 @@ func build(runtime *libpod.Runtime, options imagebuildah.BuildOptions, dockerfil
|
||||||
|
|
||||||
// CreateImage ...
|
// CreateImage ...
|
||||||
// TODO With Pull being added, should we skip Create?
|
// TODO With Pull being added, should we skip Create?
|
||||||
func (i *LibpodAPI) CreateImage(call ioprojectatomicpodman.VarlinkCall) error {
|
func (i *LibpodAPI) CreateImage(call iopodman.VarlinkCall) error {
|
||||||
return call.ReplyMethodNotImplemented("CreateImage")
|
return call.ReplyMethodNotImplemented("CreateImage")
|
||||||
}
|
}
|
||||||
|
|
||||||
// InspectImage returns an image's inspect information as a string that can be serialized.
|
// InspectImage returns an image's inspect information as a string that can be serialized.
|
||||||
// Requires an image ID or name
|
// Requires an image ID or name
|
||||||
func (i *LibpodAPI) InspectImage(call ioprojectatomicpodman.VarlinkCall, name string) error {
|
func (i *LibpodAPI) InspectImage(call iopodman.VarlinkCall, name string) error {
|
||||||
newImage, err := i.Runtime.ImageRuntime().NewFromLocal(name)
|
newImage, err := i.Runtime.ImageRuntime().NewFromLocal(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return call.ReplyImageNotFound(name)
|
return call.ReplyImageNotFound(name)
|
||||||
|
@ -280,7 +280,7 @@ func (i *LibpodAPI) InspectImage(call ioprojectatomicpodman.VarlinkCall, name st
|
||||||
|
|
||||||
// HistoryImage returns the history of the image's layers
|
// HistoryImage returns the history of the image's layers
|
||||||
// Requires an image or name
|
// Requires an image or name
|
||||||
func (i *LibpodAPI) HistoryImage(call ioprojectatomicpodman.VarlinkCall, name string) error {
|
func (i *LibpodAPI) HistoryImage(call iopodman.VarlinkCall, name string) error {
|
||||||
newImage, err := i.Runtime.ImageRuntime().NewFromLocal(name)
|
newImage, err := i.Runtime.ImageRuntime().NewFromLocal(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return call.ReplyImageNotFound(name)
|
return call.ReplyImageNotFound(name)
|
||||||
|
@ -289,9 +289,9 @@ func (i *LibpodAPI) HistoryImage(call ioprojectatomicpodman.VarlinkCall, name st
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return call.ReplyErrorOccurred(err.Error())
|
return call.ReplyErrorOccurred(err.Error())
|
||||||
}
|
}
|
||||||
var histories []ioprojectatomicpodman.ImageHistory
|
var histories []iopodman.ImageHistory
|
||||||
for _, hist := range history {
|
for _, hist := range history {
|
||||||
imageHistory := ioprojectatomicpodman.ImageHistory{
|
imageHistory := iopodman.ImageHistory{
|
||||||
Id: hist.ID,
|
Id: hist.ID,
|
||||||
Created: hist.Created.String(),
|
Created: hist.Created.String(),
|
||||||
CreatedBy: hist.CreatedBy,
|
CreatedBy: hist.CreatedBy,
|
||||||
|
@ -306,7 +306,7 @@ func (i *LibpodAPI) HistoryImage(call ioprojectatomicpodman.VarlinkCall, name st
|
||||||
|
|
||||||
// PushImage pushes an local image to registry
|
// PushImage pushes an local image to registry
|
||||||
// TODO We need to add options for signing, credentials, tls, and multi-tag
|
// TODO We need to add options for signing, credentials, tls, and multi-tag
|
||||||
func (i *LibpodAPI) PushImage(call ioprojectatomicpodman.VarlinkCall, name, tag string, tlsVerify bool) error {
|
func (i *LibpodAPI) PushImage(call iopodman.VarlinkCall, name, tag string, tlsVerify bool) error {
|
||||||
newImage, err := i.Runtime.ImageRuntime().NewFromLocal(name)
|
newImage, err := i.Runtime.ImageRuntime().NewFromLocal(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return call.ReplyImageNotFound(err.Error())
|
return call.ReplyImageNotFound(err.Error())
|
||||||
|
@ -329,7 +329,7 @@ func (i *LibpodAPI) PushImage(call ioprojectatomicpodman.VarlinkCall, name, tag
|
||||||
}
|
}
|
||||||
|
|
||||||
// TagImage accepts an image name and tag as strings and tags an image in the local store.
|
// TagImage accepts an image name and tag as strings and tags an image in the local store.
|
||||||
func (i *LibpodAPI) TagImage(call ioprojectatomicpodman.VarlinkCall, name, tag string) error {
|
func (i *LibpodAPI) TagImage(call iopodman.VarlinkCall, name, tag string) error {
|
||||||
newImage, err := i.Runtime.ImageRuntime().NewFromLocal(name)
|
newImage, err := i.Runtime.ImageRuntime().NewFromLocal(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return call.ReplyImageNotFound(name)
|
return call.ReplyImageNotFound(name)
|
||||||
|
@ -342,7 +342,7 @@ func (i *LibpodAPI) TagImage(call ioprojectatomicpodman.VarlinkCall, name, tag s
|
||||||
|
|
||||||
// RemoveImage accepts a image name or ID as a string and force bool to determine if it should
|
// RemoveImage accepts a image name or ID as a string and force bool to determine if it should
|
||||||
// remove the image even if being used by stopped containers
|
// remove the image even if being used by stopped containers
|
||||||
func (i *LibpodAPI) RemoveImage(call ioprojectatomicpodman.VarlinkCall, name string, force bool) error {
|
func (i *LibpodAPI) RemoveImage(call iopodman.VarlinkCall, name string, force bool) error {
|
||||||
ctx := getContext()
|
ctx := getContext()
|
||||||
newImage, err := i.Runtime.ImageRuntime().NewFromLocal(name)
|
newImage, err := i.Runtime.ImageRuntime().NewFromLocal(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -357,20 +357,20 @@ func (i *LibpodAPI) RemoveImage(call ioprojectatomicpodman.VarlinkCall, name str
|
||||||
|
|
||||||
// SearchImage searches all registries configured in /etc/containers/registries.conf for an image
|
// SearchImage searches all registries configured in /etc/containers/registries.conf for an image
|
||||||
// Requires an image name and a search limit as int
|
// Requires an image name and a search limit as int
|
||||||
func (i *LibpodAPI) SearchImage(call ioprojectatomicpodman.VarlinkCall, name string, limit int64) error {
|
func (i *LibpodAPI) SearchImage(call iopodman.VarlinkCall, name string, limit int64) error {
|
||||||
sc := image.GetSystemContext("", "", false)
|
sc := image.GetSystemContext("", "", false)
|
||||||
registries, err := sysreg.GetRegistries()
|
registries, err := sysreg.GetRegistries()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return call.ReplyErrorOccurred(fmt.Sprintf("unable to get system registries: %q", err))
|
return call.ReplyErrorOccurred(fmt.Sprintf("unable to get system registries: %q", err))
|
||||||
}
|
}
|
||||||
var imageResults []ioprojectatomicpodman.ImageSearch
|
var imageResults []iopodman.ImageSearch
|
||||||
for _, reg := range registries {
|
for _, reg := range registries {
|
||||||
results, err := docker.SearchRegistry(getContext(), sc, reg, name, int(limit))
|
results, err := docker.SearchRegistry(getContext(), sc, reg, name, int(limit))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return call.ReplyErrorOccurred(err.Error())
|
return call.ReplyErrorOccurred(err.Error())
|
||||||
}
|
}
|
||||||
for _, result := range results {
|
for _, result := range results {
|
||||||
i := ioprojectatomicpodman.ImageSearch{
|
i := iopodman.ImageSearch{
|
||||||
Description: result.Description,
|
Description: result.Description,
|
||||||
Is_official: result.IsOfficial,
|
Is_official: result.IsOfficial,
|
||||||
Is_automated: result.IsAutomated,
|
Is_automated: result.IsAutomated,
|
||||||
|
@ -385,7 +385,7 @@ func (i *LibpodAPI) SearchImage(call ioprojectatomicpodman.VarlinkCall, name str
|
||||||
|
|
||||||
// DeleteUnusedImages deletes any images that do not have containers associated with it.
|
// DeleteUnusedImages deletes any images that do not have containers associated with it.
|
||||||
// TODO Filters are not implemented
|
// TODO Filters are not implemented
|
||||||
func (i *LibpodAPI) DeleteUnusedImages(call ioprojectatomicpodman.VarlinkCall) error {
|
func (i *LibpodAPI) DeleteUnusedImages(call iopodman.VarlinkCall) error {
|
||||||
images, err := i.Runtime.ImageRuntime().GetImages()
|
images, err := i.Runtime.ImageRuntime().GetImages()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return call.ReplyErrorOccurred(err.Error())
|
return call.ReplyErrorOccurred(err.Error())
|
||||||
|
@ -407,7 +407,7 @@ func (i *LibpodAPI) DeleteUnusedImages(call ioprojectatomicpodman.VarlinkCall) e
|
||||||
}
|
}
|
||||||
|
|
||||||
// Commit ...
|
// Commit ...
|
||||||
func (i *LibpodAPI) Commit(call ioprojectatomicpodman.VarlinkCall, name, imageName string, changes []string, author, message string, pause bool) error {
|
func (i *LibpodAPI) Commit(call iopodman.VarlinkCall, name, imageName string, changes []string, author, message string, pause bool) error {
|
||||||
ctr, err := i.Runtime.LookupContainer(name)
|
ctr, err := i.Runtime.LookupContainer(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return call.ReplyContainerNotFound(name)
|
return call.ReplyContainerNotFound(name)
|
||||||
|
@ -435,7 +435,7 @@ func (i *LibpodAPI) Commit(call ioprojectatomicpodman.VarlinkCall, name, imageNa
|
||||||
}
|
}
|
||||||
|
|
||||||
// ImportImage imports an image from a tarball to the image store
|
// ImportImage imports an image from a tarball to the image store
|
||||||
func (i *LibpodAPI) ImportImage(call ioprojectatomicpodman.VarlinkCall, source, reference, message string, changes []string) error {
|
func (i *LibpodAPI) ImportImage(call iopodman.VarlinkCall, source, reference, message string, changes []string) error {
|
||||||
configChanges, err := util.GetImageConfig(changes)
|
configChanges, err := util.GetImageConfig(changes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return call.ReplyErrorOccurred(err.Error())
|
return call.ReplyErrorOccurred(err.Error())
|
||||||
|
@ -456,7 +456,7 @@ func (i *LibpodAPI) ImportImage(call ioprojectatomicpodman.VarlinkCall, source,
|
||||||
|
|
||||||
// ExportImage exports an image to the provided destination
|
// ExportImage exports an image to the provided destination
|
||||||
// destination must have the transport type!!
|
// destination must have the transport type!!
|
||||||
func (i *LibpodAPI) ExportImage(call ioprojectatomicpodman.VarlinkCall, name, destination string, compress bool, tags []string) error {
|
func (i *LibpodAPI) ExportImage(call iopodman.VarlinkCall, name, destination string, compress bool, tags []string) error {
|
||||||
newImage, err := i.Runtime.ImageRuntime().NewFromLocal(name)
|
newImage, err := i.Runtime.ImageRuntime().NewFromLocal(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return call.ReplyImageNotFound(name)
|
return call.ReplyImageNotFound(name)
|
||||||
|
@ -475,7 +475,7 @@ func (i *LibpodAPI) ExportImage(call ioprojectatomicpodman.VarlinkCall, name, de
|
||||||
|
|
||||||
// PullImage pulls an image from a registry to the image store.
|
// PullImage pulls an image from a registry to the image store.
|
||||||
// TODO This implementation is incomplete
|
// TODO This implementation is incomplete
|
||||||
func (i *LibpodAPI) PullImage(call ioprojectatomicpodman.VarlinkCall, name string) error {
|
func (i *LibpodAPI) PullImage(call iopodman.VarlinkCall, name string) error {
|
||||||
newImage, err := i.Runtime.ImageRuntime().New(getContext(), name, "", "", nil, &image.DockerRegistryOptions{}, image.SigningOptions{}, true, false)
|
newImage, err := i.Runtime.ImageRuntime().New(getContext(), name, "", "", nil, &image.DockerRegistryOptions{}, image.SigningOptions{}, true, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return call.ReplyErrorOccurred(fmt.Sprintf("unable to pull %s: %s", name, err.Error()))
|
return call.ReplyErrorOccurred(fmt.Sprintf("unable to pull %s: %s", name, err.Error()))
|
||||||
|
|
|
@ -9,13 +9,13 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetVersion ...
|
// GetVersion ...
|
||||||
func (i *LibpodAPI) GetVersion(call ioprojectatomicpodman.VarlinkCall) error {
|
func (i *LibpodAPI) GetVersion(call iopodman.VarlinkCall) error {
|
||||||
versionInfo, err := libpod.GetVersion()
|
versionInfo, err := libpod.GetVersion()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return call.ReplyGetVersion(ioprojectatomicpodman.Version{
|
return call.ReplyGetVersion(iopodman.Version{
|
||||||
Version: versionInfo.Version,
|
Version: versionInfo.Version,
|
||||||
Go_version: versionInfo.GoVersion,
|
Go_version: versionInfo.GoVersion,
|
||||||
Git_commit: versionInfo.GitCommit,
|
Git_commit: versionInfo.GitCommit,
|
||||||
|
@ -26,21 +26,21 @@ func (i *LibpodAPI) GetVersion(call ioprojectatomicpodman.VarlinkCall) error {
|
||||||
|
|
||||||
// Ping returns a simple string "OK" response for clients to make sure
|
// Ping returns a simple string "OK" response for clients to make sure
|
||||||
// the service is working.
|
// the service is working.
|
||||||
func (i *LibpodAPI) Ping(call ioprojectatomicpodman.VarlinkCall) error {
|
func (i *LibpodAPI) Ping(call iopodman.VarlinkCall) error {
|
||||||
return call.ReplyPing(ioprojectatomicpodman.StringResponse{
|
return call.ReplyPing(iopodman.StringResponse{
|
||||||
Message: "OK",
|
Message: "OK",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetInfo returns details about the podman host and its stores
|
// GetInfo returns details about the podman host and its stores
|
||||||
func (i *LibpodAPI) GetInfo(call ioprojectatomicpodman.VarlinkCall) error {
|
func (i *LibpodAPI) GetInfo(call iopodman.VarlinkCall) error {
|
||||||
podmanInfo := ioprojectatomicpodman.PodmanInfo{}
|
podmanInfo := iopodman.PodmanInfo{}
|
||||||
info, err := i.Runtime.Info()
|
info, err := i.Runtime.Info()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return call.ReplyErrorOccurred(err.Error())
|
return call.ReplyErrorOccurred(err.Error())
|
||||||
}
|
}
|
||||||
host := info[0].Data
|
host := info[0].Data
|
||||||
infoHost := ioprojectatomicpodman.InfoHost{
|
infoHost := iopodman.InfoHost{
|
||||||
Mem_free: host["MemFree"].(int64),
|
Mem_free: host["MemFree"].(int64),
|
||||||
Mem_total: host["MemTotal"].(int64),
|
Mem_total: host["MemTotal"].(int64),
|
||||||
Swap_free: host["SwapFree"].(int64),
|
Swap_free: host["SwapFree"].(int64),
|
||||||
|
@ -53,7 +53,7 @@ func (i *LibpodAPI) GetInfo(call ioprojectatomicpodman.VarlinkCall) error {
|
||||||
}
|
}
|
||||||
podmanInfo.Host = infoHost
|
podmanInfo.Host = infoHost
|
||||||
store := info[1].Data
|
store := info[1].Data
|
||||||
pmaninfo := ioprojectatomicpodman.InfoPodmanBinary{
|
pmaninfo := iopodman.InfoPodmanBinary{
|
||||||
Compiler: goruntime.Compiler,
|
Compiler: goruntime.Compiler,
|
||||||
Go_version: goruntime.Version(),
|
Go_version: goruntime.Version(),
|
||||||
// TODO : How are we going to get this here?
|
// TODO : How are we going to get this here?
|
||||||
|
@ -61,12 +61,12 @@ func (i *LibpodAPI) GetInfo(call ioprojectatomicpodman.VarlinkCall) error {
|
||||||
Git_commit: libpod.GitCommit,
|
Git_commit: libpod.GitCommit,
|
||||||
}
|
}
|
||||||
|
|
||||||
graphStatus := ioprojectatomicpodman.InfoGraphStatus{
|
graphStatus := iopodman.InfoGraphStatus{
|
||||||
Backing_filesystem: store["GraphStatus"].(map[string]string)["Backing Filesystem"],
|
Backing_filesystem: store["GraphStatus"].(map[string]string)["Backing Filesystem"],
|
||||||
Native_overlay_diff: store["GraphStatus"].(map[string]string)["Native Overlay Diff"],
|
Native_overlay_diff: store["GraphStatus"].(map[string]string)["Native Overlay Diff"],
|
||||||
Supports_d_type: store["GraphStatus"].(map[string]string)["Supports d_type"],
|
Supports_d_type: store["GraphStatus"].(map[string]string)["Supports d_type"],
|
||||||
}
|
}
|
||||||
infoStore := ioprojectatomicpodman.InfoStore{
|
infoStore := iopodman.InfoStore{
|
||||||
Graph_driver_name: store["GraphDriverName"].(string),
|
Graph_driver_name: store["GraphDriverName"].(string),
|
||||||
Containers: int64(store["ContainerStore"].(map[string]interface{})["number"].(int)),
|
Containers: int64(store["ContainerStore"].(map[string]interface{})["number"].(int)),
|
||||||
Images: int64(store["ImageStore"].(map[string]interface{})["number"].(int)),
|
Images: int64(store["ImageStore"].(map[string]interface{})["number"].(int)),
|
||||||
|
|
|
@ -15,15 +15,15 @@ func getContext() context.Context {
|
||||||
return context.TODO()
|
return context.TODO()
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeListContainer(containerID string, batchInfo batchcontainer.BatchContainerStruct) ioprojectatomicpodman.ListContainerData {
|
func makeListContainer(containerID string, batchInfo batchcontainer.BatchContainerStruct) iopodman.ListContainerData {
|
||||||
var (
|
var (
|
||||||
mounts []ioprojectatomicpodman.ContainerMount
|
mounts []iopodman.ContainerMount
|
||||||
ports []ioprojectatomicpodman.ContainerPortMappings
|
ports []iopodman.ContainerPortMappings
|
||||||
)
|
)
|
||||||
ns := batchcontainer.GetNamespaces(batchInfo.Pid)
|
ns := batchcontainer.GetNamespaces(batchInfo.Pid)
|
||||||
|
|
||||||
for _, mount := range batchInfo.ConConfig.Spec.Mounts {
|
for _, mount := range batchInfo.ConConfig.Spec.Mounts {
|
||||||
m := ioprojectatomicpodman.ContainerMount{
|
m := iopodman.ContainerMount{
|
||||||
Destination: mount.Destination,
|
Destination: mount.Destination,
|
||||||
Type: mount.Type,
|
Type: mount.Type,
|
||||||
Source: mount.Source,
|
Source: mount.Source,
|
||||||
|
@ -33,7 +33,7 @@ func makeListContainer(containerID string, batchInfo batchcontainer.BatchContain
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, pm := range batchInfo.ConConfig.PortMappings {
|
for _, pm := range batchInfo.ConConfig.PortMappings {
|
||||||
p := ioprojectatomicpodman.ContainerPortMappings{
|
p := iopodman.ContainerPortMappings{
|
||||||
Host_port: strconv.Itoa(int(pm.HostPort)),
|
Host_port: strconv.Itoa(int(pm.HostPort)),
|
||||||
Host_ip: pm.HostIP,
|
Host_ip: pm.HostIP,
|
||||||
Protocol: pm.Protocol,
|
Protocol: pm.Protocol,
|
||||||
|
@ -45,7 +45,7 @@ func makeListContainer(containerID string, batchInfo batchcontainer.BatchContain
|
||||||
|
|
||||||
// If we find this needs to be done for other container endpoints, we should
|
// If we find this needs to be done for other container endpoints, we should
|
||||||
// convert this to a separate function or a generic map from struct function.
|
// convert this to a separate function or a generic map from struct function.
|
||||||
namespace := ioprojectatomicpodman.ContainerNameSpace{
|
namespace := iopodman.ContainerNameSpace{
|
||||||
User: ns.User,
|
User: ns.User,
|
||||||
Uts: ns.UTS,
|
Uts: ns.UTS,
|
||||||
Pidns: ns.PIDNS,
|
Pidns: ns.PIDNS,
|
||||||
|
@ -56,7 +56,7 @@ func makeListContainer(containerID string, batchInfo batchcontainer.BatchContain
|
||||||
Ipc: ns.IPC,
|
Ipc: ns.IPC,
|
||||||
}
|
}
|
||||||
|
|
||||||
lc := ioprojectatomicpodman.ListContainerData{
|
lc := iopodman.ListContainerData{
|
||||||
Id: containerID,
|
Id: containerID,
|
||||||
Image: batchInfo.ConConfig.RootfsImageName,
|
Image: batchInfo.ConConfig.RootfsImageName,
|
||||||
Imageid: batchInfo.ConConfig.RootfsImageID,
|
Imageid: batchInfo.ConConfig.RootfsImageID,
|
||||||
|
|
Loading…
Reference in New Issue