def add_account(account, type, email, session=None):
""" Add an account with the given account name and type.
:param account: the name of the new account.
:param type: the type of the new account.
:param email: The Email address associated with the account.
:param session: the database session in use.
"""
new_account = models.Account(account=account, account_type=type, email=email,
status=AccountStatus.ACTIVE)
try:
new_account.save(session=session)
except IntegrityError:
raise exception.Duplicate('Account ID \'%s\' already exists!' % account)
# Create the account counters for this account
rucio.core.account_counter.create_counters_for_new_account(account=account, session=session)
评论列表
文章目录