Commit b35ab356 authored by Arnaud Fontaine's avatar Arnaud Fontaine

Check property the positional arguments of slapos-request.

parent 700051f5
...@@ -64,6 +64,17 @@ class Parser(OptionParser): ...@@ -64,6 +64,17 @@ class Parser(OptionParser):
return options, args return options, args
class RequestParser(Parser):
def check_args(self):
"""
Check arguments
"""
(options, args) = Parser.check_args(self)
if len(args) < 3:
self.error("Incorrect number of arguments")
return options, args
class Config: class Config:
def setConfig(self, option_dict, configuration_file_path): def setConfig(self, option_dict, configuration_file_path):
""" """
...@@ -129,7 +140,7 @@ def request(): ...@@ -129,7 +140,7 @@ def request():
usage = """usage: %s [options] CONFIGURATION_FILE SOFTWARE_INSTANCE INSTANCE_REFERENCE usage = """usage: %s [options] CONFIGURATION_FILE SOFTWARE_INSTANCE INSTANCE_REFERENCE
slapos-request allows you to request slapos instances.""" % sys.argv[0] slapos-request allows you to request slapos instances.""" % sys.argv[0]
config = Config() config = Config()
options, arguments = Parser(usage=usage).check_args() options, arguments = RequestParser(usage=usage).check_args()
config.setConfig(options, arguments[0]) config.setConfig(options, arguments[0])
local = init(config) local = init(config)
......
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