当前位置: 首页>>代码示例>>Python>>正文


Python Client.add_identity方法代码示例

本文整理汇总了Python中rucio.client.Client.add_identity方法的典型用法代码示例。如果您正苦于以下问题:Python Client.add_identity方法的具体用法?Python Client.add_identity怎么用?Python Client.add_identity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在rucio.client.Client的用法示例。


在下文中一共展示了Client.add_identity方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: locals

# 需要导入模块: from rucio.client import Client [as 别名]
# 或者: from rucio.client.Client import add_identity [as 别名]
    try:
        c.add_scope("jdoe", "mock")
    except Duplicate:
        print "Scope mock already added" % locals()

    # add your accounts here, if you test against CERN authed nodes
    additional_test_accounts = [
        (
            "/DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=mlassnig/CN=663551/CN=Mario Lassnig",
            "x509",
            "[email protected]",
        ),
        (
            "/DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=eliotiri/CN=756407/CN=Evangelia Liotiri",
            "x509",
            "[email protected]",
        ),
        (
            "/DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=barisits/CN=692443/CN=Martin Barisits",
            "x509",
            "[email protected]",
        ),
        ("[email protected]", "GSS", "[email protected]"),
    ]

    for i in additional_test_accounts:
        try:
            c.add_identity(account="root", identity=i[0], authtype=i[1], email=i[2])
        except:
            print "Already added: ", i
开发者ID:pombredanne,项目名称:rucio,代码行数:32,代码来源:bootstrap_tests.py

示例2: open

# 需要导入模块: from rucio.client import Client [as 别名]
# 或者: from rucio.client.Client import add_identity [as 别名]
from rucio.client import Client
from rucio.common.exception import Duplicate

if __name__ == '__main__':

    info = []
    f = open ('tools/atlas_accounts.csv')
#    f = open ('user_accounts.csv')
    for line in f.readlines():
        account, dn, email = line.rstrip().split('\t')
        info.append((account, dn, email))
    f.close()

    c = Client()
    for account, dn, email in info:
        try:
            c.add_account(account=account, type='USER')
        except Duplicate:
           print 'Account %(account)s already added' % locals()

        try:
            c.add_identity(account=account, identity=dn, authtype='X509', email=email , default=True)
        except Duplicate:
           print 'Identity %(account)s already added' % locals()

        try:
            scope = 'user.' + account
            c.add_scope(account, scope)
        except Duplicate:
           print 'Scope %(scope)s already added' % locals()
开发者ID:pombredanne,项目名称:rucio,代码行数:32,代码来源:sync_user_accounts.py

示例3: open

# 需要导入模块: from rucio.client import Client [as 别名]
# 或者: from rucio.client.Client import add_identity [as 别名]
        account, dn, email = line.rstrip().split('\t')
        info.append((account, dn, email))
    f.close()

#    f = open ('tools/gss_account_to_create.csv')
#    for line in f.readlines():
#        account, scope = line.rstrip().split('\t')
#        email = account + '@cern.ch'
#        dn = account + '@CERN.CH'
#        info.append((account, dn, email))
#    f.close()


    # info.reverse()
    c = Client()
    for account, dn, email in info:
        try:
            c.add_account(account=account, type='USER')
        except Duplicate:
           print 'Account %(account)s already added' % locals()

        try:
            c.add_identity(account=account, identity=dn, authtype='GSS', email=email , default=False)
        except Duplicate:
           print 'Identity %(account)s already added' % locals()

        try:
            scope = 'user.' + account
            c.add_scope(account, scope)
        except Duplicate:
           print 'Scope %(scope)s already added' % locals()
开发者ID:pombredanne,项目名称:rucio,代码行数:33,代码来源:sync_user_gss_accounts.py


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