Skip to content

Commit 9002346

Browse files
committed
Updating node_util.py to 1.5.x status.
Adding size to log rotation.
1 parent c93a6e0 commit 9002346

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
.idea
12
/target

resources/maintainer_scripts/logrotate.d/casper-node

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
compress
66
daily
77
rotate 7
8+
size 1G
89
missingok
910
notifempty
1011
copytruncate

resources/maintainer_scripts/node_util.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,7 @@ def _format_status(status, external_block_data=None):
650650
error = status.get("error")
651651
if error:
652652
return f"status error: {error}"
653+
is_new_status = status.get("available_block_range") is not None
653654
block_info = status.get("last_added_block_info")
654655
output = []
655656
if block_info is not None:
@@ -665,9 +666,14 @@ def _format_status(status, external_block_data=None):
665666
f"Uptime: {status.get('uptime', '')}",
666667
f"Build: {status.get('build_version')}",
667668
f"Key: {status.get('our_public_signing_key')}",
668-
f"Next Upgrade: {status.get('next_upgrade')}",
669-
""
669+
f"Next Upgrade: {status.get('next_upgrade')}"
670670
])
671+
if is_new_status:
672+
output.append(f"Reactor State: {status.get('reactor_state', '')}")
673+
abr = status.get("available_block_range", {"low": "", "high": ""})
674+
output.append(f"Available Block Range - Low: {abr.get('low')} High: {abr.get('high')}")
675+
output.append("")
676+
671677
return "\n".join(output)
672678
except Exception:
673679
return "Cannot parse status return."
@@ -716,7 +722,7 @@ def watch(self):
716722
if args.ip:
717723
ip_arg = f"--ip {str(args.ip)}"
718724
refresh = MINIMUM if args.refresh < MINIMUM else args.refresh
719-
os.system(f"watch -n {refresh} '{sys.argv[0]} node_status {ip_arg}; {sys.argv[0]} rpc_active; {sys.argv[0]} systemd_status'")
725+
os.system(f"watch -n {refresh} '{sys.argv[0]} node_status {ip_arg}; {sys.argv[0]} systemd_status'")
720726

721727
def rpc_active(self):
722728
""" Is local RPC active? """

0 commit comments

Comments
 (0)