Compare commits
3 Commits
eea98ff8f6
...
ef8f5c357f
Author | SHA1 | Date | |
---|---|---|---|
ef8f5c357f | |||
a1a141c77e | |||
77b1539776 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -7,3 +7,4 @@ export/
|
|||||||
secrets/
|
secrets/
|
||||||
.rucksack
|
.rucksack
|
||||||
.rucksack.toc
|
.rucksack.toc
|
||||||
|
.faaso.yml
|
||||||
|
@ -10,7 +10,7 @@ module Faaso
|
|||||||
# In both cases stopped instances after the required
|
# In both cases stopped instances after the required
|
||||||
# scale is reached are deleted.
|
# scale is reached are deleted.
|
||||||
struct Scale
|
struct Scale
|
||||||
def local(options, name, scale) : Int32
|
def local(options, name : String, scale : Int) : Int32
|
||||||
funko = Funko::Funko.from_names([name])[0]
|
funko = Funko::Funko.from_names([name])[0]
|
||||||
# Asked about scale
|
# Asked about scale
|
||||||
if funko.image_history.empty?
|
if funko.image_history.empty?
|
||||||
@ -22,31 +22,23 @@ module Faaso
|
|||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
# Asked to set scale
|
# Asked to set scale
|
||||||
funko.scale(scale.as(String).to_i)
|
funko.scale(scale)
|
||||||
0
|
0
|
||||||
end
|
end
|
||||||
|
|
||||||
def remote(options, name, scale) : Int32
|
def remote(options, name : String, scale : Int) : Int32
|
||||||
user, password = Config.auth
|
user, password = Config.auth
|
||||||
Faaso.check_version
|
Faaso.check_version
|
||||||
if !scale
|
if !scale
|
||||||
Crest.get(
|
response = Crest.get(
|
||||||
"#{Config.server}funkos/#{name}/scale/", \
|
"#{Config.server}funkos/#{name}/scale/", \
|
||||||
user: user, password: password) do |response|
|
user: user, password: password)
|
||||||
loop do
|
Log.info { " => " + response.body }
|
||||||
Log.info { response.body_io.gets }
|
|
||||||
break if response.body_io.closed?
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
Crest.post(
|
response = Crest.post(
|
||||||
"#{Config.server}funkos/#{name}/scale/",
|
"#{Config.server}funkos/#{name}/scale/",
|
||||||
{"scale" => scale}, user: user, password: password) do |response|
|
{"scale" => scale}, user: user, password: password)
|
||||||
loop do
|
Log.info { " => " + response.body }
|
||||||
Log.info { response.body_io.gets }
|
|
||||||
break if response.body_io.closed?
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
0
|
0
|
||||||
rescue ex : Crest::InternalServerError
|
rescue ex : Crest::InternalServerError
|
||||||
@ -54,7 +46,7 @@ module Faaso
|
|||||||
1
|
1
|
||||||
end
|
end
|
||||||
|
|
||||||
def run(options, name, scale) : Int32
|
def run(options, name : String, scale : Int) : Int32
|
||||||
if options["--local"]
|
if options["--local"]
|
||||||
return local(options, name, scale)
|
return local(options, name, scale)
|
||||||
end
|
end
|
||||||
|
@ -51,7 +51,7 @@ when .fetch("login", false)
|
|||||||
when .fetch("new", false)
|
when .fetch("new", false)
|
||||||
status = Faaso::Commands::New.new.run(ans, ans["FOLDER"].as(Array(String))[0])
|
status = Faaso::Commands::New.new.run(ans, ans["FOLDER"].as(Array(String))[0])
|
||||||
when .fetch("scale", false)
|
when .fetch("scale", false)
|
||||||
status = Faaso::Commands::Scale.new.run(ans, ans["FUNKO"].as(String), ans["SCALE"])
|
status = Faaso::Commands::Scale.new.run(ans, ans["FUNKO"].as(String), ans["SCALE"].as(String).to_i)
|
||||||
when .fetch("secret", false)
|
when .fetch("secret", false)
|
||||||
status = Faaso::Commands::Secret.new.run(ans, ans["FUNKO"].as(String), ans["SECRET"].as(String))
|
status = Faaso::Commands::Secret.new.run(ans, ans["FUNKO"].as(String), ans["SECRET"].as(String))
|
||||||
when .fetch("status", false)
|
when .fetch("status", false)
|
||||||
|
Loading…
Reference in New Issue
Block a user