mirror of
https://github.com/samba-team/samba.git
synced 2025-12-14 20:23:54 +03:00
python: pep257: docstring should use double quotes
Signed-off-by: Rob van der Linde <rob@catalyst.net.nz> Reviewed-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
ff52e34288
commit
ddba4a06bb
@@ -377,21 +377,21 @@ class DCJoinContext(object):
|
||||
return str(res[0]["dnsHostName"][0])
|
||||
|
||||
def get_domain_name(ctx):
|
||||
'''get netbios name of the domain from the partitions record'''
|
||||
"""get netbios name of the domain from the partitions record"""
|
||||
partitions_dn = ctx.samdb.get_partitions_dn()
|
||||
res = ctx.samdb.search(base=partitions_dn, scope=ldb.SCOPE_ONELEVEL, attrs=["nETBIOSName"],
|
||||
expression='ncName=%s' % ldb.binary_encode(str(ctx.samdb.get_default_basedn())))
|
||||
return str(res[0]["nETBIOSName"][0])
|
||||
|
||||
def get_forest_domain_name(ctx):
|
||||
'''get netbios name of the domain from the partitions record'''
|
||||
"""get netbios name of the domain from the partitions record"""
|
||||
partitions_dn = ctx.samdb.get_partitions_dn()
|
||||
res = ctx.samdb.search(base=partitions_dn, scope=ldb.SCOPE_ONELEVEL, attrs=["nETBIOSName"],
|
||||
expression='ncName=%s' % ldb.binary_encode(str(ctx.samdb.get_root_basedn())))
|
||||
return str(res[0]["nETBIOSName"][0])
|
||||
|
||||
def get_parent_partition_dn(ctx):
|
||||
'''get the parent domain partition DN from parent DNS name'''
|
||||
"""get the parent domain partition DN from parent DNS name"""
|
||||
res = ctx.samdb.search(base=ctx.config_dn, attrs=[],
|
||||
expression='(&(objectclass=crossRef)(dnsRoot=%s)(systemFlags:%s:=%u))' %
|
||||
(ldb.binary_encode(ctx.parent_dnsdomain),
|
||||
@@ -399,14 +399,14 @@ class DCJoinContext(object):
|
||||
return str(res[0].dn)
|
||||
|
||||
def get_mysid(ctx):
|
||||
'''get the SID of the connected user. Only works with w2k8 and later,
|
||||
so only used for RODC join'''
|
||||
"""get the SID of the connected user. Only works with w2k8 and later,
|
||||
so only used for RODC join"""
|
||||
res = ctx.samdb.search(base="", scope=ldb.SCOPE_BASE, attrs=["tokenGroups"])
|
||||
binsid = res[0]["tokenGroups"][0]
|
||||
return get_string(ctx.samdb.schema_format_value("objectSID", binsid))
|
||||
|
||||
def dn_exists(ctx, dn):
|
||||
'''check if a DN exists'''
|
||||
"""check if a DN exists"""
|
||||
try:
|
||||
res = ctx.samdb.search(base=dn, scope=ldb.SCOPE_BASE, attrs=[])
|
||||
except ldb.LdbError as e5:
|
||||
@@ -417,7 +417,7 @@ class DCJoinContext(object):
|
||||
return True
|
||||
|
||||
def add_krbtgt_account(ctx):
|
||||
'''RODCs need a special krbtgt account'''
|
||||
"""RODCs need a special krbtgt account"""
|
||||
print("Adding %s" % ctx.krbtgt_dn)
|
||||
rec = {
|
||||
"dn": ctx.krbtgt_dn,
|
||||
@@ -446,7 +446,7 @@ class DCJoinContext(object):
|
||||
ctx.samdb.rename(ctx.krbtgt_dn, ctx.new_krbtgt_dn)
|
||||
|
||||
def drsuapi_connect(ctx):
|
||||
'''make a DRSUAPI connection to the naming master'''
|
||||
"""make a DRSUAPI connection to the naming master"""
|
||||
binding_options = "seal"
|
||||
if ctx.lp.log_level() >= 9:
|
||||
binding_options += ",print"
|
||||
@@ -455,7 +455,7 @@ class DCJoinContext(object):
|
||||
(ctx.drsuapi_handle, ctx.bind_supported_extensions) = drs_utils.drs_DsBind(ctx.drsuapi)
|
||||
|
||||
def create_tmp_samdb(ctx):
|
||||
'''create a temporary samdb object for schema queries'''
|
||||
"""create a temporary samdb object for schema queries"""
|
||||
ctx.tmp_schema = Schema(ctx.domsid,
|
||||
schemadn=ctx.schema_dn)
|
||||
ctx.tmp_samdb = SamDB(session_info=system_session(), url=None, auto_connect=False,
|
||||
@@ -464,7 +464,7 @@ class DCJoinContext(object):
|
||||
ctx.tmp_samdb.set_schema(ctx.tmp_schema)
|
||||
|
||||
def DsAddEntry(ctx, recs):
|
||||
'''add a record via the DRSUAPI DsAddEntry call'''
|
||||
"""add a record via the DRSUAPI DsAddEntry call"""
|
||||
if ctx.drsuapi is None:
|
||||
ctx.drsuapi_connect()
|
||||
if ctx.tmp_samdb is None:
|
||||
@@ -531,7 +531,7 @@ class DCJoinContext(object):
|
||||
return ctr.objects
|
||||
|
||||
def join_ntdsdsa_obj(ctx):
|
||||
'''return the ntdsdsa object to add'''
|
||||
"""return the ntdsdsa object to add"""
|
||||
|
||||
print("Adding %s" % ctx.ntds_dn)
|
||||
|
||||
@@ -579,7 +579,7 @@ class DCJoinContext(object):
|
||||
return rec
|
||||
|
||||
def join_add_ntdsdsa(ctx):
|
||||
'''add the ntdsdsa object'''
|
||||
"""add the ntdsdsa object"""
|
||||
|
||||
rec = ctx.join_ntdsdsa_obj()
|
||||
if ctx.forced_local_samdb:
|
||||
@@ -594,7 +594,7 @@ class DCJoinContext(object):
|
||||
ctx.ntds_guid = misc.GUID(ctx.samdb.schema_format_value("objectGUID", res[0]["objectGUID"][0]))
|
||||
|
||||
def join_add_objects(ctx, specified_sid=None):
|
||||
'''add the various objects needed for the join'''
|
||||
"""add the various objects needed for the join"""
|
||||
if ctx.acct_dn:
|
||||
print("Adding %s" % ctx.acct_dn)
|
||||
rec = {
|
||||
@@ -953,7 +953,7 @@ class DCJoinContext(object):
|
||||
print("Provision OK for domain %s" % ctx.names.dnsdomain)
|
||||
|
||||
def create_replicator(ctx, repl_creds, binding_options):
|
||||
'''Creates a new DRS object for managing replications'''
|
||||
"""Creates a new DRS object for managing replications"""
|
||||
return drs_utils.drs_Replicate(
|
||||
"ncacn_ip_tcp:%s[%s]" % (ctx.server, binding_options),
|
||||
ctx.lp, repl_creds, ctx.local_samdb, ctx.invocation_id)
|
||||
@@ -1730,7 +1730,7 @@ class DCCloneAndRenameContext(DCCloneContext):
|
||||
ctx.base_dn, ctx.new_base_dn)
|
||||
|
||||
def create_non_global_lp(ctx, global_lp):
|
||||
'''Creates a non-global LoadParm based on the global LP's settings'''
|
||||
"""Creates a non-global LoadParm based on the global LP's settings"""
|
||||
|
||||
# the samba code shares a global LoadParm by default. Here we create a
|
||||
# new LoadParm that retains the global settings, but any changes we
|
||||
@@ -1745,7 +1745,7 @@ class DCCloneAndRenameContext(DCCloneContext):
|
||||
return local_lp
|
||||
|
||||
def rename_dn(ctx, dn_str):
|
||||
'''Uses string substitution to replace the base DN'''
|
||||
"""Uses string substitution to replace the base DN"""
|
||||
old_base_dn = ctx.base_dn
|
||||
return re.sub('%s$' % old_base_dn, ctx.new_base_dn, dn_str)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user