Skip to content

Commit 1c93133

Browse files
revert: merging of .conf files (#1873)
**Issue number:** ### PR Type **What kind of change does this PR introduce?** * [ ] Feature * [ ] Bug Fix * [ ] Refactoring (no functional or API changes) * [ ] Documentation Update * [ ] Maintenance (dependency updates, CI, etc.) ## Summary ### Changes Revert the changes of PR #1800 and PR #1832. ### User experience Users will have the `conf` files in their output directory as configures in source directory. ## Checklist If an item doesn't apply to your changes, leave it unchecked. ### Review * [x] self-review - I have performed a self-review of this change according to the [development guidelines](https://splunk.github.io/addonfactory-ucc-generator/contributing/#development-guidelines) * [ ] Changes are documented. The documentation is understandable, examples work [(more info)](https://splunk.github.io/addonfactory-ucc-generator/contributing/#documentation-guidelines) * [x] PR title and description follows the [contributing principles](https://splunk.github.io/addonfactory-ucc-generator/contributing/#pull-requests) * [ ] meeting - I have scheduled a meeting or recorded a demo to explain these changes (if there is a video, put a link below and in the ticket) ### Tests See [the testing doc](https://splunk.github.io/addonfactory-ucc-generator/contributing/#build-and-test). * [ ] Unit - tests have been added/modified to cover the changes * [ ] Smoke - tests have been added/modified to cover the changes * [ ] UI - tests have been added/modified to cover the changes * [ ] coverage - I have checked the code coverage of my changes [(see more)](https://splunk.github.io/addonfactory-ucc-generator/contributing/#checking-the-code-coverage) **Demo/meeting:** *Reviewers are encouraged to request meetings or demos if any part of the change is unclear*
1 parent 8784219 commit 1c93133

File tree

9 files changed

+332
-44
lines changed
  • splunk_add_on_ucc_framework
  • tests/testdata
    • expected_addons
      • expected_output_global_config_everything/Splunk_TA_UCCExample/default
      • expected_output_no_global_config/Splunk_TA_UCCExample/default
    • test_addons

9 files changed

+332
-44
lines changed

splunk_add_on_ucc_framework/commands/build.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@
6060
ucc_to_oas,
6161
)
6262
from splunk_add_on_ucc_framework.generators.file_generator import begin
63+
from splunk_add_on_ucc_framework.generators.conf_files.create_app_conf import AppConf
64+
from splunk_add_on_ucc_framework.utils import write_file
6365
from splunk_add_on_ucc_framework.package_files_update import handle_package_files_update
6466

6567
logger = logging.getLogger("ucc_gen")
@@ -669,6 +671,18 @@ def generate(
669671
logger.info(
670672
f"Updated {app_manifest_lib.APP_MANIFEST_FILE_NAME} file in the output folder"
671673
)
674+
# NOTE: merging source and generated 'app.conf' as per previous design
675+
app_conf = AppConf(
676+
global_config=global_config, input_dir=source, output_dir=output_directory
677+
).generate()
678+
# we need to explicitly call write method since we are not generating
679+
# file in child classes
680+
write_file(
681+
app_conf[0]["file_name"],
682+
app_conf[0]["file_path"],
683+
app_conf[0]["content"],
684+
merge_mode=app_conf[0]["merge_mode"],
685+
)
672686
license_dir = os.path.abspath(os.path.join(source, os.pardir, "LICENSES"))
673687
if os.path.exists(license_dir):
674688
logger.info("Copy LICENSES directory")

splunk_add_on_ucc_framework/utils.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,9 @@ def recursive_overwrite(
109109
makedirs(dest)
110110
files = listdir(src)
111111
for f in files:
112-
if f.endswith(".conf"):
113-
merge_conf_file(
114-
join(src, f), join(dest, f), merge_mode="item_overwrite"
115-
)
116-
else:
117-
recursive_overwrite(
118-
join(src, f), join(dest, f), ui_source_map, has_dashboard
119-
)
112+
recursive_overwrite(
113+
join(src, f), join(dest, f), ui_source_map, has_dashboard
114+
)
120115
else:
121116
if exists(dest):
122117
remove(dest)

tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/restmap.conf

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
[admin:splunk_ta_uccexample]
22
match = /
3-
members = splunk_ta_uccexample_account, splunk_ta_uccexample_custom_amd_row_tab, splunk_ta_uccexample_custom_row_tab, splunk_ta_uccexample_example_input_four, splunk_ta_uccexample_example_input_one, splunk_ta_uccexample_example_input_three, splunk_ta_uccexample_example_input_two, splunk_ta_uccexample_oauth, splunk_ta_uccexample_service_hidden_for_cloud, splunk_ta_uccexample_service_hidden_for_enterprise, splunk_ta_uccexample_service_inside_menu_four, splunk_ta_uccexample_service_inside_menu_one, splunk_ta_uccexample_service_inside_menu_three, splunk_ta_uccexample_service_inside_menu_two, splunk_ta_uccexample_service_with_conf_param, splunk_ta_uccexample_settings, splunk_ta_uccexample_tab_hidden_for_cloud, splunk_ta_uccexample_tab_hidden_for_enterprise
3+
members = splunk_ta_uccexample_account, splunk_ta_uccexample_custom_row_tab, splunk_ta_uccexample_custom_amd_row_tab, splunk_ta_uccexample_example_input_four, splunk_ta_uccexample_example_input_one, splunk_ta_uccexample_example_input_three, splunk_ta_uccexample_example_input_two, splunk_ta_uccexample_oauth, splunk_ta_uccexample_service_hidden_for_cloud, splunk_ta_uccexample_service_hidden_for_enterprise, splunk_ta_uccexample_service_inside_menu_four, splunk_ta_uccexample_service_inside_menu_one, splunk_ta_uccexample_service_inside_menu_three, splunk_ta_uccexample_service_inside_menu_two, splunk_ta_uccexample_service_with_conf_param, splunk_ta_uccexample_settings, splunk_ta_uccexample_tab_hidden_for_cloud, splunk_ta_uccexample_tab_hidden_for_enterprise
44

5-
[admin_external:splunk_ta_uccexample_oauth]
6-
handlertype = python
7-
python.version = python3
8-
handlerfile = splunk_ta_uccexample_rh_oauth.py
9-
handleractions = edit
10-
handlerpersistentmode = true
5+
[admin:non_ui_rest_handlers]
6+
match = /splunk_ta_uccexample
7+
members = dependent_dropdown
118

129
[admin_external:splunk_ta_uccexample_account]
1310
handlertype = python
@@ -16,6 +13,20 @@ handlerfile = splunk_ta_uccexample_rh_account.py
1613
handleractions = edit, list, remove, create
1714
handlerpersistentmode = true
1815

16+
[admin_external:dependent_dropdown]
17+
handlertype = python
18+
python.version = python3
19+
handlerfile = dependent_dropdown.py
20+
handleractions = list
21+
handlerpersistentmode = true
22+
23+
[admin_external:splunk_ta_uccexample_oauth]
24+
handlertype = python
25+
python.version = python3
26+
handlerfile = splunk_ta_uccexample_rh_oauth.py
27+
handleractions = edit
28+
handlerpersistentmode = true
29+
1930
[admin_external:splunk_ta_uccexample_custom_row_tab]
2031
handlertype = python
2132
python.version = python3
@@ -127,14 +138,3 @@ python.version = python3
127138
handlerfile = splunk_ta_uccexample_rh_service_inside_menu_four.py
128139
handleractions = edit, list, remove, create
129140
handlerpersistentmode = true
130-
131-
[admin:non_ui_rest_handlers]
132-
match = /splunk_ta_uccexample
133-
members = dependent_dropdown
134-
135-
[admin_external:dependent_dropdown]
136-
handlertype = python
137-
python.version = python3
138-
handlerfile = dependent_dropdown.py
139-
handleractions = list
140-
handlerpersistentmode = true

tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/web.conf

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
[expose:splunk_ta_uccexample_oauth]
2-
pattern = splunk_ta_uccexample_oauth
3-
methods = POST, GET
4-
5-
[expose:splunk_ta_uccexample_oauth_specified]
6-
pattern = splunk_ta_uccexample_oauth/*
7-
methods = POST, GET, DELETE
8-
91
[expose:splunk_ta_uccexample_account]
102
pattern = splunk_ta_uccexample_account
113
methods = POST, GET
@@ -14,20 +6,28 @@ methods = POST, GET
146
pattern = splunk_ta_uccexample_account/*
157
methods = POST, GET, DELETE
168

17-
[expose:splunk_ta_uccexample_custom_row_tab]
18-
pattern = splunk_ta_uccexample_custom_row_tab
9+
[expose:dependent_dropdown]
10+
pattern = splunk_ta_uccexample/dependent_dropdown
11+
methods = GET
12+
13+
[expose:splunk_ta_uccexample_oauth]
14+
pattern = splunk_ta_uccexample_oauth
1915
methods = POST, GET
2016

21-
[expose:splunk_ta_uccexample_custom_row_tab_specified]
22-
pattern = splunk_ta_uccexample_custom_row_tab/*
17+
[expose:splunk_ta_uccexample_oauth_specified]
18+
pattern = splunk_ta_uccexample_oauth/*
2319
methods = POST, GET, DELETE
2420

21+
[expose:splunk_ta_uccexample_custom_row_tab]
22+
pattern = splunk_ta_uccexample_custom_row_tab
23+
methods = POST, GET
24+
2525
[expose:splunk_ta_uccexample_custom_amd_row_tab]
2626
pattern = splunk_ta_uccexample_custom_amd_row_tab
2727
methods = POST, GET
2828

29-
[expose:splunk_ta_uccexample_custom_amd_row_tab_specified]
30-
pattern = splunk_ta_uccexample_custom_amd_row_tab/*
29+
[expose:splunk_ta_uccexample_custom_row_tab_specified]
30+
pattern = splunk_ta_uccexample_custom_row_tab/*
3131
methods = POST, GET, DELETE
3232

3333
[expose:splunk_ta_uccexample_tab_hidden_for_cloud]
@@ -141,7 +141,3 @@ methods = POST, GET
141141
[expose:splunk_ta_uccexample_service_inside_menu_four_specified]
142142
pattern = splunk_ta_uccexample_service_inside_menu_four/*
143143
methods = POST, GET, DELETE
144-
145-
[expose:dependent_dropdown]
146-
pattern = splunk_ta_uccexample/dependent_dropdown
147-
methods = GET
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
# props.conf
2+
13
[new_sourcetype]
24
EVAL-new_field = if(field2 = "hello", "world")
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
1+
[install]
2+
build = 0
13

24
[launcher]
35
author = Splunk Inc.
6+
version = 0.1.0
7+
description = Splunk Add-on for UCC Example
48

59
[ui]
10+
is_visible = true
11+
label = Splunk Add-on for UCC Example
612
docs_section_override=AddOns:released
713

14+
[package]
15+
id = Splunk_TA_UCCExample
16+
817
[shclustering]
918
deployer_push_mode = default_only
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,140 @@
1+
[admin:splunk_ta_uccexample]
2+
match = /
3+
members = splunk_ta_uccexample_account, splunk_ta_uccexample_custom_row_tab, splunk_ta_uccexample_custom_amd_row_tab, splunk_ta_uccexample_example_input_four, splunk_ta_uccexample_example_input_one, splunk_ta_uccexample_example_input_three, splunk_ta_uccexample_example_input_two, splunk_ta_uccexample_oauth, splunk_ta_uccexample_service_hidden_for_cloud, splunk_ta_uccexample_service_hidden_for_enterprise, splunk_ta_uccexample_service_inside_menu_four, splunk_ta_uccexample_service_inside_menu_one, splunk_ta_uccexample_service_inside_menu_three, splunk_ta_uccexample_service_inside_menu_two, splunk_ta_uccexample_service_with_conf_param, splunk_ta_uccexample_settings, splunk_ta_uccexample_tab_hidden_for_cloud, splunk_ta_uccexample_tab_hidden_for_enterprise
4+
15
[admin:non_ui_rest_handlers]
26
match = /splunk_ta_uccexample
37
members = dependent_dropdown
48

9+
[admin_external:splunk_ta_uccexample_account]
10+
handlertype = python
11+
python.version = python3
12+
handlerfile = splunk_ta_uccexample_rh_account.py
13+
handleractions = edit, list, remove, create
14+
handlerpersistentmode = true
15+
516
[admin_external:dependent_dropdown]
617
handlertype = python
718
python.version = python3
819
handlerfile = dependent_dropdown.py
920
handleractions = list
1021
handlerpersistentmode = true
22+
23+
[admin_external:splunk_ta_uccexample_oauth]
24+
handlertype = python
25+
python.version = python3
26+
handlerfile = splunk_ta_uccexample_rh_oauth.py
27+
handleractions = edit
28+
handlerpersistentmode = true
29+
30+
[admin_external:splunk_ta_uccexample_custom_row_tab]
31+
handlertype = python
32+
python.version = python3
33+
handlerfile = splunk_ta_uccexample_rh_custom_row_tab.py
34+
handleractions = edit, list, remove, create
35+
handlerpersistentmode = true
36+
37+
[admin_external:splunk_ta_uccexample_custom_amd_row_tab]
38+
handlertype = python
39+
python.version = python3
40+
handlerfile = splunk_ta_uccexample_rh_custom_amd_row_tab.py
41+
handleractions = edit, list, remove, create
42+
handlerpersistentmode = true
43+
44+
[admin_external:splunk_ta_uccexample_tab_hidden_for_cloud]
45+
handlertype = python
46+
python.version = python3
47+
handlerfile = splunk_ta_uccexample_rh_tab_hidden_for_cloud.py
48+
handleractions = edit, list, remove, create
49+
handlerpersistentmode = true
50+
51+
[admin_external:splunk_ta_uccexample_tab_hidden_for_enterprise]
52+
handlertype = python
53+
python.version = python3
54+
handlerfile = splunk_ta_uccexample_rh_tab_hidden_for_enterprise.py
55+
handleractions = edit, list, remove, create
56+
handlerpersistentmode = true
57+
58+
[admin_external:splunk_ta_uccexample_settings]
59+
handlertype = python
60+
python.version = python3
61+
handlerfile = splunk_ta_uccexample_rh_settings.py
62+
handleractions = edit, list
63+
handlerpersistentmode = true
64+
65+
[admin_external:splunk_ta_uccexample_example_input_one]
66+
handlertype = python
67+
python.version = python3
68+
handlerfile = splunk_ta_uccexample_rh_example_input_one.py
69+
handleractions = edit, list, remove, create
70+
handlerpersistentmode = true
71+
72+
[admin_external:splunk_ta_uccexample_example_input_two]
73+
handlertype = python
74+
python.version = python3
75+
handlerfile = splunk_ta_uccexample_rh_example_input_two.py
76+
handleractions = edit, list, remove, create
77+
handlerpersistentmode = true
78+
79+
[admin_external:splunk_ta_uccexample_example_input_three]
80+
handlertype = python
81+
python.version = python3
82+
handlerfile = splunk_ta_uccexample_rh_three_custom.py
83+
handleractions = edit, list, remove, create
84+
handlerpersistentmode = true
85+
86+
[admin_external:splunk_ta_uccexample_example_input_four]
87+
handlertype = python
88+
python.version = python3
89+
handlerfile = splunk_ta_uccexample_rh_example_input_four.py
90+
handleractions = edit, list, remove, create
91+
handlerpersistentmode = true
92+
93+
[admin_external:splunk_ta_uccexample_service_hidden_for_cloud]
94+
handlertype = python
95+
python.version = python3
96+
handlerfile = splunk_ta_uccexample_rh_service_hidden_for_cloud.py
97+
handleractions = edit, list, remove, create
98+
handlerpersistentmode = true
99+
100+
[admin_external:splunk_ta_uccexample_service_hidden_for_enterprise]
101+
handlertype = python
102+
python.version = python3
103+
handlerfile = splunk_ta_uccexample_rh_service_hidden_for_enterprise.py
104+
handleractions = edit, list, remove, create
105+
handlerpersistentmode = true
106+
107+
[admin_external:splunk_ta_uccexample_service_with_conf_param]
108+
handlertype = python
109+
python.version = python3
110+
handlerfile = splunk_ta_uccexample_rh_service_with_conf_param.py
111+
handleractions = edit, list, remove, create
112+
handlerpersistentmode = true
113+
114+
[admin_external:splunk_ta_uccexample_service_inside_menu_one]
115+
handlertype = python
116+
python.version = python3
117+
handlerfile = splunk_ta_uccexample_rh_service_inside_menu_one.py
118+
handleractions = edit, list, remove, create
119+
handlerpersistentmode = true
120+
121+
[admin_external:splunk_ta_uccexample_service_inside_menu_two]
122+
handlertype = python
123+
python.version = python3
124+
handlerfile = splunk_ta_uccexample_rh_service_inside_menu_two.py
125+
handleractions = edit, list, remove, create
126+
handlerpersistentmode = true
127+
128+
[admin_external:splunk_ta_uccexample_service_inside_menu_three]
129+
handlertype = python
130+
python.version = python3
131+
handlerfile = splunk_ta_uccexample_rh_service_inside_menu_three.py
132+
handleractions = edit, list, remove, create
133+
handlerpersistentmode = true
134+
135+
[admin_external:splunk_ta_uccexample_service_inside_menu_four]
136+
handlertype = python
137+
python.version = python3
138+
handlerfile = splunk_ta_uccexample_rh_service_inside_menu_four.py
139+
handleractions = edit, list, remove, create
140+
handlerpersistentmode = true

0 commit comments

Comments
 (0)