Compare commits
2 Commits
d0e2a1a494
...
eb6d63a533
Author | SHA1 | Date | |
---|---|---|---|
eb6d63a533 | |||
01a61a5b02 |
@ -91,8 +91,7 @@ module Funko
|
|||||||
end
|
end
|
||||||
|
|
||||||
if env.params.query.fetch("format", "json") == "html"
|
if env.params.query.fetch("format", "json") == "html"
|
||||||
render "src/views/funkos.ecr"
|
render "src/views/funkos.ecr" else
|
||||||
else
|
|
||||||
result.to_json
|
result.to_json
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
require "docr"
|
require "docr"
|
||||||
|
require "funko"
|
||||||
require "kemal"
|
require "kemal"
|
||||||
|
|
||||||
module Proxy
|
module Proxy
|
||||||
|
18
src/funko.cr
18
src/funko.cr
@ -166,7 +166,6 @@ module Funko
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Return a list of image IDs for this funko, most recent first
|
# Return a list of image IDs for this funko, most recent first
|
||||||
# FIXME: use self.images and add filters
|
|
||||||
def image_history
|
def image_history
|
||||||
docker_api = Docr::API.new(Docr::Client.new)
|
docker_api = Docr::API.new(Docr::Client.new)
|
||||||
begin
|
begin
|
||||||
@ -207,23 +206,6 @@ module Funko
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Start exited container with the newer image
|
|
||||||
# or unpause paused container
|
|
||||||
def start
|
|
||||||
if self.exited?
|
|
||||||
docker_api = Docr::API.new(Docr::Client.new)
|
|
||||||
images = self.image_history
|
|
||||||
exited = self.containers.select { |container|
|
|
||||||
container.@state == "exited"
|
|
||||||
}.sort! { |i, j|
|
|
||||||
(images.index(j.@image_id) || 9999) <=> (images.index(i.@image_id) || 9999)
|
|
||||||
}
|
|
||||||
docker_api.containers.restart(exited[0].@id) unless exited.empty?
|
|
||||||
elsif self.paused?
|
|
||||||
self.unpause
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Stop container with the newer image
|
# Stop container with the newer image
|
||||||
def stop
|
def stop
|
||||||
docker_api = Docr::API.new(Docr::Client.new)
|
docker_api = Docr::API.new(Docr::Client.new)
|
||||||
|
Loading…
Reference in New Issue
Block a user