Make second group match of ufw status output optional (#56678)
* Make second group match of ufw status output optional Fixes #56674 * Fix comparison logic. * Add changelog fragment
This commit is contained in:
parent
86928a5f74
commit
1d22909f7c
2 changed files with 6 additions and 2 deletions
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- ufw - correctly check status when logging is off (https://github.com/ansible/ansible/issues/56674)
|
|
@ -445,12 +445,14 @@ def main():
|
|||
execute(cmd + [['-f'], [states[value]]])
|
||||
|
||||
elif command == 'logging':
|
||||
extract = re.search(r'Logging: (on|off) \(([a-z]+)\)', pre_state)
|
||||
extract = re.search(r'Logging: (on|off)(?: \(([a-z]+)\))?', pre_state)
|
||||
if extract:
|
||||
current_level = extract.group(2)
|
||||
current_on_off_value = extract.group(1)
|
||||
if value != "off":
|
||||
if value != "on" and (value != current_level or current_on_off_value == "off"):
|
||||
if current_on_off_value == "off":
|
||||
changed = True
|
||||
elif value != "on" and value != current_level:
|
||||
changed = True
|
||||
elif current_on_off_value != "off":
|
||||
changed = True
|
||||
|
|
Loading…
Reference in a new issue