Skip to content
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
11 changes: 7 additions & 4 deletions rpm/cvmfs-servermon.spec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Summary: CernVM File System Server Monitoring
Name: cvmfs-servermon
Version: 1.27
Version: 1.28
# The release_prefix macro is used in the OBS prjconf, don't change its name
%define release_prefix 1
Release: %{release_prefix}%{?dist}
Expand Down Expand Up @@ -68,9 +68,12 @@ setsebool -P httpd_can_network_connect 1 2>/dev/null || true
/usr/share/cvmfs-servermon

%changelog
# - Remove old workaround added in version 1.12 because it incorrectly
# reported the status of a repo without an initial snapshot but with
# a completed gc.
Mon Sep 2 2024 Dave Dykstra <[email protected]> - 1.28-1
- Prevent json pretty printer from breaking up long strings, the way
pyhon2 did it.
- Remove old workaround added in version 1.12 because it incorrectly
reported the status of a repo without an initial snapshot but with
a completed gc.

* Mon Oct 23 2023 Dave Dykstra <[email protected]> - 1.27-1
- Correct inconsistent tab/space which python3 rejected.
Expand Down
15 changes: 14 additions & 1 deletion webapi/cvmfsmon_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,19 @@ def domontest(testname, montests):
return True
return False

# from https://stackoverflow.com/a/55619288
# simulate python2 pretty printer by not breaking up strings
class Python2PrettyPrinter(pprint.PrettyPrinter):
class _fake_short_str(str):
def __len__(self):
return 1 if super().__len__() else 0

def format(self, object, context, maxlevels, level):
res = super().format(object, context, maxlevels, level)
if isinstance(object, str):
return (self._fake_short_str(res[0]), ) + res[1:]
return res

def dispatch(version, montests, parameters, start_response, environ):
global last_config_time
now = time.time()
Expand Down Expand Up @@ -311,7 +324,7 @@ def dispatch(version, montests, parameters, start_response, environ):
details[status][test] = [repomsg]

output = StringIO()
pprint.pprint(details, output)
Python2PrettyPrinter(stream=output).pprint(details)
body = output.getvalue()
output.close()
body = body.replace("'", '"')
Expand Down
Loading