本文整理汇总了Python中util.unindent函数的典型用法代码示例。如果您正苦于以下问题:Python unindent函数的具体用法?Python unindent怎么用?Python unindent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了unindent函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: format_basic_conf
def format_basic_conf(ldap_conn, schema):
"""Format a basic SSSD configuration"""
schema_conf = "ldap_schema = " + schema + "\n"
if schema == SCHEMA_RFC2307_BIS:
schema_conf += "ldap_group_object_class = groupOfNames\n"
return unindent("""\
[sssd]
debug_level = 0xffff
domains = LDAP
services = nss, pam
[nss]
debug_level = 0xffff
memcache_timeout = 0
entry_negative_timeout = 1
[pam]
debug_level = 0xffff
[domain/LDAP]
ldap_auth_disable_tls_never_use_in_production = true
debug_level = 0xffff
{schema_conf}
id_provider = ldap
auth_provider = ldap
ldap_uri = {ldap_conn.ds_inst.ldap_url}
ldap_search_base = {ldap_conn.ds_inst.base_dn}
""").format(**locals())
示例2: files_multiple_sources
def files_multiple_sources(request):
_, alt_passwd_path = tempfile.mkstemp(prefix='altpasswd')
request.addfinalizer(lambda: os.unlink(alt_passwd_path))
alt_pwops = PasswdOps(alt_passwd_path)
_, alt_group_path = tempfile.mkstemp(prefix='altgroup')
request.addfinalizer(lambda: os.unlink(alt_group_path))
alt_grops = GroupOps(alt_group_path)
passwd_list = ",".join([os.environ["NSS_WRAPPER_PASSWD"], alt_passwd_path])
group_list = ",".join([os.environ["NSS_WRAPPER_GROUP"], alt_group_path])
conf = unindent("""\
[sssd]
domains = files
services = nss
[nss]
debug_level = 10
[domain/files]
id_provider = files
passwd_files = {passwd_list}
group_files = {group_list}
debug_level = 10
""").format(**locals())
create_conf_fixture(request, conf)
create_sssd_fixture(request)
return alt_pwops, alt_grops
示例3: format_basic_conf
def format_basic_conf(ldap_conn, schema):
"""Format a basic SSSD configuration"""
schema_conf = "ldap_schema = " + schema + "\n"
if schema == SCHEMA_RFC2307_BIS:
schema_conf += "ldap_group_object_class = groupOfNames\n"
valgrind_cmd = "valgrind --log-file=%s/valgrind_ifp.log" % config.LOG_PATH
ifp_command = "%s %s/sssd/sssd_ifp " % (valgrind_cmd, config.LIBEXEC_PATH)
return unindent("""\
[sssd]
debug_level = 0xffff
domains = LDAP, app
services = nss, ifp
enable_files_domain = false
[nss]
memcache_timeout = 0
[ifp]
# it need to be executed with valgrind because there is a problem
# problem with "ifp" + client regristration in monitor
# There is not such problem in 1st test. Just in following tests.
command = {ifp_command} --uid 0 --gid 0 --debug-to-files
[domain/LDAP]
{schema_conf}
id_provider = ldap
ldap_uri = {ldap_conn.ds_inst.ldap_url}
ldap_search_base = {ldap_conn.ds_inst.base_dn}
[application/app]
inherit_from = LDAP
""").format(**locals())
示例4: files_multiple_sources_nocreate
def files_multiple_sources_nocreate(request):
"""
Sets up SSSD with multiple sources, but does not actually create
the files.
"""
alt_passwd_path = tempfile.mktemp(prefix='altpasswd')
request.addfinalizer(lambda: os.unlink(alt_passwd_path))
alt_group_path = tempfile.mktemp(prefix='altgroup')
request.addfinalizer(lambda: os.unlink(alt_group_path))
passwd_list = ",".join([os.environ["NSS_WRAPPER_PASSWD"], alt_passwd_path])
group_list = ",".join([os.environ["NSS_WRAPPER_GROUP"], alt_group_path])
conf = unindent("""\
[sssd]
domains = files
services = nss
[nss]
debug_level = 10
[domain/files]
id_provider = files
passwd_files = {passwd_list}
group_files = {group_list}
debug_level = 10
""").format(**locals())
create_conf_fixture(request, conf)
create_sssd_fixture(request)
return alt_passwd_path, alt_group_path
示例5: prepare_sssd
def prepare_sssd(request, ldap_conn, use_fully_qualified_names=False,
case_sensitive=True):
"""Prepare SSSD with defaults"""
conf = unindent("""\
[sssd]
domains = LDAP
services = nss
[nss]
memcache_timeout = 1
[domain/LDAP]
ldap_auth_disable_tls_never_use_in_production = true
ldap_schema = rfc2307
id_provider = ldap
auth_provider = ldap
sudo_provider = ldap
ldap_uri = {ldap_conn.ds_inst.ldap_url}
ldap_search_base = {ldap_conn.ds_inst.base_dn}
use_fully_qualified_names = {use_fully_qualified_names}
case_sensitive = {case_sensitive}
""").format(**locals())
create_conf_fixture(request, conf)
create_sssd_fixture(request)
def teardown():
# remove user export file
try:
os.unlink(OVERRIDE_FILENAME)
except:
pass
request.addfinalizer(teardown)
示例6: zero_nesting_sssd_conf
def zero_nesting_sssd_conf(ldap_conn, schema):
"""Format an SSSD configuration with group nesting disabled"""
return \
format_basic_conf(ldap_conn, schema) + \
unindent("""
[domain/LDAP]
ldap_group_nesting_level = 0
""").format(INTERACTIVE_TIMEOUT)
示例7: no_sssd_domain
def no_sssd_domain(request):
conf = unindent("""\
[sssd]
services = nss
enable_files_domain = true
""").format(**locals())
create_conf_fixture(request, conf)
create_sssd_fixture(request)
return None
示例8: files_domain_only
def files_domain_only(request):
conf = unindent("""\
[sssd]
domains = files
services = nss
[domain/files]
id_provider = files
""").format(**locals())
create_conf_fixture(request, conf)
create_sssd_fixture(request)
return None
示例9: setup_for_cli_timeout_test
def setup_for_cli_timeout_test(request):
"""
Same as the generic setup, except a short client_idle_timeout so that
the test_cli_idle_timeout() test closes the fd towards the client.
"""
conf = generate_sec_config() + \
unindent("""
client_idle_timeout = 10
""").format()
create_conf_fixture(request, conf)
return create_sssd_secrets_fixture(request)
示例10: generate_sec_config
def generate_sec_config():
return unindent("""\
[sssd]
domains = local
services = nss
[domain/local]
id_provider = local
[secrets]
max_secrets = 10
max_payload_size = 2
""")
示例11: setup_for_resp_timeout_test
def setup_for_resp_timeout_test(request):
"""
Same as the generic setup, except a short responder_idle_timeout
so that the test_responder_idle_timeout() test verifies that the
responder has been shot down.
"""
conf = generate_sec_config() + \
unindent("""
responder_idle_timeout = 60
""").format()
create_conf_fixture(request, conf)
return create_sssd_secrets_fixture(request, False)
示例12: domain_resolution_order
def domain_resolution_order(request):
conf = unindent("""\
[sssd]
domains = files
services = nss
domain_resolution_order = foo
[domain/files]
id_provider = files
""").format(**locals())
create_conf_fixture(request, conf)
create_sssd_fixture(request)
return None
示例13: disabled_files_domain
def disabled_files_domain(request):
conf = unindent("""\
[sssd]
domains = local
services = nss
enable_files_domain = false
[domain/local]
id_provider = local
""").format(**locals())
create_conf_fixture(request, conf)
create_sssd_fixture(request)
return None
示例14: format_interactive_conf
def format_interactive_conf(ldap_conn, schema):
"""Format an SSSD configuration with all caches refreshing in 4 seconds"""
return \
format_basic_conf(ldap_conn, schema) + \
unindent("""
[nss]
memcache_timeout = 0
entry_negative_timeout = 0
[domain/LDAP]
ldap_purge_cache_timeout = 1
entry_cache_timeout = {0}
""").format(INTERACTIVE_TIMEOUT)
示例15: format_rfc2307bis_deref_conf
def format_rfc2307bis_deref_conf(ldap_conn, schema):
"""Format an SSSD configuration with all caches refreshing in 4 seconds"""
return \
format_basic_conf(ldap_conn, schema) + \
unindent("""
[nss]
memcache_timeout = 0
entry_negative_timeout = 0
[domain/LDAP]
entry_cache_timeout = {0}
ldap_deref_threshold = 1
""").format(INTERACTIVE_TIMEOUT)