From 7b9a33a29007ed302c3001566061e22c514cde64 Mon Sep 17 00:00:00 2001 From: "Bradley A. Thornton" Date: Fri, 9 Aug 2019 10:42:04 -0700 Subject: bt_yapfed --- plugins/modules/vyos_logging.py | 48 ++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 20 deletions(-) (limited to 'plugins/modules/vyos_logging.py') diff --git a/plugins/modules/vyos_logging.py b/plugins/modules/vyos_logging.py index a94a8bd2..e682e42f 100644 --- a/plugins/modules/vyos_logging.py +++ b/plugins/modules/vyos_logging.py @@ -19,9 +19,11 @@ # along with Ansible. If not, see . # -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'network'} +ANSIBLE_METADATA = { + 'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'network' +} DOCUMENTATION = """ --- @@ -117,7 +119,6 @@ from ansible_collections.vyos.vyos.plugins.module_utils.network. \ vyos.vyos import vyos_argument_spec - def spec_to_commands(updates, module): commands = list() want, have = updates @@ -132,18 +133,22 @@ def spec_to_commands(updates, module): if state == 'absent' and w in have: if w['name']: - commands.append('delete system syslog {0} {1} facility {2} level {3}'.format( - dest, name, facility, level)) + commands.append( + 'delete system syslog {0} {1} facility {2} level {3}'. + format(dest, name, facility, level)) else: - commands.append('delete system syslog {0} facility {1} level {2}'.format( - dest, facility, level)) + commands.append( + 'delete system syslog {0} facility {1} level {2}'.format( + dest, facility, level)) elif state == 'present' and w not in have: if w['name']: - commands.append('set system syslog {0} {1} facility {2} level {3}'.format( - dest, name, facility, level)) + commands.append( + 'set system syslog {0} {1} facility {2} level {3}'.format( + dest, name, facility, level)) else: - commands.append('set system syslog {0} facility {1} level {2}'.format( - dest, facility, level)) + commands.append( + 'set system syslog {0} facility {1} level {2}'.format( + dest, facility, level)) return commands @@ -175,10 +180,12 @@ def config_to_dict(module): match = re.search(r'level (\S+)', line, re.M) level = match.group(1).strip("'") - obj.append({'dest': dest, - 'name': name, - 'facility': facility, - 'level': level}) + obj.append({ + 'dest': dest, + 'name': name, + 'facility': facility, + 'level': level + }) return obj @@ -215,7 +222,8 @@ def main(): """ main entry point for module execution """ element_spec = dict( - dest=dict(type='str', choices=['console', 'file', 'global', 'host', 'user']), + dest=dict(type='str', + choices=['console', 'file', 'global', 'host', 'user']), name=dict(type='str'), facility=dict(type='str'), level=dict(type='str'), @@ -227,9 +235,9 @@ def main(): # remove default in aggregate spec, to handle common arguments remove_default_spec(aggregate_spec) - argument_spec = dict( - aggregate=dict(type='list', elements='dict', options=aggregate_spec), - ) + argument_spec = dict(aggregate=dict(type='list', + elements='dict', + options=aggregate_spec), ) argument_spec.update(element_spec) -- cgit v1.2.3