saltstack/salt — pull request #5497 by ageron (2013-06-12 09:58:43+00:00)
Title: Fixed compound commands parsing: do not split arguments

This fixes the compound commands parsing, by not joining and splitting existing arguments.

For example, this would bomb:

salt '*' cmd.run,some.func 'echo "hello world"',a b c

The previous code would join all arguments into a single string `echo "hello world",a b c` then split it on commas: `[["echo", '"hello', 'world"'], ["a", "b", "c"]]`.

This pull request leaves arguments intact, except the ones that contain commas (they are split on commas). So the previous command would chop arguments as you would expect, into `[['echo "hello world"'], ["a", "b", "c"]]`.

It also fixes another issue: empty strings could not be passed as arguments. For example:

salt '*' some.func1,some.func2 one 1 two 2, three 3 empty "" four 4

This command would split arguments like this: `[["one", "1", "two", "2"], ["three", "3", "empty", "four", "4"]]`. The empty string disappeared.

This pull request fixes this empty strings bug and splits arguments like this: `[["one", "1", "two", "2"], ["three", "3", "empty", "", "four", "4"]]`.