@@ -135,6 +135,11 @@ class base_client_job(base_job.base_job):
return autodir, clientdir, None
+ @classmethod
+ def _parse_args(cls, args):
+ return re.findall("[^\s]*?['|\"].*?['|\"]|[^\s]+", args)
+
+
def _find_resultdir(self, options):
"""
Determine the directory for storing results. On a client this is
@@ -243,7 +248,7 @@ class base_client_job(base_job.base_job):
self.args = []
if options.args:
- self.args = options.args.split()
+ self.args = self._parse_args(options.args)
if options.user:
self.user = options.user
@@ -694,5 +694,18 @@ class test_base_job(unittest.TestCase):
self.god.check_playback()
+ def test_parse_args(self):
+ test_set = {"a='foo bar baz' b='moo apt'":
+ ["a='foo bar baz'", "b='moo apt'"],
+ "a='foo bar baz' only=gah":
+ ["a='foo bar baz'", "only=gah"],
+ "a='b c d' no=argh":
+ ["a='b c d'", "no=argh"]}
+ for t in test_set:
+ parsed_args = job.base_client_job._parse_args(t)
+ expected_args = test_set[t]
+ self.assertEqual(parsed_args, expected_args)
+
+
if __name__ == "__main__":
unittest.main()