From 7764d9ce4596fcc4fa754a46640f045e2443016d Mon Sep 17 00:00:00 2001 From: John R Barker Date: Sat, 12 May 2018 16:07:54 +0100 Subject: [PATCH] "route" has to be the first option in ufw command (#31756) (#40019) * "route" has to be the first option in ufw command (#31756) For supporting deletion of ufw routes, route option has to be placed before delete option (cherry picked from commit 21004d86f9486684005672a19e90a3bd13b8ad5a) * Changelog --- changelogs/fragments/ufw-route-first-option.yaml | 2 ++ lib/ansible/modules/system/ufw.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/ufw-route-first-option.yaml diff --git a/changelogs/fragments/ufw-route-first-option.yaml b/changelogs/fragments/ufw-route-first-option.yaml new file mode 100644 index 00000000000..11f67862f24 --- /dev/null +++ b/changelogs/fragments/ufw-route-first-option.yaml @@ -0,0 +1,2 @@ +bugfixes: +- Fix ufw module, "route" has to be the first option in ufw command https://github.com/ansible/ansible/pull/31756 diff --git a/lib/ansible/modules/system/ufw.py b/lib/ansible/modules/system/ufw.py index 7b8eb75c717..a887b375147 100644 --- a/lib/ansible/modules/system/ufw.py +++ b/lib/ansible/modules/system/ufw.py @@ -314,11 +314,11 @@ def main(): elif command == 'rule': # Rules are constructed according to the long format # - # ufw [--dry-run] [delete] [insert NUM] [route] allow|deny|reject|limit [in|out on INTERFACE] [log|log-all] \ + # ufw [--dry-run] [route] [delete] [insert NUM] allow|deny|reject|limit [in|out on INTERFACE] [log|log-all] \ # [from ADDRESS [port PORT]] [to ADDRESS [port PORT]] \ # [proto protocol] [app application] [comment COMMENT] - cmd.append([module.boolean(params['delete']), 'delete']) cmd.append([module.boolean(params['route']), 'route']) + cmd.append([module.boolean(params['delete']), 'delete']) cmd.append([params['insert'], "insert %s" % params['insert']]) cmd.append([value]) cmd.append([params['direction'], "%s" % params['direction']])