Commit b0c5cb3f authored by Nicolas Wavrant's avatar Nicolas Wavrant

Revert "monitor: delegate argument checking to argparse"

This reverts commit 4a992aaa.

runpromise takes arguments from command line, but also read some from
a config file, so indeed it is mandatory to know partition_folder's
value, but it is not mandatory to pass it as an argument from the
command line
parent a28fa444
...@@ -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', required=True, parser.add_argument('-p', '--partition-folder',
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,6 +124,9 @@ class MonitorPromiseLauncher(object): ...@@ -124,6 +124,9 @@ 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