mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-30 12:33:02 +02:00
cli: fix "show ntp" command when ntp is not enabled
Instead of 'show ntp' =>
Error, top level "ietf-system:system-state" missing
Try something nicer:
NTP client not enabled.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
@@ -286,9 +286,8 @@
|
||||
|
||||
<COMMAND name="ntp" help="Show NTP (client) status">
|
||||
<ACTION sym="script">
|
||||
sysrepocfg -d operational -X -f json -x \
|
||||
/ietf-system:system-state/infix-system:ntp | \
|
||||
/usr/libexec/statd/cli-pretty "show-ntp"
|
||||
sysrepocfg -d operational -X -f json -x /system-state/ntp | \
|
||||
/usr/libexec/statd/cli-pretty "show-ntp"
|
||||
</ACTION>
|
||||
<SWITCH name="optional" min="0">
|
||||
<COMMAND name="tracking" help="Show NTP tracking">
|
||||
|
||||
@@ -1020,8 +1020,8 @@ def show_hardware(json):
|
||||
|
||||
def show_ntp(json):
|
||||
if not json.get("ietf-system:system-state"):
|
||||
print(f"Error, top level \"ietf-system:system-state\" missing")
|
||||
sys.exit(1)
|
||||
print("NTP client not enabled.")
|
||||
return
|
||||
hdr = (f"{'ADDRESS':<{PadNtpSource.address}}"
|
||||
f"{'MODE':<{PadNtpSource.mode}}"
|
||||
f"{'STATE':<{PadNtpSource.state}}"
|
||||
|
||||
Reference in New Issue
Block a user