Browse Source

Merge "Ensure we don't pass empty params"

tags/0.2.0
Zuul 3 months ago
committed by Gerrit Code Review
parent
commit
9b4c8bf98a
2 changed files with 12 additions and 5 deletions
  1. +6
    -5
      plugins/filter/shell_args.py
  2. +6
    -0
      tests/plugins/filter/test_shell_args.py

+ 6
- 5
plugins/filter/shell_args.py View File

@@ -34,9 +34,10 @@ class FilterModule(object):
arg = [arg]
return_value = []
for a in arg:
val = quote(a)
if parameter:
return_value.append("{} {}".format(parameter, val))
else:
return_value.append(val)
if a:
val = quote(a)
if parameter:
return_value.append("{} {}".format(parameter, val))
else:
return_value.append(val)
return ' '.join(return_value)

+ 6
- 0
tests/plugins/filter/test_shell_args.py View File

@@ -53,3 +53,9 @@ class TestShellArgsFilters(tests_base.TestCase):
expected = "'a b'"
self.assertEqual(expected,
self.filter.shell_arg_list(arg))

def test_shell_arg_list_avoid_none_in_list(self):
arg = ['a', None]
expected = '-p a'
self.assertEqual(expected,
self.filter.shell_arg_list(arg, parameter='-p'))

Loading…
Cancel
Save