Skip to content

Commit 8369512

Browse files
authored
Merge pull request #457 from splunk/PEX-653/verioning-activation-rollback
PEX-653/versioning-activation-rollback
2 parents 0c8fa26 + ac021d1 commit 8369512

File tree

1 file changed

+55
-45
lines changed

1 file changed

+55
-45
lines changed

contentctl/objects/content_versioning_service.py

Lines changed: 55 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -197,19 +197,23 @@ def _query_content_versioning_service(
197197

198198
# Query the content versioning service
199199
try:
200-
if method == "GET" and self.kvstore_content_versioning:
201-
response = self.service.request(
202-
method=method,
203-
path_segment="content_versioning/versioning_apps",
204-
app="SA-ContentVersioning",
205-
)
206-
if self.indexbased_content_versioning:
207-
response = self.service.request( # type: ignore
208-
method=method,
209-
path_segment="configs/conf-feature_flags/general",
210-
body=body,
211-
app="SA-ContentVersioning",
212-
)
200+
# TODO: The comment out section is for validating versioning is enabled and ready to go. The validation
201+
# workflow (whether to be part of wait_for_cms_main or a separate function) is planed to be implemented
202+
# in later contentctl-ng.
203+
# API endpoint for checking versioning status after ES 8.3.0
204+
# if method == "GET" and self.kvstore_content_versioning:
205+
# response = self.service.request(
206+
# method=method,
207+
# path_segment="content_versioning/versioning_apps",
208+
# app="SA-ContentVersioning",
209+
# )
210+
# if self.indexbased_content_versioning:
211+
response = self.service.request( # type: ignore
212+
method=method,
213+
path_segment="configs/conf-feature_flags/general",
214+
body=body,
215+
app="SA-ContentVersioning",
216+
)
213217
except HTTPError as e:
214218
# Raise on any HTTP errors
215219
raise HTTPError(f"Error querying content versioning service: {e}") from e
@@ -248,26 +252,30 @@ def is_versioning_activated(self) -> bool:
248252

249253
# Find the versioning_activated field and report any errors
250254
try:
251-
if self.kvstore_content_versioning:
252-
if "content" in data:
253-
for app in data["content"]:
254-
if app.get("name") == "DA-ESS-ContentUpdate":
255-
# If there is error message versioning is not activated properly
256-
if "message" in app:
257-
return False
258-
259-
# If the installed verion is not the same as the test version
260-
if app.get("version") != self.global_config.app.version:
261-
return False
262-
263-
if app.get("status") == "active":
264-
return True
265-
else:
266-
return False
267-
if self.indexbased_content_versioning:
268-
for entry in data["entry"]:
269-
if entry["name"] == "general":
270-
return bool(int(entry["content"]["versioning_activated"]))
255+
# TODO: The comment out section is for validating versioning is enabled and ready to go. The validation
256+
# workflow (whether to be part of wait_for_cms_main or a separate function) is planed to be implemented
257+
# in later contentctl-ng.
258+
# Validating response by checking `status` field in `DA-ESS-ContentUpdate` app
259+
# if self.kvstore_content_versioning:
260+
# if "content" in data:
261+
# for app in data["content"]:
262+
# if app.get("name") == "DA-ESS-ContentUpdate":
263+
# # If there is error message versioning is not activated properly
264+
# if "message" in app:
265+
# return False
266+
267+
# # If the installed verion is not the same as the test version
268+
# if app.get("version") != self.global_config.app.version:
269+
# return False
270+
271+
# if app.get("status") == "active":
272+
# return True
273+
# else:
274+
# return False
275+
# if self.indexbased_content_versioning:
276+
for entry in data["entry"]:
277+
if entry["name"] == "general":
278+
return bool(int(entry["content"]["versioning_activated"]))
271279
except KeyError as e:
272280
raise KeyError(
273281
"Cannot retrieve versioning status, unable to determine versioning status using "
@@ -283,19 +291,21 @@ def activate_versioning(self) -> None:
283291
Activate the content versioning service
284292
"""
285293
# Post to the SA-ContentVersioning service to set versioning status
286-
if self.indexbased_content_versioning:
287-
self._query_content_versioning_service(
288-
method="POST", body={"versioning_activated": True}
289-
)
294+
self._query_content_versioning_service(
295+
method="POST", body={"versioning_activated": True}
296+
)
290297

291-
# Wait for versioning to be activated for ES 8.3.0+
292-
if self.kvstore_content_versioning:
293-
timeout = 600
294-
while not self.is_versioning_activated:
295-
time.sleep(60)
296-
timeout -= 60
297-
if timeout <= 0:
298-
break
298+
# TODO: The comment out section is for validating versioning is enabled and ready to go. The validation
299+
# workflow (whether to be part of wait_for_cms_main or a separate function) is planed to be implemented
300+
# in later contentctl-ng.
301+
# The versioning is expected to be ready within 10 minutes
302+
# if self.kvstore_content_versioning:
303+
# timeout = 600
304+
# while not self.is_versioning_activated:
305+
# time.sleep(60)
306+
# timeout -= 60
307+
# if timeout <= 0:
308+
# break
299309

300310
# Confirm versioning has been enabled
301311
if not self.is_versioning_activated:

0 commit comments

Comments
 (0)