Merge "Allow zun exec to take arbitrary number of arguments"
This commit is contained in:
commit
a172d5977b
@ -10,6 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import argparse
|
||||
import logging
|
||||
|
||||
from osc_lib.command import command
|
||||
@ -337,13 +338,14 @@ class ExecContainer(command.Command):
|
||||
parser.add_argument(
|
||||
'command',
|
||||
metavar='<command>',
|
||||
nargs=argparse.REMAINDER,
|
||||
help='The command to execute.')
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
client = _get_client(self, parsed_args)
|
||||
container = parsed_args.container
|
||||
command = getattr(parsed_args, 'command')
|
||||
command = ' '.join(parsed_args.command)
|
||||
output = client.containers.execute(container, command)
|
||||
print(output)
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import argparse
|
||||
import json
|
||||
|
||||
from zunclient.common import cliutils as utils
|
||||
@ -293,10 +294,11 @@ def do_logs(cs, args):
|
||||
help='ID or name of the container to execute command in.')
|
||||
@utils.arg('command',
|
||||
metavar='<command>',
|
||||
nargs=argparse.REMAINDER,
|
||||
help='The command to execute in a container')
|
||||
def do_exec(cs, args):
|
||||
"""Execute command in a container."""
|
||||
output = cs.containers.execute(args.container, args.command)
|
||||
output = cs.containers.execute(args.container, ' '.join(args.command))
|
||||
print(output)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user