summaryrefslogtreecommitdiff
path: root/source4/scripting
diff options
context:
space:
mode:
authorKamen Mazdrashki <kamenim@samba.org>2011-02-07 14:13:06 +0200
committerKamen Mazdrashki <kamenim@samba.org>2011-02-09 11:57:12 +0200
commitad48c70db61a5e35a85a317c4c0f4a179a2aae77 (patch)
tree66c6cb29fb5f85d33332830eaada3cad9e4058ea /source4/scripting
parentf3db67e14fd9ebcf5720e82b125d2939fdc2ac17 (diff)
downloadsamba-ad48c70db61a5e35a85a317c4c0f4a179a2aae77.tar.gz
samba-ad48c70db61a5e35a85a317c4c0f4a179a2aae77.tar.bz2
samba-ad48c70db61a5e35a85a317c4c0f4a179a2aae77.zip
s4/samba-tool/drs: Move get_dsServiceName function at module level to be re-used
Diffstat (limited to 'source4/scripting')
-rw-r--r--source4/scripting/python/samba/netcmd/drs.py20
1 files changed, 8 insertions, 12 deletions
diff --git a/source4/scripting/python/samba/netcmd/drs.py b/source4/scripting/python/samba/netcmd/drs.py
index 3855bf1864..78aaddf3e9 100644
--- a/source4/scripting/python/samba/netcmd/drs.py
+++ b/source4/scripting/python/samba/netcmd/drs.py
@@ -83,6 +83,12 @@ def drs_parse_ntds_dn(ntds_dn):
return (site, server)
+def get_dsServiceName(samdb):
+ '''get the NTDS DN from the rootDSE'''
+ res = samdb.search(base="", scope=ldb.SCOPE_BASE, attrs=["dsServiceName"])
+ return res[0]["dsServiceName"][0]
+
+
class cmd_drs_showrepl(Command):
"""show replication status"""
@@ -110,11 +116,6 @@ class cmd_drs_showrepl(Command):
print("\t\tLast success @ %s" % nttime2string(n.last_success))
print("")
- def get_dsServiceName(ctx):
- '''get the NTDS DN from the rootDSE'''
- res = ctx.samdb.search(base="", scope=ldb.SCOPE_BASE, attrs=["dsServiceName"])
- return res[0]["dsServiceName"][0]
-
def drsuapi_ReplicaInfo(ctx, info_type):
'''call a DsReplicaInfo'''
@@ -140,7 +141,7 @@ class cmd_drs_showrepl(Command):
samdb_connect(self)
# show domain information
- ntds_dn = self.get_dsServiceName()
+ ntds_dn = get_dsServiceName(self.samdb)
server_dns = self.samdb.search(base="", scope=ldb.SCOPE_BASE, attrs=["dnsHostName"])[0]['dnsHostName'][0]
(site, server) = drs_parse_ntds_dn(ntds_dn)
@@ -424,11 +425,6 @@ class cmd_drs_options(Command):
"DISABLE_OUTBOUND_REPL": 0x00000004,
"DISABLE_NTDSCONN_XLATE": 0x00000008}
- def get_dsServiceName(ctx):
- '''get the NTDS DN from the rootDSE'''
- res = ctx.samdb.search(base="", scope=ldb.SCOPE_BASE, attrs=["dsServiceName"])
- return res[0]["dsServiceName"][0]
-
def run(self, DC, dsa_option=None,
sambaopts=None, credopts=None, versionopts=None):
@@ -440,7 +436,7 @@ class cmd_drs_options(Command):
samdb_connect(self)
- ntds_dn = self.get_dsServiceName()
+ ntds_dn = get_dsServiceName(self.samdb)
res = self.samdb.search(base=ntds_dn, scope=ldb.SCOPE_BASE, attrs=["options"])
dsa_opts = int(res[0]["options"][0])