Class: SwarmClusterCliOpe::Models::ComposeContainer
- Defined in:
- lib/swarm_cluster_cli_ope/models/compose_container.rb
Constant Summary
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Container
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Container
all, #config=, #copy_in, #copy_out, #exec, #mapped_volumes, #node, #node_id
Methods inherited from Base
#docker_command, #docker_inspect, #initialize
Methods included from LoggerConcern
Constructor Details
This class inherits a constructor from SwarmClusterCliOpe::Models::Base
Class Method Details
.find_by_service_name(service_name, stack_name: '') ⇒ SwarmClusterCliOpe::Models::ComposeContainer
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/swarm_cluster_cli_ope/models/compose_container.rb', line 6 def self.find_by_service_name(service_name, stack_name: '') # prima controlliamo se siamo con il vecchio sistema di docker-compose dove i nomi dei servizi venivano # costruiti con _ oppure se siamo nella nuova versione di docker compose dove c'è il - che fà da spaziatore res = nil ["_", "-"].each do |separatore| res = ShellCommandExecution.new("docker inspect #{[stack_name, service_name, "1"].compact.join(separatore)}").execute(allow_failure: true) break unless res.failed? end raise "Non siamo riusciti ad identificare il servizio in locale" if res.failed? self.new(JSON.parse(res.raw_result[:stdout]).first) end |
Instance Method Details
#mapped_uri_connection ⇒ Object
18 19 20 |
# File 'lib/swarm_cluster_cli_ope/models/compose_container.rb', line 18 def mapped_uri_connection nil end |