From c594f1e1c9c8aa7014641ce0835bd80b0c2c5f67 Mon Sep 17 00:00:00 2001 From: David Newswanger Date: Fri, 28 Jul 2017 12:20:09 -0400 Subject: [PATCH] fixed nontype error (#27428) --- .../modules/network/ios/ios_logging.py | 14 +++++----- .../targets/ios_logging/tests/cli/basic.yaml | 26 +++++++++++++++++++ 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/lib/ansible/modules/network/ios/ios_logging.py b/lib/ansible/modules/network/ios/ios_logging.py index 698c6c40214..b9019b04159 100644 --- a/lib/ansible/modules/network/ios/ios_logging.py +++ b/lib/ansible/modules/network/ios/ios_logging.py @@ -232,17 +232,17 @@ def map_config_to_obj(module): for line in data.split('\n'): match = re.search(r'logging (\S+)', line, re.M) + if match: + if match.group(1) in dest_group: + dest = match.group(1) - if match.group(1) in dest_group: - dest = match.group(1) - else: - pass - - obj.append({'dest': dest, + obj.append({ + 'dest': dest, 'name': parse_name(line, dest), 'size': parse_size(line, dest), 'facility': parse_facility(line), - 'level': parse_level(line, dest)}) + 'level': parse_level(line, dest) + }) return obj diff --git a/test/integration/targets/ios_logging/tests/cli/basic.yaml b/test/integration/targets/ios_logging/tests/cli/basic.yaml index 468d3611dd1..be365d9a178 100644 --- a/test/integration/targets/ios_logging/tests/cli/basic.yaml +++ b/test/integration/targets/ios_logging/tests/cli/basic.yaml @@ -1,4 +1,30 @@ --- +# ensure logging configs are empty +- name: Remove host logging + ios_logging: + dest: host + name: 172.16.0.1 + state: absent + authorize: yes + provider: "{{ cli }}" + +- name: Remove console + ios_logging: + dest: console + level: warnings + state: absent + authorize: yes + provider: "{{ cli }}" + +- name: Remove buffer + ios_logging: + dest: buffered + size: 8000 + authorize: yes + state: absent + provider: "{{ cli }}" + +# start tests - name: Set up host logging ios_logging: dest: host