Commit 51d26ce 1 parent 30adcbd commit 51d26ce Copy full SHA for 51d26ce
File tree 1 file changed +9
-2
lines changed
1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 9
9
import subprocess
10
10
import sys
11
11
import ipaddress
12
+ from pkg_resources import parse_version
12
13
13
14
import click
14
15
from click_default_group import DefaultGroup
@@ -2002,8 +2003,14 @@ def ntp(ctx, verbose):
2002
2003
"""Show NTP information"""
2003
2004
ntpcmd = "ntpq -p -n"
2004
2005
if is_mgmt_vrf_enabled (ctx ) is True :
2005
- #ManagementVRF is enabled. Call ntpq using cgexec
2006
- ntpcmd = "cgexec -g l3mdev:mgmt ntpq -p -n"
2006
+ #ManagementVRF is enabled. Call ntpq using "ip vrf exec" or cgexec based on linux version
2007
+ os_info = os .uname ()
2008
+ release = os_info [2 ].split ('-' )
2009
+ if parse_version (release [0 ]) > parse_version ("4.9.0" ):
2010
+ ntpcmd = "ip vrf exec mgmt ntpq -p -n"
2011
+ else :
2012
+ ntpcmd = "cgexec -g l3mdev:mgmt ntpq -p -n"
2013
+
2007
2014
run_command (ntpcmd , display_cmd = verbose )
2008
2015
2009
2016
You can’t perform that action at this time.
0 commit comments