Exemplo n.º 1
0
def DockerLogin(server, username, access_token):
    """Register the username / token for the given server on Docker's keyring."""

    # Sanitize and normalize the server input.
    parsed_url = client_lib.GetNormalizedURL(server)

    server = parsed_url.geturl()

    # 'docker login' must be used due to the change introduced in
    # https://github.com/docker/docker/pull/20107 .
    docker_args = ['login']
    docker_args.append('--username='******'--password='******'Docker CLI operation failed:')
        log.out.Print(stdoutdata)
        log.status.Print(stderrdata)
        raise client_lib.DockerError('Docker login failed.')
Exemplo n.º 2
0
 def testGetDockerProcess(self):
     proc_result = client_lib.GetDockerProcess(['dummy_command'],
                                               stdin_file=sys.stdin,
                                               stdout_file=subprocess.PIPE,
                                               stderr_file=subprocess.PIPE)
     self.popen_mock.assert_called_once()
     self.assertEqual(proc_result.communicate(), ("'output'", "'error'"))