Better detection of possible funkos
This commit is contained in:
parent
7e23ce995b
commit
91466db97e
@ -1,15 +1,16 @@
|
|||||||
# This configuration file was generated by `ameba --gen-config`
|
# This configuration file was generated by `ameba --gen-config`
|
||||||
# on 2024-07-02 16:33:24 UTC using Ameba version 1.6.1.
|
# on 2024-07-02 22:36:34 UTC using Ameba version 1.6.1.
|
||||||
# The point is for the user to remove these configuration records
|
# The point is for the user to remove these configuration records
|
||||||
# one by one as the reported problems are removed from the code base.
|
# one by one as the reported problems are removed from the code base.
|
||||||
|
|
||||||
# Problems found: 11
|
# Problems found: 12
|
||||||
# Run `ameba --only Documentation/DocumentationAdmonition` for details
|
# Run `ameba --only Documentation/DocumentationAdmonition` for details
|
||||||
Documentation/DocumentationAdmonition:
|
Documentation/DocumentationAdmonition:
|
||||||
Description: Reports documentation admonitions
|
Description: Reports documentation admonitions
|
||||||
Timezone: UTC
|
Timezone: UTC
|
||||||
Excluded:
|
Excluded:
|
||||||
- src/faaso.cr
|
- src/faaso.cr
|
||||||
|
- src/secrets.cr
|
||||||
- src/daemon/main.cr
|
- src/daemon/main.cr
|
||||||
- src/daemon/secrets.cr
|
- src/daemon/secrets.cr
|
||||||
- src/funko.cr
|
- src/funko.cr
|
||||||
@ -29,7 +30,7 @@ Naming/BlockParameterName:
|
|||||||
AllowNamesEndingInNumbers: true
|
AllowNamesEndingInNumbers: true
|
||||||
Excluded:
|
Excluded:
|
||||||
- src/faaso.cr
|
- src/faaso.cr
|
||||||
- src/daemon/funkos.cr
|
- src/daemon/funko.cr
|
||||||
AllowedNames:
|
AllowedNames:
|
||||||
- _
|
- _
|
||||||
- e
|
- e
|
||||||
|
17
src/funko.cr
17
src/funko.cr
@ -72,18 +72,25 @@ module Funko
|
|||||||
def self.from_docker : Array(Funko)
|
def self.from_docker : Array(Funko)
|
||||||
docker_api = Docr::API.new(Docr::Client.new)
|
docker_api = Docr::API.new(Docr::Client.new)
|
||||||
names = [] of String
|
names = [] of String
|
||||||
funko_containers = docker_api.containers.list(
|
|
||||||
|
# Get all containers that look like funkos
|
||||||
|
docker_api.containers.list(
|
||||||
all: true,
|
all: true,
|
||||||
).each { |container|
|
).each { |container|
|
||||||
p! container.@names
|
|
||||||
container.@names.each { |name|
|
container.@names.each { |name|
|
||||||
names << name.split("-", 2)[1].lstrip("/") if name.starts_with?("/faaso-")
|
names << name.split("-", 2)[1].lstrip("/") if name.starts_with?("/faaso-")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pp! names
|
# Now get all images that look like funkos, since
|
||||||
|
# we can start them just fine.
|
||||||
from_names(names.to_a.sort!)
|
docker_api.images.list.each { |image|
|
||||||
|
next if image.@repo_tags.nil?
|
||||||
|
image.@repo_tags.as(Array(String)).each { |tag|
|
||||||
|
names << tag.split("-", 2)[1].split(":", 2)[0] if tag.starts_with?("faaso-")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
from_names(names.to_set.to_a.sort!)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Setup the target directory `path` with all the files needed
|
# Setup the target directory `path` with all the files needed
|
||||||
|
@ -1,8 +1,14 @@
|
|||||||
<%- result.each do |f| -%>
|
<%- result.each do |f| -%>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= f["name"] %></td>
|
<td><%= f["name"] %></td>
|
||||||
|
<%- if f["name"] == "proxy" -%>
|
||||||
|
<td>Running</td>
|
||||||
|
<%- else -%>
|
||||||
<td><%= f["status"] %></td>
|
<td><%= f["status"] %></td>
|
||||||
|
<%- end -%>
|
||||||
<td>
|
<td>
|
||||||
|
<%- if f["name"] == "proxy" -%>
|
||||||
|
<%- else -%>
|
||||||
<%- if f["state"] == "running" -%>
|
<%- if f["state"] == "running" -%>
|
||||||
<button disabled>Start</button>
|
<button disabled>Start</button>
|
||||||
<button>Pause</button>
|
<button>Pause</button>
|
||||||
@ -21,6 +27,7 @@
|
|||||||
<button disabled>Stop</button>
|
<button disabled>Stop</button>
|
||||||
<button disabled>Restart</button>
|
<button disabled>Restart</button>
|
||||||
<%- end -%>
|
<%- end -%>
|
||||||
|
<%- end -%>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<%- end -%>
|
<%- end -%>
|
||||||
|
Loading…
Reference in New Issue
Block a user