Revision 329cfcba
Added by Sebastian Gräßl about 5 years ago
app/models/foreman_docker/docker.rb | ||
---|---|---|
42 | 42 |
::Docker::Image.all({ 'filter' => filter }, docker_connection) |
43 | 43 |
end |
44 | 44 |
|
45 |
def tags_for_local_image(image) |
|
46 |
image.info['RepoTags'].map do |image_tag| |
|
45 |
def tags_for_local_image(image, tag = nil)
|
|
46 |
result = image.info['RepoTags'].map do |image_tag|
|
|
47 | 47 |
_, tag = image_tag.split(':') |
48 | 48 |
tag |
49 | 49 |
end |
50 |
result = filter_tags(result, tag) if tag |
|
51 |
result |
|
50 | 52 |
end |
51 | 53 |
|
52 | 54 |
def exist?(name) |
... | ... | |
127 | 129 |
|
128 | 130 |
protected |
129 | 131 |
|
132 |
def filter_tags(result, query) |
|
133 |
result.select do |tag_name| |
|
134 |
tag_name['name'] =~ /^#{query}/ |
|
135 |
end |
|
136 |
end |
|
137 |
|
|
130 | 138 |
def docker_command |
131 | 139 |
yield |
132 | 140 |
rescue Excon::Errors::Error, ::Docker::Error::DockerError => e |
Also available in: Unified diff
Fixes #18902 - Enable autocomplete for container image search
This enables the autocomplete for the image name search and
improves the usability of searching for container images on
Docker Hub or an external Registry.