From 9353a580f896c74f60f56d0af555c29fdf8df117 Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Thu, 24 May 2018 15:22:47 +1200 Subject: [PATCH] samba-tool visualize: separate dot options from common options because not all sub-commands make dot format Signed-off-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- python/samba/netcmd/visualize.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/python/samba/netcmd/visualize.py b/python/samba/netcmd/visualize.py index 193c543210d..efae28ea086 100644 --- a/python/samba/netcmd/visualize.py +++ b/python/samba/netcmd/visualize.py @@ -43,10 +43,6 @@ COMMON_OPTIONS = [ type=str, metavar="URL", dest="H"), Option("-o", "--output", help="write here (default stdout)", type=str, metavar="FILE", default=None), - Option("--dot", help="Graphviz dot output", dest='format', - const='dot', action='store_const'), - Option("--xdot", help="attempt to call Graphviz xdot", dest='format', - const='xdot', action='store_const'), Option("--distance", help="Distance matrix graph output (default)", dest='format', const='distance', action='store_const'), Option("--utf8", help="Use utf-8 Unicode characters", @@ -65,6 +61,13 @@ COMMON_OPTIONS = [ action='store_false', default=True, dest='key'), ] +DOT_OPTIONS = [ + Option("--dot", help="Graphviz dot output", dest='format', + const='dot', action='store_const'), + Option("--xdot", help="attempt to call Graphviz xdot", dest='format', + const='xdot', action='store_const'), +] + TEMP_FILE = '__temp__' @@ -77,7 +80,7 @@ class GraphCommand(Command): "versionopts": options.VersionOptions, "credopts": options.CredentialsOptions, } - takes_options = COMMON_OPTIONS + takes_options = COMMON_OPTIONS + DOT_OPTIONS takes_args = () def get_db(self, H, sambaopts, credopts): @@ -229,7 +232,7 @@ def get_partition(samdb, part): class cmd_reps(GraphCommand): "repsFrom/repsTo from every DSA" - takes_options = COMMON_OPTIONS + [ + takes_options = COMMON_OPTIONS + DOT_OPTIONS + [ Option("-p", "--partition", help="restrict to this partition", default=None), ] @@ -426,7 +429,7 @@ class NTDSConn(object): class cmd_ntdsconn(GraphCommand): "Draw the NTDSConnection graph" - takes_options = COMMON_OPTIONS + [ + takes_options = COMMON_OPTIONS + DOT_OPTIONS + [ Option("--importldif", help="graph from samba_kcc generated ldif", default=None), ] -- 2.11.4.GIT