custom_compose.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:service-fabric-cli 作者: Azure 项目源码 文件源码
def repo_creds(username, encrypted_password, has_pass):
    """Get a representation of the container repository credentials"""
    from azure.servicefabric.models import RegistryCredential
    from getpass import getpass

    # Wonky since we allow empty string as an encrypted passphrase
    if not any([username, encrypted_password is not None, has_pass]):
        return None

    if (encrypted_password is not None) and (not username):
        raise CLIError('Missing container repository username')

    if has_pass and (not username):
        raise CLIError('Missing container repository username')

    if encrypted_password is not None:
        return RegistryCredential(registry_user_name=username,
                                  registry_password=encrypted_password,
                                  password_encrypted=True)
    elif has_pass:
        passphrase = getpass(prompt='Container repository password: ')
        return RegistryCredential(registry_user_name=username,
                                  registry_password=passphrase,
                                  password_encrypted=False)
    return RegistryCredential(registry_user_name=username)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号