Sha256: 249c091ee4e34efa447a6a13185e5078298b5d32803e5b9e2e03563ccc0f0362

Contents?: true

Size: 783 Bytes

Versions: 15

Compression:

Stored size: 783 Bytes

Contents

command :unship do |c|
  c.summary = 'Removes all Docker containers defined for the host in '#{Ops::CONTAINERS_DIR}/[host_name].yml'
  c.syntax = 'ops ship [host_name]'
  c.description = "Removes all Docker containers defined for the host in '#{Ops::CONTAINERS_DIR}/[host_name].yml"
  c.example "", 'ops unship example.com'
  c.action do |args, options|
    host = args[0]

    if host.include? "localhost"
      Docker::containers_for(host).each do |container_name, config|
        system "docker rm -f #{container_name}"
      end
    else
      user = Ops::get_user_for(host)

      Net::SSH.start(host, user) do |ssh|
        Docker::containers_for(host).each do |container_name, config|
          ssh.exec "docker rm -f #{container_name}"
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
open-dock-0.1.18 lib/open-dock/commands/unship_host.rb
open-dock-0.1.17 lib/open-dock/commands/unship_host.rb
open-dock-0.1.16 lib/open-dock/commands/unship_host.rb
open-dock-0.1.15 lib/open-dock/commands/unship_host.rb
open-dock-0.1.14 lib/open-dock/commands/unship_host.rb
open-dock-0.1.13 lib/open-dock/commands/unship_host.rb
open-dock-0.1.11 lib/open-dock/commands/unship_host.rb
open-dock-0.1.10 lib/open-dock/commands/unship_host.rb
open-dock-0.1.9 lib/open-dock/commands/unship_host.rb
open-dock-0.1.8 lib/open-dock/commands/unship_host.rb
open-dock-0.1.7 lib/open-dock/commands/unship_host.rb
open-dock-0.1.6 lib/open-dock/commands/unship_host.rb
open-dock-0.1.5 lib/open-dock/commands/unship_host.rb
open-dock-0.1.3 lib/open-dock/commands/unship_host.rb
open-dock-0.1.2 lib/open-dock/commands/unship_host.rb