General rewrite to support scales different than 1
This commit is contained in:
parent
cec745039b
commit
e17f421b5e
@ -3,16 +3,18 @@ module Faaso
|
|||||||
struct Status
|
struct Status
|
||||||
def local(options, name)
|
def local(options, name)
|
||||||
funko = Funko::Funko.from_names([name])[0]
|
funko = Funko::Funko.from_names([name])[0]
|
||||||
Log.info { "Name: #{funko.name}" }
|
status = funko.docker_status
|
||||||
Log.info { "Scale: #{funko.scale}" }
|
|
||||||
containers = funko.containers
|
Log.info { "Name: #{status["name"]}" }
|
||||||
Log.info { "Containers: #{funko.containers.size}" }
|
Log.info { "Scale: #{status["scale"]}" }
|
||||||
containers.each do |container|
|
|
||||||
|
Log.info { "Containers: #{status["containers"].size}" }
|
||||||
|
status["containers"].each do |container|
|
||||||
Log.info { " #{container.@names[0]} #{container.status}" }
|
Log.info { " #{container.@names[0]} #{container.status}" }
|
||||||
end
|
end
|
||||||
images = funko.images
|
|
||||||
Log.info { "Images: #{images.size}" }
|
Log.info { "Images: #{status["images"].size}" }
|
||||||
images.each do |image|
|
status["images"].each do |image|
|
||||||
Log.info { " #{image.repo_tags} #{image.created}" }
|
Log.info { " #{image.repo_tags} #{image.created}" }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
11
src/funko.cr
11
src/funko.cr
@ -145,6 +145,7 @@ 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
|
||||||
@ -165,6 +166,16 @@ module Funko
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# A comprehensive status for the funko:
|
||||||
|
def docker_status
|
||||||
|
{
|
||||||
|
"name" => name,
|
||||||
|
"containers" => containers,
|
||||||
|
"images" => images,
|
||||||
|
"scale" => scale,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
# Descriptive status for the funko
|
# Descriptive status for the funko
|
||||||
def status
|
def status
|
||||||
status = self.containers.map { |container|
|
status = self.containers.map { |container|
|
||||||
|
Loading…
Reference in New Issue
Block a user