mirror of
https://github.com/ansible/awx.git
synced 2026-05-14 04:47:44 -02:30
* Fix incorrectly passed keywords with exclude-strings arg to ansible-runner worker cleanup command * Keep the quotes for each arg and adjust test_receptor --------- Signed-off-by: Sasa Jovicic <jovicic.sasa@hotmail.com> Co-authored-by: Sasa Jovicic <jovicic.sasa@hotmail.com>
This commit is contained in:
@@ -360,7 +360,7 @@ def _convert_args_to_cli(vargs):
|
|||||||
args = ['cleanup']
|
args = ['cleanup']
|
||||||
for option in ('exclude_strings', 'remove_images'):
|
for option in ('exclude_strings', 'remove_images'):
|
||||||
if vargs.get(option):
|
if vargs.get(option):
|
||||||
args.append('--{}="{}"'.format(option.replace('_', '-'), ' '.join(vargs.get(option))))
|
args.append('--{} {}'.format(option.replace('_', '-'), ' '.join(f'"{item}"' for item in vargs.get(option))))
|
||||||
for option in ('file_pattern', 'image_prune', 'process_isolation_executable', 'grace_period'):
|
for option in ('file_pattern', 'image_prune', 'process_isolation_executable', 'grace_period'):
|
||||||
if vargs.get(option) is True:
|
if vargs.get(option) is True:
|
||||||
args.append('--{}'.format(option.replace('_', '-')))
|
args.append('--{}'.format(option.replace('_', '-')))
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ from awx.main.tasks.receptor import _convert_args_to_cli
|
|||||||
|
|
||||||
def test_file_cleanup_scenario():
|
def test_file_cleanup_scenario():
|
||||||
args = _convert_args_to_cli({'exclude_strings': ['awx_423_', 'awx_582_'], 'file_pattern': '/tmp/awx_*_*'})
|
args = _convert_args_to_cli({'exclude_strings': ['awx_423_', 'awx_582_'], 'file_pattern': '/tmp/awx_*_*'})
|
||||||
assert ' '.join(args) == 'cleanup --exclude-strings="awx_423_ awx_582_" --file-pattern=/tmp/awx_*_*'
|
assert ' '.join(args) == 'cleanup --exclude-strings "awx_423_" "awx_582_" --file-pattern=/tmp/awx_*_*'
|
||||||
|
|
||||||
|
|
||||||
def test_image_cleanup_scenario():
|
def test_image_cleanup_scenario():
|
||||||
@@ -17,5 +17,6 @@ def test_image_cleanup_scenario():
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
assert (
|
assert (
|
||||||
' '.join(args) == 'cleanup --remove-images="quay.invalid/foo/bar:latest quay.invalid/foo/bar:devel" --image-prune --process-isolation-executable=podman'
|
' '.join(args)
|
||||||
|
== 'cleanup --remove-images "quay.invalid/foo/bar:latest" "quay.invalid/foo/bar:devel" --image-prune --process-isolation-executable=podman'
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user