diff options
author | Kedar K <4506537+kedarX@users.noreply.github.com> | 2017-10-27 15:31:17 +0530 |
---|---|---|
committer | Toshio Kuratomi <a.badger@gmail.com> | 2017-11-01 08:54:33 -0700 |
commit | ac1c7b03ff8f91ebc8bcfa955381113b3b378841 (patch) | |
tree | d4fcf5208e822327c27473e00301982a64e2fb34 | |
parent | ebd559c43a34dc5707c81f9c57ddc7fdc467cbce (diff) | |
download | ansible-ac1c7b03ff8f91ebc8bcfa955381113b3b378841.tar.gz |
- Fix logging module issue where facility is being deleted along with host (#32234)
- Remove default facility, as facility is not standard on remote syslog server
(cherry picked from commit 7d5dccefe5a7c9816149dcbbbbf9fef29a725acc)
-rw-r--r-- | lib/ansible/modules/network/ios/ios_logging.py | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/ansible/modules/network/ios/ios_logging.py b/lib/ansible/modules/network/ios/ios_logging.py index c95e4e6348..3ce53f563d 100644 --- a/lib/ansible/modules/network/ios/ios_logging.py +++ b/lib/ansible/modules/network/ios/ios_logging.py @@ -180,12 +180,12 @@ def map_obj_to_commands(updates, module): return commands -def parse_facility(line): - match = re.search(r'logging facility (\S+)', line, re.M) - if match: - facility = match.group(1) - else: - facility = 'local7' +def parse_facility(line, dest): + facility = None + if dest == 'facility': + match = re.search(r'logging facility (\S+)', line, re.M) + if match: + facility = match.group(1) return facility @@ -243,7 +243,7 @@ def parse_level(line, dest): def map_config_to_obj(module): obj = [] - dest_group = ('console', 'host', 'monitor', 'buffered', 'on') + dest_group = ('console', 'host', 'monitor', 'buffered', 'on', 'facility') data = get_config(module, flags=['| section logging']) @@ -257,10 +257,9 @@ def map_config_to_obj(module): 'dest': dest, 'name': parse_name(line, dest), 'size': parse_size(line, dest), - 'facility': parse_facility(line), + 'facility': parse_facility(line, dest), 'level': parse_level(line, dest) }) - return obj @@ -333,7 +332,7 @@ def main(): dest=dict(type='str', choices=['on', 'host', 'console', 'monitor', 'buffered']), name=dict(type='str'), size=dict(type='int'), - facility=dict(type='str', default='local7'), + facility=dict(type='str'), level=dict(type='str', default='debugging'), state=dict(default='present', choices=['present', 'absent']), ) |