Skip to content

Commit 0bba60c

Browse files
Dev-Sinha13lhercot
authored andcommitted
[ignore] Added a constant for format
1 parent 1044be9 commit 0bba60c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

plugins/module_utils/constants.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747
vmware="VMware",
4848
)
4949

50+
SYSLOG_FORMATS = {"enhanced_log": "rfc5424-ts", "nxos": "nxos", "aci": "aci", "rfc5424-ts": "rfc5424-ts"}
51+
5052
MATCH_TYPE_GROUP_MAPPING = {"all": "ALL", "all_in_pod": "ALL_IN_POD", "range": "range"}
5153

5254
MATCH_FC_FILL_PATTERN_MAPPING = {"arbff": "ARBFF", "idle": "IDLE"}

plugins/modules/aci_syslog_group.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@
286286

287287
from ansible_collections.cisco.aci.plugins.module_utils.aci import ACIModule, aci_argument_spec, aci_annotation_spec
288288
from ansible.module_utils.basic import AnsibleModule
289+
from ansible_collections.cisco.aci.plugins.module_utils.constants import SYSLOG_FORMATS
289290

290291

291292
def main():
@@ -321,15 +322,12 @@ def main():
321322
aci = ACIModule(module)
322323

323324
name = module.params.get("name")
324-
main_format = module.params.get("format")
325-
format = "rfc5424-ts" if main_format == "enhanced_log" else main_format
325+
format = SYSLOG_FORMATS.get(module.params.get("format"))
326326
admin_state = module.params.get("admin_state")
327327
console_logging = module.params.get("console_logging")
328328
console_log_severity = module.params.get("console_log_severity")
329-
console_format = module.params.get("console_log_format")
330-
console_log_format = "rfc5424-ts" if console_format == "enhanced_log" else console_format
331-
local_format = module.params.get("local_file_log_format")
332-
local_file_log_format = "rfc5424-ts" if local_format == "enhanced_log" else local_format
329+
console_log_format = SYSLOG_FORMATS.get(module.params.get("console_log_format"))
330+
local_file_log_format = SYSLOG_FORMATS.get(module.params.get("local_file_log_format"))
333331
local_file_logging = module.params.get("local_file_logging")
334332
local_file_log_severity = module.params.get("local_file_log_severity")
335333
include_ms = aci.boolean(module.params.get("include_ms"))

0 commit comments

Comments
 (0)