diff options
author | baude <bbaude@redhat.com> | 2018-06-22 08:15:37 -0500 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-06-27 04:52:22 +0000 |
commit | 60427ab3d26bbe5a5ab00c4e7b550f111b4f72e5 (patch) | |
tree | 64f11dab9bcdc426956160b6b56ee536bb3aa6e8 /contrib/python/cmd/images.py | |
parent | 56133f7263337e9b2c9cfb1cfce35adc2366f52b (diff) | |
download | podman-60427ab3d26bbe5a5ab00c4e7b550f111b4f72e5.tar.gz podman-60427ab3d26bbe5a5ab00c4e7b550f111b4f72e5.tar.bz2 podman-60427ab3d26bbe5a5ab00c4e7b550f111b4f72e5.zip |
add podman remote client
podman client that is capable of:
* images
* ps
* rm
* rmi
this is only a mockup to frame out and prove python library and ssh
tunnelling usage.
Signed-off-by: baude <bbaude@redhat.com>
Closes: #986
Approved by: rhatdan
Diffstat (limited to 'contrib/python/cmd/images.py')
-rw-r--r-- | contrib/python/cmd/images.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/contrib/python/cmd/images.py b/contrib/python/cmd/images.py new file mode 100644 index 000000000..3e0dff626 --- /dev/null +++ b/contrib/python/cmd/images.py @@ -0,0 +1,21 @@ +from pman import PodmanRemote +from utils import write_out, convert_size, stringTimeToHuman + +def cli(subparser): + imagesp = subparser.add_parser("images", + help=("list images")) + imagesp.add_argument("all", action="store_true", help="list all images") + imagesp.set_defaults(_class=Images, func='display_all_image_info') + + +class Images(PodmanRemote): + + def display_all_image_info(self): + col_fmt = "{0:40}{1:12}{2:14}{3:18}{4:14}" + write_out(col_fmt.format("REPOSITORY", "TAG", "IMAGE ID", "CREATED", "SIZE")) + for i in self.client.images.list(): + for r in i["repoTags"]: + rsplit = r.rindex(":") + name = r[0:rsplit-1] + tag = r[rsplit+1:] + write_out(col_fmt.format(name, tag, i["id"][:12], stringTimeToHuman(i["created"]), convert_size(i["size"]))) |