Skip to content

Commit

Permalink
chore: removed redundant checks
Browse files Browse the repository at this point in the history
  • Loading branch information
hetangmodi-crest committed Sep 18, 2024
1 parent e55f298 commit 9426882
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions splunk_add_on_ucc_framework/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import shutil
from os import listdir, makedirs, path, remove, sep
from os.path import basename as bn
from os.path import dirname, exists, isdir, isfile, join
from os.path import dirname, exists, isdir, join
from typing import Any, Dict

import addonfactory_splunk_conf_parser_lib as conf_parser
Expand Down Expand Up @@ -112,10 +112,6 @@ def merge_conf_file(
src_file: str, dst_file: str, merge_mode: str = "stanza_overwrite"
) -> None:
merge_deny_list = ["default.meta", "README.txt"]
if not isfile(src_file):
return
if not isfile(dst_file):
return
if bn(src_file) in merge_deny_list:
return

Expand All @@ -127,21 +123,21 @@ def merge_conf_file(
dst_dict = parser.item_dict()

if merge_mode == "stanza_overwrite":
for stanza, key_values in list(src_dict.items()):
for stanza, key_values in src_dict.items():
if stanza not in dst_dict:
parser.add_section(stanza)
else:
parser.remove_section(stanza)
parser.add_section(stanza)

for k, v in list(key_values.items()):
for k, v in key_values.items():
parser.set(stanza, k, v)
elif merge_mode == "item_overwrite":
for stanza, key_values in list(src_dict.items()):
for stanza, key_values in src_dict.items():
if stanza not in dst_dict:
parser.add_section(stanza)

for k, v in list(key_values.items()):
for k, v in key_values.items():
if v:
parser.set(stanza, k, v)
else:
Expand Down

0 comments on commit 9426882

Please sign in to comment.