Project

General

Profile

Revision f02a9ce2

Added by Sebastian Gräßl over 5 years ago

Fixes #18733 - Prevent fallback to Docker Hub on registry search

When searching for an external registry the search would show
results from Docker Hub due to it searching via the compute
resource.

By using a registry parameter to indicate which search tab is
active this gets prevented on the backend as well as on the
client by not searching when no registry is selected.

View differences:

app/models/foreman_docker/docker.rb
61 61
      if exist?(image_name)
62 62
        tags_for_local_image(image(image_name))
63 63
      else
64
        # If image is not found in the compute resource, get the tags from the Hub
65
        hub_api_url = "https://index.docker.io/v1/repositories/#{image_name}/tags"
66
        JSON.parse(URI.parse(hub_api_url).read).map do |tag|
67
          tag['name']
68
        end
64
        Service::RegistryApi.docker_hub.tags(image_name).map { |tag| tag['name'] }
69 65
      end
70 66
    end
71 67

  

Also available in: Unified diff