65 Commits

Author SHA1 Message Date
e955ff04ab Improve speed of containers.list()
* Clean up code in containers.py
* Pass pylint tests
* Pass tox tests

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2018-11-19 15:39:45 -07:00
ea928f2de6 Merge pull request #1824 from afbjorklund/pypodman_user
pypodman: Don't use $HOST and $USER variables for remote
2018-11-19 08:45:06 -08:00
4adc69f4f9 Don't use $HOST and $USER variables for remote
Also, don't use $PORT. These are too generic.

Make sure to read $LOGNAME _after_ the config.

Prefix all the remote variables with PODMAN_

Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
2018-11-18 17:37:14 +01:00
0d21b90016 Implement pypodman start command
* Improve error messages from argparse Actions
* Silence more pylint errors when supporting a given API
* Refactor BooleanAction to support lower and mixed case input
* Remove spurious print()

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2018-11-16 14:57:17 -07:00
dba45a13c0 Add version command to pypodman
pypodman does not currently support the version command.  We want to
have as close to the same functionality between podman and pypodman,
so adding this command.

Also had to fix some validate errors.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-11-15 20:15:52 -05:00
fa76b86e3e Temporarily fix the Python tests to fix some PRs
The Python podman bindings have issues around kill - specifically
attempting to make it act like stop, when it should not. We
provide no guarantee of what state a container if in after kill -
it should be stopped, but we might have sent something that's not
SIGKILL. If you want a container or pod stopped, guaranteed, use
Stop().

The Python code attempted to ensure a container was actually
stopped after kill was run, which runs counter the above. This
was holding up some PRs that caused changes in how libpod obtains
its state, so for now, change pod kill to pod stop until the
proper changes in the Python code can be made.

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2018-11-07 09:46:44 -05:00
76360d9a6e Merge pull request #1743 from jwhonce/issue/1702
Add ChangeAction to parse sub-options from --change
2018-11-05 04:50:16 -08:00
573e21f8a0 Fix long image name handling
* Fixed issue where podman printed '<none>' and pypodman
  skipped the image
* Fixed issue where port was printed in place of tags

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2018-11-01 11:36:46 -07:00
a4c0cdedb9 Add ChangeAction to parse sub-options from --change
* Covers both commit and import commands
* Cleaned up export command
* Removed unneeded calls to super().__init__()

Fixes #1702

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2018-11-01 10:32:39 -07:00
0f232037f6 Change humanize to use MB vs MiB.
Fixes #1653

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2018-11-01 07:39:35 -07:00
d62fa127a1 Ensure test container in running state
* Save storage if tests fail

Fixes #1643

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2018-10-25 12:20:11 -07:00
a7ea7e9d5c Downgrade code to support python3.4
* Added tox configuration to test python 3.4, 3.5 and 3.6.
  Tox testing not enabled on every PR
* Updated MANIFEST.ini to support tox
* Correct comments

Fixes #1641

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2018-10-23 07:58:48 -07:00
4de69da7bd Revert "Cirrus: Enable debugging delay on non-zero exit"
This reverts commit b610913ef55ac36d0b145a7d20461649650cc5a1.

Signed-off-by: Chris Evich <cevich@redhat.com>
2018-10-18 12:33:36 -04:00
b610913ef5 Cirrus: Enable debugging delay on non-zero exit
There have been some python-podman flakes observed across multiple CI
systems.  Support capturing a VM for further investigation in the
event of a non-zero exit.  This is done by printing a warning message
and delaying script-exit for a long time.  Hopefully a human will notice
and have an opportunity to enable deletion-protection on the VM.

Signed-off-by: Chris Evich <cevich@redhat.com>
2018-10-15 09:48:19 -04:00
1f8b844c2b tests: do not fail in the cleanup phase
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-10-14 16:52:31 +02:00
40cb756801 Add support for pod commands
* Add support for pod -- create, inspect, kill, pause, ps, rm,
  restart, start, stop, top, unpause
* Update pylintrc to better reflect pep8 code standards
* Fix various pylint reported errors
* Refactor code that determines screen width to no longer
  require initializing curses.  Improved start up time and
  pushing data blob down ssh tunnel.
* Correct pod-create man page, cgroupparent not boolean
* Abort integration tests if podman service fails to start

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2018-10-12 09:34:23 -07:00
978aac6650 Fix python tests
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2018-10-02 14:53:15 -04:00
ff38edaafe * Update documenation
Signed-off-by: Jhon Honce <jhonce@redhat.com>
2018-10-01 07:24:50 -07:00
9074565f4e Implement pod varlink bindings
* Update varlink document
* Add NoContainersInPod error in go and python
* Add support for varlink pod interface
* New code passes pylint
* Fix bug in test_runner.sh
* Update integration tests for race condition on status check
* Add missing port config file support

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2018-10-01 07:24:50 -07:00
9bcf7ce83a Merge pull request #818 from wking/python-2-clean
Makefile: Call contrib/python's clean regardless of HAS_PYTHON3
2018-09-27 09:42:43 -04:00
785e9ea1fd Updates from reviews
Signed-off-by: Jhon Honce <jhonce@redhat.com>

Closes: #1519
Approved by: rhatdan
2018-09-21 19:36:01 +00:00
e6074eb9ac Implement new subcommands
* Refactor create subparser to share arguments with run subparser
* Add argparse.*Action subclasses to reduce duplicate code in parsers
* Using BooleanAction now accept True/False value as expected
* .pylintrc added to loosen variable name policing
* Update AbstractBaseAction to remove unset arguments before
  transmitting to podman service
* Align logging messages to podman output
* Renamed global argument from --user to --username, to avoid conflict
  with create/run podman commands
* Add new subcommands: run, create, history, import, info, push,
  restart and search

Signed-off-by: Jhon Honce <jhonce@redhat.com>

Closes: #1519
Approved by: rhatdan
2018-09-21 19:36:01 +00:00
fbd1392a46 Don't output inodes created to run a container
There is a group of inodes that get created when running a container
if they do not exist.

containerMounts = map[string]bool{
	"/dev":               true,
	"/etc/hostname":      true,
	"/etc/hosts":         true,
	"/etc/resolv.conf":   true,
	"/proc":              true,
	"/run":               true,
	"/run/.containerenv": true,
	"/run/secrets":       true,
	"/sys":               true,
}

If the destination inode does not exist, libpod/runc will create the inode.
This can cause programs like podman diff to see the image as having changed,
when actually it has not.  This patch ignores changes in these inodes.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #1508
Approved by: giuseppe
2018-09-21 09:45:14 +00:00
356765aa95 contrib/python/*/Makefile: Fallback to unversioned 'python'
And pull these from the PATH by default.  This way systems like CentOS
that don't have a python3 can still execute 'make clean', which
doesn't care about the Python major version.

The setup.py shebang, mode change, and ./ prefixing helps address
cases where PYTHON is empty.  This could be the result of improper
user configuration:

  $ make PYTHON='' clean

It could also be the state on systems with no Python installed, in
which case you'll see:

  $ make PYTHON='' clean
  ./setup.py clean --all
  /usr/bin/env: 'python': No such file or directory
  make: *** [Makefile:13: clean] Error 127

I've also shifted the Python invocations to the end of the clean
recipies so that as much as possible gets cleaned up even on systems
without Python installed.

Signed-off-by: W. Trevor King <wking@tremily.us>
2018-09-13 22:15:22 -07:00
6d067fcba2 Turn on test debugging
Signed-off-by: Jhon Honce <jhonce@redhat.com>

Closes: #1369
Approved by: rhatdan
2018-08-31 16:52:52 +00:00
8245f09428 Add support for remote commands
* Add support for commit, export, inspect, kill, logs, mount, pause
  port commands
* Refactored Report class to allow column lengths to be optionally
  driven by data
* Refactored Ps class to truncate image names on the left vs right
* Bug fixes

Signed-off-by: Jhon Honce <jhonce@redhat.com>

Closes: #1369
Approved by: rhatdan
2018-08-31 16:52:52 +00:00
75588a4333 Add retry decorator for flakey tests
* Update doc strings

Signed-off-by: Jhon Honce <jhonce@redhat.com>

Closes: #1302
Approved by: baude
2018-08-20 21:07:09 +00:00
937398abcf Update error message from reviews
Signed-off-by: Jhon Honce <jhonce@redhat.com>

Closes: #1296
Approved by: rhatdan
2018-08-20 15:26:09 +00:00
3bfe07b4f5 Support Attach subcommand in pypodman
* Fix some random error handling

Signed-off-by: Jhon Honce <jhonce@redhat.com>

Closes: #1296
Approved by: rhatdan
2018-08-20 15:26:09 +00:00
cd73f77414 Fix handling of socket connection refusal.
Currently if the socket was never started you get an error about
the service being started.  But if the service was started and later
stopped, you get a useless error.

This change causes the error to always be the same for connection refused.

The error message was also repeating the address twice which looked bad.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #1287
Approved by: baude
2018-08-17 08:41:19 +00:00
d20f3a5146 switch projectatomic to containers
Need to get some small changes into libpod to pull back into buildah
to complete buildah transition.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #1270
Approved by: mheon
2018-08-16 17:12:36 +00:00
3445abd89d Add create and pull commands
* Rename id_ to ident, make non-PEP8'ers happier
* Fix bug where port was required on local connections
* Improve error messages for exceptions

Signed-off-by: Jhon Honce <jhonce@redhat.com>

Closes: #1246
Approved by: rhatdan
2018-08-14 18:25:51 +00:00
9c42e84173 Fix python tests again
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2018-08-10 16:18:44 -04:00
f4d124da93 Fix python tests to use cgroupfs
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2018-08-10 15:48:35 -04:00
ab4f190f41 Force cgroupfs for python tests
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2018-08-10 14:32:28 -04:00
7d43e7c451 Pass DESTDIR down to python Makefile
In order to get a cleaner build out of the rpms we should
pass down the DESTDIR to the python Makefiles.  Then we
can use them instead of hard coding other inteligence into
the spec files.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #1214
Approved by: baude
2018-08-07 14:52:30 +00:00
606b5f9a61 Remove inotify work around
PR#1215 fixed issue with podman blowing up inotify

Signed-off-by: Jhon Honce <jhonce@redhat.com>

Closes: #1222
Approved by: baude
2018-08-06 16:58:26 +00:00
bd9d3a8fa5 Rename varlink socket and interface
io.projectatomic.podman -> io.podman

Signed-off-by: baude <bbaude@redhat.com>

Closes: #1204
Approved by: mheon
2018-08-06 14:49:11 +00:00
54eec54b2a Add missing dependencies to build system
Signed-off-by: Jhon Honce <jhonce@redhat.com>

Closes: #1199
Approved by: rhatdan
2018-08-05 11:06:18 +00:00
47620961fe Port to MacOS
* Refactor Tunnel to support selecting port for remote sshd
* Refactor ssh tunnel to support MacOS version of ssh
* Refactor Tunnel.close() to find and kill off zombie siblings
* Add psutil dependency
* Add logging setup, letting library produce debugging records
* Clean up Tunnel API
* Fix test_runner.sh to propagate returncode to caller

Signed-off-by: Jhon Honce <jhonce@redhat.com>

Closes: #1199
Approved by: rhatdan
2018-08-05 11:06:18 +00:00
5aa36c1861 Clean up pylint warnings and errors for podman
* Some of the pedantic errors were not corrected
* Clean up prep for porting to MacOS and PyPi hosting
* Fix broken unittest

Signed-off-by: Jhon Honce <jhonce@redhat.com>

Closes: #1159
Approved by: rhatdan
2018-07-28 11:49:11 +00:00
32b690e902 Clean up pylint warnings and errors
* Some of the pedantic errors were not corrected
* Clean up prep for porting to MacOS and PyPi hosting

Signed-off-by: Jhon Honce <jhonce@redhat.com>

Closes: #1155
Approved by: baude
2018-07-25 02:50:16 +00:00
9a18681ba6 [WIP] Refactor and simplify python builds
* pypodman namespaced in site-packages
* version numbers pulled from requirements.txt
* add python-podman spec file to install eggs

Signed-off-by: Jhon Honce <jhonce@redhat.com>

Closes: #1106
Approved by: rhatdan
2018-07-23 18:53:44 +00:00
06c546e88d Downgrade setup.py
Signed-off-by: Jhon Honce <jhonce@redhat.com>

Closes: #1095
Approved by: mheon
2018-07-14 03:40:20 +00:00
74ccd9ce5f Update python directories to better support setup.py
Signed-off-by: Jhon Honce <jhonce@redhat.com>
2018-07-13 12:50:12 -07:00
44b523c946 remote python client for podman
* Use podman library for access
* Verbose error checking
* Planned windows and macosx ports

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2018-07-13 11:29:28 -07:00
86154b6538 Refactor attach()/start() after podman changes
* Update examples
* Update/Clean up unittests
* Add Mixins for container attach()/start()

Signed-off-by: Jhon Honce <jhonce@redhat.com>

Closes: #1080
Approved by: baude
2018-07-12 01:38:30 +00:00
ca6ffbccc2 Refactor unittest for change in history API
* test_images.TestImages.test_history changed to allow
  '<missing>' as legal image ID.  Previously all layers
  used the image ID.  Now layer 0 reports '<missing>'.

Signed-off-by: Jhon Honce <jhonce@redhat.com>

Closes: #1056
Approved by: jwhonce
2018-07-06 21:59:36 +00:00
8aed3857d3 contrib/python/test/test_tunnel: Fix -nNT -> -nNTq
Catching the tests up with 60427ab3 (add podman remote client,
2018-06-22, #986) to avoid non-fatal smoketest failures like [1]:

  ======================================================================
  FAIL: test_tunnel (test.test_tunnel.TestTunnel)
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "/usr/lib64/python3.6/unittest/mock.py", line 1179, in patched
      return func(*args, **keywargs)
    File "/go/src/github.com/projectatomic/libpod/contrib/python/test/test_tunnel.py", line 79, in test_tunnel
      mock_Popen.assert_called_once_with(cmd, close_fds=True)
    File "/usr/lib64/python3.6/unittest/mock.py", line 825, in assert_called_once_with
      return self.assert_called_with(*args, **kwargs)
    File "/usr/lib64/python3.6/unittest/mock.py", line 814, in assert_called_with
      raise AssertionError(_error_message()) from cause
  AssertionError: Expected call: Popen(['ssh', '-nNT', '-L', '/tmp/user/socket:/run/podman/socket', '-i', '~/.ssh/id_rsa', 'ssh://user@hostname'], close_fds=True)
  Actual call: Popen(['ssh', '-nNTq', '-L', '/tmp/user/socket:/run/podman/socket', '-i', '~/.ssh/id_rsa', 'ssh://user@hostname'], close_fds=True)

[1]: 0d792d5c92.1.1529764423989739036/output.log

Signed-off-by: W. Trevor King <wking@tremily.us>

Closes: #1035
Approved by: mheon
2018-07-06 16:38:42 +00:00
60427ab3d2 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
2018-06-27 04:52:22 +00:00