Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add icon_path to each modular alert conf #325

Merged
2 commits merged into from
Aug 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .licenserc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ header:
- "splunk_add_on_ucc_framework/templates/*"
- "splunk_add_on_ucc_framework/arf_dir_templates/modular_alert_package.settings"
- "splunk_add_on_ucc_framework/modular_alert_builder/build_core/arf_template/**"
- "splunk_add_on_ucc_framework/modular_alert_builder/build_core/alert_actions_conf_default_settings.json"
- "tests/**"
- ".*"

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import json
import os
from json import loads as jloads
from os import linesep
from os import path as op

Expand Down Expand Up @@ -98,7 +97,6 @@ def get_icon_path(self, alert, create_dir_path=True):
class AlertActionsConfGeneration(AlertActionsConfBase):
DEFAULT_CONF_TEMPLATE = "alert_actions.conf.template"
DEFAULT_SPEC_TEMPLATE = "alert_actions.conf.spec.template"
DEFAULT_SETTINGS_FILE = "alert_actions_conf_default_settings.json"
DEFAULT_EVENTTYPES_TEMPLATE = "eventtypes.conf.template"
DEFAULT_TAGS_TEMPLATE = "tags.conf.template"

Expand Down Expand Up @@ -126,10 +124,12 @@ def __init__(
ac.PARAMETERS,
]
self._remove_fields = [ac.SHORT_NAME] + self._html_fields
self._default_settings_file = default_settings_file or op.join(
op.dirname(op.abspath(__file__)),
AlertActionsConfGeneration.DEFAULT_SETTINGS_FILE,
)
self._default_conf_settings = {
"python.version": "python3",
"is_custom": 1,
"payload_format": "json",
"icon_path": "alerticon.png",
}
self._output = {}

def generate_conf(self):
Expand Down Expand Up @@ -300,13 +300,10 @@ def handle(self):
self.generate_tags()

def add_default_settings(self):
with open(self._default_settings_file) as df:
default_settings = jloads(df.read())

for alert in self._alert_settings:
if ac.ALERT_PROPS not in list(alert.keys()):
alert[ac.ALERT_PROPS] = {}
for k, v in list(default_settings.items()):
for k, v in list(self._default_conf_settings.items()):
if k in list(alert[ac.ALERT_PROPS].keys()):
continue

Expand Down
1 change: 1 addition & 0 deletions tests/data/test_ucc_generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def test_ucc_generate_with_inputs_configuration_alerts(self):
# Expected add-on package folder does not have "lib" in it.
files_to_be_equal = [
("README.txt",),
("default", "alert_actions.conf"),
("default", "eventtypes.conf"),
("default", "inputs.conf"),
("default", "restmap.conf"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ param._cam = {"task": ["Create", "Update"], "subject": ["endpoint"], "category":
python.version = python3
is_custom = 1
payload_format = json
icon_path = alerticon.png
param.name = xyz
param.all_incidents =
param.table_list = problem
Expand Down
5 changes: 0 additions & 5 deletions tests/unit/test_alert_actions_conf_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,6 @@ def test_generate_alert_action(self):
},
},
],
"alert_props": {
"python.version": "python3",
"is_custom": 1,
"payload_format": "json",
},
}
],
},
Expand Down
5 changes: 0 additions & 5 deletions tests/unit/test_alert_actions_html_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,6 @@ def test_generate_alert_action(self):
},
},
],
"alert_props": {
"python.version": "python3",
"is_custom": 1,
"payload_format": "json",
},
}
],
},
Expand Down
5 changes: 0 additions & 5 deletions tests/unit/test_alert_actions_py_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,6 @@ def test_generate_alert_action(self):
},
},
],
"alert_props": {
"python.version": "python3",
"is_custom": 1,
"payload_format": "json",
},
}
],
},
Expand Down
1 change: 1 addition & 0 deletions tests/unit/testdata/alert_actions.conf.generated
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ param._cam = {"task": ["Create", "Update"], "subject": ["endpoint"], "category":
python.version = python3
is_custom = 1
payload_format = json
icon_path = alerticon.png
param.name = xyz
param.all_incidents =
param.table_list = problem
Expand Down