Commit 1408f0c6 authored by Xavier Thompson's avatar Xavier Thompson

cli/request: Add --parameters-file option

parent a244d797
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
# #
############################################################################## ##############################################################################
import json
import pprint import pprint
from slapos.cli.config import ClientConfigCommand from slapos.cli.config import ClientConfigCommand
...@@ -78,7 +79,12 @@ class RequestCommand(ClientConfigCommand): ...@@ -78,7 +79,12 @@ class RequestCommand(ClientConfigCommand):
action='store_true', action='store_true',
help='Ask for a slave instance') help='Ask for a slave instance')
ap.add_argument('--parameters', parameter_args = parser.add_mutually_exclusive_group()
parameter_args.add_argument('--parameters-file',
help="Give a configuration file in JSON format")
parameter_args.add_argument('--parameters',
nargs='+', nargs='+',
help="Give your configuration 'option1=value1 option2=value2'") help="Give your configuration 'option1=value1 option2=value2'")
...@@ -86,6 +92,10 @@ class RequestCommand(ClientConfigCommand): ...@@ -86,6 +92,10 @@ class RequestCommand(ClientConfigCommand):
def take_action(self, args): def take_action(self, args):
args.node = parse_option_dict(args.node) args.node = parse_option_dict(args.node)
if args.parameters_file:
with open(args.parameters_file) as f:
args.parameters = json.load(f)
else:
args.parameters = parse_option_dict(args.parameters) args.parameters = parse_option_dict(args.parameters)
configp = self.fetch_config(args) configp = self.fetch_config(args)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment