Make V2 login errors more descriptive
If login fails, we now call validate again to get the reason for the failure, and then surface it to the user of the CLI. This allows for more actionable responses, such as: $ docker login 10.0.2.2:5000 Username (devtable): devtable Password: Error response from daemon: Get http://10.0.2.2:5000/v2/: unauthorized: Client login with unencrypted passwords is disabled. Please generate an encrypted password in the user admin panel for use here.
This commit is contained in:
parent
651666b60b
commit
95e1cf6673
2 changed files with 17 additions and 8 deletions
|
@ -146,3 +146,12 @@ class Unsupported(V2RegistryException):
|
|||
'The operation is unsupported.',
|
||||
detail,
|
||||
405)
|
||||
|
||||
|
||||
class InvalidLogin(V2RegistryException):
|
||||
def __init__(self, message=None):
|
||||
super(InvalidLogin, self).__init__('UNAUTHORIZED',
|
||||
message or 'Specified credentials are invalid',
|
||||
{},
|
||||
401)
|
||||
|
||||
|
|
Reference in a new issue