if loc = Keep::Locator.parse(search_term)
loc.strip_hints!
coll_match = readable_by(*readers).where(portable_data_hash: loc.to_s).limit(1)
- return get_compatible_images(readers, pattern, coll_match)
+ if coll_match.any? or Rails.configuration.remote_hosts.length == 0
+ return get_compatible_images(readers, pattern, coll_match)
+ else
+ # Allow bare pdh that doesn't exist in the local database so
+ # that federated container requests which refer to remotely
+ # stored containers will validate.
+ return [Collection.new(portable_data_hash: loc.to_s)]
+ end
end
if search_tag.nil? and (n = search_term.index(":"))
def self.resolve_container_image(container_image)
coll = Collection.for_latest_docker_image(container_image)
if !coll
- if loc = Keep::Locator.parse(container_image)
- loc.strip_hints!
- if !Collection.readable_by(current_user).where(portable_data_hash: loc.to_s).any?
- # Allow bare pdh that doesn't exist in the local database so
- # that federated container requests which refer to remotely
- # stored containers will validate.
- return loc.to_s
- end
- end
raise ArvadosModel::UnresolvableContainerError.new "docker image #{container_image.inspect} not found"
end
coll.portable_data_hash
end
end
- ['ENOEXIST',
+ ['acbd18db4cc2f85cedef654fccc4a4d8+3',
+ 'ENOEXIST',
'arvados/apitestfixture:ENOEXIST',
].each do |img|
test "container_image_for_container(#{img.inspect}) => 422" do
end
end
+ test "allow unrecognized container when there are remote_hosts" do
+ set_user_from_auth :active
+ Rails.configuration.remote_hosts = {"foooo" => "bar.com"}
+ Container.resolve_container_image('acbd18db4cc2f85cedef654fccc4a4d8+3')
+ end
+
test "migrated docker image" do
Rails.configuration.docker_image_formats = ['v2']
add_docker19_migration_link