• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python util.unindent函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中util.unindent函数的典型用法代码示例。如果您正苦于以下问题:Python unindent函数的具体用法?Python unindent怎么用?Python unindent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了unindent函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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())
开发者ID:jhrozek,项目名称:sssd,代码行数:28,代码来源:test_ldap.py


示例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
开发者ID:pbrezina,项目名称:sssd,代码行数:29,代码来源:test_files_provider.py


示例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())
开发者ID:pbrezina,项目名称:sssd,代码行数:33,代码来源:test_infopipe.py


示例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
开发者ID:pbrezina,项目名称:sssd,代码行数:31,代码来源:test_files_provider.py


示例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)
开发者ID:3van,项目名称:sssd,代码行数:32,代码来源:ldap_local_override_test.py


示例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)
开发者ID:jhrozek,项目名称:sssd,代码行数:8,代码来源:test_ldap.py


示例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
开发者ID:pbrezina,项目名称:sssd,代码行数:9,代码来源:test_files_provider.py


示例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
开发者ID:pbrezina,项目名称:sssd,代码行数:12,代码来源:test_files_provider.py


示例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)
开发者ID:SSSD,项目名称:sssd,代码行数:12,代码来源:test_secrets.py


示例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
    """)
开发者ID:SSSD,项目名称:sssd,代码行数:13,代码来源:test_secrets.py


示例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)
开发者ID:SSSD,项目名称:sssd,代码行数:13,代码来源:test_secrets.py


示例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
开发者ID:pbrezina,项目名称:sssd,代码行数:13,代码来源:test_files_provider.py


示例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
开发者ID:pbrezina,项目名称:sssd,代码行数:13,代码来源:test_files_provider.py


示例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)
开发者ID:jhrozek,项目名称:sssd,代码行数:13,代码来源:test_ldap.py


示例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)
开发者ID:jhrozek,项目名称:sssd,代码行数:13,代码来源:test_ldap.py


示例16: extra_attributes

def extra_attributes(request, ldap_conn):
    ent_list = ldap_ent.List(ldap_conn.ds_inst.base_dn)
    ent_list = ldap_ent.List(ldap_conn.ds_inst.base_dn)
    ent_list.add_user("user", 2001, 2000)
    ent_list.add_group("group", 2000)
    create_ldap_fixture(request, ldap_conn, ent_list)
    conf = \
        format_basic_conf(ldap_conn, SCHEMA_RFC2307) + \
        unindent("""\
            [domain/LDAP]
            ldap_user_extra_attrs = mail, name:uid, givenName
        """).format(**locals())
    create_conf_fixture(request, conf)
    create_sssd_fixture(request)
开发者ID:jhrozek,项目名称:sssd,代码行数:14,代码来源:test_ldap.py


示例17: common_setup_for_kcm_mem

def common_setup_for_kcm_mem(request, kdc_instance, kcm_path, sssd_conf):
    kcm_socket_include = unindent("""
    [libdefaults]
    default_ccache_name = KCM:
    kcm_socket = {kcm_path}
    """).format(**locals())
    kdc_instance.add_config({'kcm_socket': kcm_socket_include})

    create_conf_fixture(request, sssd_conf)
    create_sssd_kcm_fixture(kcm_path, request)

    k5util = krb5utils.Krb5Utils(kdc_instance.krb5_conf_path)

    return KcmTestEnv(kdc_instance, k5util)
开发者ID:SSSD,项目名称:sssd,代码行数:14,代码来源:test_kcm.py


示例18: create_sssd_conf

def create_sssd_conf(kcm_path, ccache_storage, max_secrets=MAX_SECRETS):
    return unindent("""\
        [sssd]
        domains = local
        services = nss

        [domain/local]
        id_provider = local

        [kcm]
        socket_path = {kcm_path}
        ccache_storage = {ccache_storage}

        [secrets]
        max_secrets = {max_secrets}
    """).format(**locals())
开发者ID:SSSD,项目名称:sssd,代码行数:16,代码来源:test_kcm.py


示例19: setup_for_global_quota

def setup_for_global_quota(request):
    conf = unindent("""\
        [sssd]
        domains = local
        services = nss

        [domain/local]
        id_provider = local

        [secrets]
        max_secrets = 10
        max_payload_size = 2
    """).format(**locals())

    create_conf_fixture(request, conf)
    create_sssd_secrets_fixture(request)
    return None
开发者ID:SSSD,项目名称:sssd,代码行数:17,代码来源:test_secrets.py


示例20: fallback_homedir

def fallback_homedir(request, ldap_conn):
    ent_list = ldap_ent.List(ldap_conn.ds_inst.base_dn)
    ent_list.add_user("user_with_homedir_A", 1001, 2001,
                      homeDirectory="/home/A")
    ent_list.add_user("user_with_homedir_B", 1002, 2002,
                      homeDirectory="/home/B")
    ent_list.add_user("user_with_empty_homedir", 1003, 2003,
                      homeDirectory="")
    create_ldap_fixture(request, ldap_conn, ent_list)
    conf = \
        format_basic_conf(ldap_conn, SCHEMA_RFC2307) + \
        unindent("""\
            [nss]
            fallback_homedir    = /home/B
        """).format(**locals())
    create_conf_fixture(request, conf)
    create_sssd_fixture(request)
开发者ID:jhrozek,项目名称:sssd,代码行数:17,代码来源:test_ldap.py



注:本文中的util.unindent函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python util.unlink函数代码示例发布时间:2022-05-26
下一篇:
Python util.uint256_from_str函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap