diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2018-11-30 11:09:56 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-30 11:09:56 -0800 |
commit | 5b738ea7ff5c3df242050f12b94c139c121a9ad0 (patch) | |
tree | 7a95abd7b9af5ebf91fa1744e6e3c627bf60a3d3 | |
parent | b504623a1153c761604196dcd907cbdf165afa8b (diff) | |
parent | 3d0cdd898c349c736bf08d53acfbb6d2d4b19e2f (diff) | |
download | podman-5b738ea7ff5c3df242050f12b94c139c121a9ad0.tar.gz podman-5b738ea7ff5c3df242050f12b94c139c121a9ad0.tar.bz2 podman-5b738ea7ff5c3df242050f12b94c139c121a9ad0.zip |
Merge pull request #1886 from edsantiago/pypod_run_args
pypod run: ignore args intended for container command
3 files changed, 4 insertions, 2 deletions
diff --git a/contrib/python/pypodman/pypodman/lib/actions/create_action.py b/contrib/python/pypodman/pypodman/lib/actions/create_action.py index d9631763a..26a312bb1 100644 --- a/contrib/python/pypodman/pypodman/lib/actions/create_action.py +++ b/contrib/python/pypodman/pypodman/lib/actions/create_action.py @@ -21,7 +21,7 @@ class Create(AbstractActionBase): parser.add_argument('image', nargs=1, help='source image id') parser.add_argument( 'command', - nargs='*', + nargs=parent.REMAINDER, help='command and args to run.', ) parser.set_defaults(class_=cls, method='create') diff --git a/contrib/python/pypodman/pypodman/lib/actions/run_action.py b/contrib/python/pypodman/pypodman/lib/actions/run_action.py index a63eb7917..6a6b3cb2c 100644 --- a/contrib/python/pypodman/pypodman/lib/actions/run_action.py +++ b/contrib/python/pypodman/pypodman/lib/actions/run_action.py @@ -21,7 +21,7 @@ class Run(AbstractActionBase): parser.add_argument('image', nargs=1, help='source image id.') parser.add_argument( 'command', - nargs='*', + nargs=parent.REMAINDER, help='command and args to run.', ) parser.set_defaults(class_=cls, method='run') diff --git a/contrib/python/pypodman/pypodman/lib/podman_parser.py b/contrib/python/pypodman/pypodman/lib/podman_parser.py index 28fb44cf0..412c8c8fd 100644 --- a/contrib/python/pypodman/pypodman/lib/podman_parser.py +++ b/contrib/python/pypodman/pypodman/lib/podman_parser.py @@ -97,6 +97,8 @@ class PodmanArgumentParser(argparse.ArgumentParser): actions_parser = self.add_subparsers( dest='subparser_name', help='commands') + # For create/exec/run: don't process options intended for subcommand + actions_parser.REMAINDER = argparse.REMAINDER # import buried here to prevent import loops import pypodman.lib.actions # pylint: disable=cyclic-import |