Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import requests

from azure.cli.core.commands import cli_command
from azure.cli.core._util import CLIError

from ._utils import (
get_registry_by_name,
Expand Down Expand Up @@ -51,7 +50,10 @@ def _validate_user_credentials(registry_name, path, resultIndex, username=None,

login_server = registry.properties.login_server

if username and password:
if username:
if not password:
import getpass
password = getpass.getpass('Password: ')
return _obtain_data_from_registry(login_server, path, resultIndex, username, password)

try:
Expand All @@ -60,7 +62,10 @@ def _validate_user_credentials(registry_name, path, resultIndex, username=None,
password = cred.pass_word
return _obtain_data_from_registry(login_server, path, resultIndex, username, password)
except: #pylint: disable=bare-except
raise CLIError('Login credentials cannot be obtained. Please enter username/password')
import getpass
username = input("Username: ")
password = getpass.getpass('Password: ')
return _obtain_data_from_registry(login_server, path, resultIndex, username, password)

def acr_repository_list(registry_name, username=None, password=None):
'''List repositories in a given container registry.
Expand Down