Skip to content

Commit f5fc5eb

Browse files
refctor: change _victoria_create_index to _cloud_create_index (#139)
**Issue number:** ### PR Type **What kind of change does this PR introduce?** * [ ] Feature * [ ] Bug Fix * [X] Refactoring (no functional or API changes) * [ ] Documentation Update * [ ] Maintenance (dependency updates, CI, etc.) ## Summary This PR addresses #135 (comment) and introduces refactoring changes. Tested: https://cd.splunkdev.com/taautomation/ta-automation-compatibility-tests/-/pipelines/28546879 https://cd.splunkdev.com/taautomation/ta-automation-compatibility-tests/-/pipelines/28546918 https://cd.splunkdev.com/taautomation/ta-automation-compatibility-tests/-/pipelines/28546801 https://github.com/splunk/splunk-add-on-for-salesforce/actions/runs/16812128639 https://github.com/splunk/splunk-add-on-for-box/actions/runs/16812014592 ### Changes Please provide a summary of the changes. ### User experience Please describe the user experience before and after this change. Screenshots are welcome for additional context. ## Checklist If an item doesn't apply to your changes, leave it unchecked. * [ ] I have performed a self-review of this change according to the [development guidelines](https://splunk.github.io/addonfactory-ucc-test/contributing/#development-guidelines) * [ ] Tests have been added/modified to cover the changes [(testing doc)](https://splunk.github.io/addonfactory-ucc-test/contributing/#build-and-test) * [ ] Changes are documented * [ ] PR title and description follows the [contributing principles](https://splunk.github.io/addonfactory-ucc-test/contributing/#pull-requests)
1 parent 38cfd58 commit f5fc5eb

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

splunk_add_on_ucc_modinput_test/common/splunk_instance.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ def _get_index_from_classic_instance(
8787
def _get_index(
8888
index_name: str,
8989
client_service: SplunkServicePool,
90+
is_cloud: bool = False,
9091
acs_stack: str | None = None,
9192
acs_server: str | None = None,
9293
splunk_token: str | None = None,
@@ -96,18 +97,14 @@ def _get_index(
9697
for i in client_service.indexes.iter(datatype="all")
9798
):
9899
return client_service.indexes[index_name]
99-
else:
100-
if (
101-
"splunkcloud.com" in client_service._host.lower()
102-
and not client_service._host.startswith(acs_stack)
103-
):
104-
return Configuration._get_index_from_classic_instance(
105-
index_name,
106-
client_service,
107-
acs_stack,
108-
acs_server,
109-
splunk_token,
110-
)
100+
if is_cloud and not client_service._host.startswith(acs_stack):
101+
return Configuration._get_index_from_classic_instance(
102+
index_name,
103+
client_service,
104+
acs_stack,
105+
acs_server,
106+
splunk_token,
107+
)
111108
return None
112109

113110
@staticmethod
@@ -132,7 +129,7 @@ def _validate_index_name(index_name: str) -> None:
132129
raise ValueError(reason)
133130

134131
@staticmethod
135-
def _victoria_create_index(
132+
def _cloud_create_index(
136133
index_name: str,
137134
*,
138135
datatype: str,
@@ -250,6 +247,7 @@ def _create_index(
250247
if Configuration._get_index(
251248
index_name,
252249
client_service,
250+
is_cloud,
253251
acs_stack,
254252
acs_server,
255253
splunk_token,
@@ -258,7 +256,7 @@ def _create_index(
258256
logger.critical(reason)
259257
pytest.exit(reason)
260258
if is_cloud:
261-
Configuration._victoria_create_index(
259+
Configuration._cloud_create_index(
262260
index_name,
263261
datatype=datatype,
264262
acs_stack=acs_stack,
@@ -268,6 +266,7 @@ def _create_index(
268266
created_index = Configuration._get_index(
269267
index_name,
270268
client_service,
269+
is_cloud,
271270
acs_stack,
272271
acs_server,
273272
splunk_token,

splunk_add_on_ucc_modinput_test/functional/splunk/client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ def get_index(self, index_name: str) -> Index | None:
164164
return self.config._get_index(
165165
index_name,
166166
self.splunk,
167+
is_cloud=self._is_cloud,
167168
acs_stack=self.config.acs_stack if self._is_cloud else None,
168169
acs_server=self.config.acs_server if self._is_cloud else None,
169170
splunk_token=self.config.token if self._is_cloud else None,

0 commit comments

Comments
 (0)