Exemplo n.º 1
0
def v2_support_enabled():
  docker_ver = docker_version(request.user_agent.string)

  # Check if our version is one of the blacklisted versions, if we can't
  # identify the version (None) we will fail open and assume that it is
  # newer and therefore should not be blacklisted.
  if docker_ver is not None and Spec(app.config['BLACKLIST_V2_SPEC']).match(docker_ver):
    abort(404)

  response = make_response('true', 200)

  if get_authenticated_context() is None:
    response = make_response('true', 401)

  response.headers.extend(get_auth_headers())
  return response
Exemplo n.º 2
0
def test_parsing(ua_string, ver_info):
    parsed_ver = docker_version(ua_string)
    assert parsed_ver == ver_info, "Expected %s, Found %s" % (ver_info,
                                                              parsed_ver)