Commit 4a992aaa authored by Nicolas Wavrant's avatar Nicolas Wavrant

monitor: delegate argument checking to argparse

So instead of a traceback we get a better error message
written by argparse. Also , it will print a better help
message
parent ea09102f
...@@ -28,7 +28,7 @@ def getArgumentParser(): ...@@ -28,7 +28,7 @@ def getArgumentParser():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('-c', '--config', dest='config_file', parser.add_argument('-c', '--config', dest='config_file',
help='The Path of configuration file to load.') help='The Path of configuration file to load.')
parser.add_argument('-p', '--partition-folder', parser.add_argument('-p', '--partition-folder', required=True,
help='Base path of the partition.') help='Base path of the partition.')
parser.add_argument('-L', '--log-folder', parser.add_argument('-L', '--log-folder',
help='Folder where promises will write logs.') help='Folder where promises will write logs.')
...@@ -124,9 +124,6 @@ class MonitorPromiseLauncher(object): ...@@ -124,9 +124,6 @@ class MonitorPromiseLauncher(object):
with open(self.config.pid_path, 'w') as fpid: with open(self.config.pid_path, 'w') as fpid:
fpid.write(str(os.getpid())) fpid.write(str(os.getpid()))
if not self.config.partition_folder:
raise ValueError("Partition folder is not specified")
parameter_dict = { parameter_dict = {
'promise-timeout': self.config.promise_timeout or promise_timeout, 'promise-timeout': self.config.promise_timeout or promise_timeout,
'promise-folder': os.path.join(self.config.partition_folder, 'etc', 'plugin'), 'promise-folder': os.path.join(self.config.partition_folder, 'etc', 'plugin'),
......
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