mirror of
https://github.com/samba-team/samba.git
synced 2025-12-17 04:23:50 +03:00
samba-tool drs showrepl: add --json option for JSON output
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
committed by
Andrew Bartlett
parent
90d0c638ef
commit
ed15a452e7
@@ -95,6 +95,10 @@ class cmd_drs_showrepl(Command):
|
|||||||
"credopts": options.CredentialsOptions,
|
"credopts": options.CredentialsOptions,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
takes_options = [
|
||||||
|
Option("--json", help="output in JSON format", action='store_true'),
|
||||||
|
]
|
||||||
|
|
||||||
takes_args = ["DC?"]
|
takes_args = ["DC?"]
|
||||||
|
|
||||||
def parse_neighbour(self, n):
|
def parse_neighbour(self, n):
|
||||||
@@ -144,7 +148,7 @@ class cmd_drs_showrepl(Command):
|
|||||||
return (info_type, info)
|
return (info_type, info)
|
||||||
|
|
||||||
def run(self, DC=None, sambaopts=None,
|
def run(self, DC=None, sambaopts=None,
|
||||||
credopts=None, versionopts=None, server=None):
|
credopts=None, versionopts=None, server=None, json=False):
|
||||||
|
|
||||||
self.lp = sambaopts.get_loadparm()
|
self.lp = sambaopts.get_loadparm()
|
||||||
if DC is None:
|
if DC is None:
|
||||||
@@ -209,6 +213,17 @@ class cmd_drs_showrepl(Command):
|
|||||||
a = str(r).split(':')
|
a = str(r).split(':')
|
||||||
d['replicates NC'].append((a[3], int(a[2])))
|
d['replicates NC'].append((a[3], int(a[2])))
|
||||||
|
|
||||||
|
if json:
|
||||||
|
import json as json_mod
|
||||||
|
data = {
|
||||||
|
'dsa': dsa_details,
|
||||||
|
'repsFrom': repsfrom,
|
||||||
|
'repsTo': repsto,
|
||||||
|
'NTDSConnections': conn_details
|
||||||
|
}
|
||||||
|
json_mod.dump(data, self.outf, indent=2)
|
||||||
|
return
|
||||||
|
|
||||||
self.message("%s\\%s" % (site, server))
|
self.message("%s\\%s" % (site, server))
|
||||||
self.message("DSA Options: 0x%08x" % dsa_details["options"])
|
self.message("DSA Options: 0x%08x" % dsa_details["options"])
|
||||||
self.message("DSA object GUID: %s" % dsa_details["objectGUID"])
|
self.message("DSA object GUID: %s" % dsa_details["objectGUID"])
|
||||||
|
|||||||
Reference in New Issue
Block a user