Sha256: f56c3a3d09bfdfd6d76a992ff413c113fbfea45cac24df978e7b35894de911ec

Contents?: true

Size: 777 Bytes

Versions: 2

Compression:

Stored size: 777 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 == "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

2 entries across 2 versions & 1 rubygems

Version Path
open-dock-0.1.1 lib/open-dock/commands/unship_host.rb
open-dock-0.1.0 lib/open-dock/commands/unship_host.rb