Project

General

Profile

Revision 64f6a1f2

Added by Dmitri Dolguikh about 8 years ago

Fixes #8393: added support for basic auth for standalone registries

View differences:

app/controllers/image_search_controller.rb
46 46
  end
47 47

  
48 48
  def registry_image_exists?(term)
49
    result = ::Service::RegistryApi.new(:url => @registry.url).search(term)
49
    result = ::Service::RegistryApi.new(:url => @registry.url,
50
                                        :user => @registry.username,
51
                                        :password => @registry.password).search(term)
50 52
    registry_name = term.split('/').size > 1 ? term :
51 53
        'library/' + term
52 54
    result['results'].any? { |r| r['name'] == registry_name }
53 55
  end
54 56

  
55 57
  def registry_auto_complete_image_tags(terms)
56
    ::Service::RegistryApi.new(:url => @registry.url).list_repository_tags(terms).keys
58
    ::Service::RegistryApi.new(:url => @registry.url,
59
                               :user => @registry.username,
60
                               :password => @registry.password).list_repository_tags(terms).keys
57 61
  end
58 62

  
59 63
  def registry_search_image(terms)
60
    r = ::Service::RegistryApi.new(:url => @registry.url).search(terms)
64
    r = ::Service::RegistryApi.new(:url => @registry.url,
65
                                   :user => @registry.username,
66
                                   :password => @registry.password).search(terms)
61 67
    r['results']
62 68
  end
63 69

  

Also available in: Unified diff