cleanup
This commit is contained in:
parent
3bcb427dd7
commit
99fa759880
@ -1,14 +1,15 @@
|
|||||||
module Faaso
|
module Faaso
|
||||||
module Commands
|
module Commands
|
||||||
# Bring up one or more funkos by name.
|
|
||||||
|
# Controls a funko's scale
|
||||||
#
|
#
|
||||||
# This doesn't guarantee that they will be running the latest
|
# Scale is how many instances are running.
|
||||||
# version, and it will try to recicle paused and exited containers.
|
|
||||||
#
|
#
|
||||||
# If there is no other way, it will create a brand new container with
|
# If it's increased, more instances are created.
|
||||||
# the latest known image and start it.
|
# It it's decreased, instances are destroyed.
|
||||||
#
|
#
|
||||||
# If there are no images for the funko, it will fail to bring it up.
|
# In both cases stopped instances after the required
|
||||||
|
# scale is reached are deleted.
|
||||||
struct Scale
|
struct Scale
|
||||||
def local(options, name, scale)
|
def local(options, name, scale)
|
||||||
funko = Funko::Funko.from_names([name])[0]
|
funko = Funko::Funko.from_names([name])[0]
|
||||||
@ -49,36 +50,6 @@ module Faaso
|
|||||||
return local(options, name, scale)
|
return local(options, name, scale)
|
||||||
end
|
end
|
||||||
remote(options, name, scale)
|
remote(options, name, scale)
|
||||||
|
|
||||||
# case self
|
|
||||||
# when .running?
|
|
||||||
# # If it's already up, do nothing
|
|
||||||
# # FIXME: bring back out-of-date warning
|
|
||||||
# Log.info { "#{funko.name} is already up" }
|
|
||||||
# when .paused?
|
|
||||||
# # If it is paused, unpause it
|
|
||||||
# Log.info { "Resuming existing paused container" }
|
|
||||||
# funko.unpause
|
|
||||||
# when .exited?
|
|
||||||
# Log.info { "Starting function #{funko.name}" }
|
|
||||||
# Log.info { "Restarting existing exited container" }
|
|
||||||
# funko.start
|
|
||||||
# else
|
|
||||||
# # Only have an image, deploy from scratch
|
|
||||||
# Faaso.setup_network # We need it
|
|
||||||
# Log.info { "Creating and starting new container" }
|
|
||||||
# funko.create_container(autostart: true)
|
|
||||||
|
|
||||||
# (1..5).each { |_|
|
|
||||||
# break if funko.running?
|
|
||||||
# sleep 0.1.seconds
|
|
||||||
# }
|
|
||||||
# if !funko.running?
|
|
||||||
# Log.warn { "Container for #{funko.name} is not running yet" }
|
|
||||||
# next
|
|
||||||
# end
|
|
||||||
# Log.info { "Container for #{funko.name} is running" }
|
|
||||||
# end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -39,7 +39,7 @@ FaaSO CLI tool.
|
|||||||
Usage:
|
Usage:
|
||||||
faaso build FOLDER ... [-v=<level>] [-l]
|
faaso build FOLDER ... [-v=<level>] [-l]
|
||||||
faaso scale FUNKO [SCALE] [-v=<level>] [-l]
|
faaso scale FUNKO [SCALE] [-v=<level>] [-l]
|
||||||
faaso status FUNKO_NAME [-v=<level>] [-l]
|
faaso status FUNKO [-v=<level>] [-l]
|
||||||
faaso export SOURCE DESTINATION [-v=<level>]
|
faaso export SOURCE DESTINATION [-v=<level>]
|
||||||
faaso secret [-d|-a] FUNKO SECRET [-v=<level>] [-l]
|
faaso secret [-d|-a] FUNKO SECRET [-v=<level>] [-l]
|
||||||
|
|
||||||
@ -53,8 +53,8 @@ Options:
|
|||||||
DOC
|
DOC
|
||||||
|
|
||||||
ans = Docopt.docopt(doc, ARGV)
|
ans = Docopt.docopt(doc, ARGV)
|
||||||
pp! ans
|
|
||||||
LogFormat.setup(ans["-v"].to_s.to_i)
|
LogFormat.setup(ans["-v"].to_s.to_i)
|
||||||
|
Log.debug {ans}
|
||||||
|
|
||||||
case ans
|
case ans
|
||||||
when .fetch("build", false)
|
when .fetch("build", false)
|
||||||
@ -62,9 +62,9 @@ when .fetch("build", false)
|
|||||||
when .fetch("export", false)
|
when .fetch("export", false)
|
||||||
Faaso::Commands::Export.new.run(ans, ans["SOURCE"].as(String), ans["DESTINATION"].as(String))
|
Faaso::Commands::Export.new.run(ans, ans["SOURCE"].as(String), ans["DESTINATION"].as(String))
|
||||||
when .fetch("scale", false)
|
when .fetch("scale", false)
|
||||||
Faaso::Commands::Scale.new.run(ans, ans["FUNKO_NAME"].as(String), ans["SCALE"])
|
Faaso::Commands::Scale.new.run(ans, ans["FUNKO"].as(String), ans["SCALE"])
|
||||||
when .fetch("status", false)
|
when .fetch("status", false)
|
||||||
Faaso::Commands::Status.new.run(ans, ans["FUNKO_NAME"].as(String))
|
Faaso::Commands::Status.new.run(ans, ans["FUNKO"].as(String))
|
||||||
when .fetch("secret", false)
|
when .fetch("secret", false)
|
||||||
Faaso::Commands::Secret.new.run(ans, ans["FUNKO"].as(String), ans["SECRET"].as(String))
|
Faaso::Commands::Secret.new.run(ans, ans["FUNKO"].as(String), ans["SECRET"].as(String))
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user