General rewrite to support scales different than 1

This commit is contained in:
Roberto Alsina 2024-07-03 15:00:06 -03:00
parent cec745039b
commit e17f421b5e
2 changed files with 21 additions and 8 deletions

View File

@ -3,16 +3,18 @@ module Faaso
struct Status
def local(options, name)
funko = Funko::Funko.from_names([name])[0]
Log.info { "Name: #{funko.name}" }
Log.info { "Scale: #{funko.scale}" }
containers = funko.containers
Log.info { "Containers: #{funko.containers.size}" }
containers.each do |container|
status = funko.docker_status
Log.info { "Name: #{status["name"]}" }
Log.info { "Scale: #{status["scale"]}" }
Log.info { "Containers: #{status["containers"].size}" }
status["containers"].each do |container|
Log.info { " #{container.@names[0]} #{container.status}" }
end
images = funko.images
Log.info { "Images: #{images.size}" }
images.each do |image|
Log.info { "Images: #{status["images"].size}" }
status["images"].each do |image|
Log.info { " #{image.repo_tags} #{image.created}" }
end
end

View File

@ -145,6 +145,7 @@ module Funko
end
# Return a list of image IDs for this funko, most recent first
# FIXME: use self.images and add filters
def image_history
docker_api = Docr::API.new(Docr::Client.new)
begin
@ -165,6 +166,16 @@ module Funko
}
end
# A comprehensive status for the funko:
def docker_status
{
"name" => name,
"containers" => containers,
"images" => images,
"scale" => scale,
}
end
# Descriptive status for the funko
def status
status = self.containers.map { |container|