Sha256: 35409b64062d45080fb1db43100f8f144945505aa8735e7a4a70f0944ea096b4

Contents?: true

Size: 939 Bytes

Versions: 7

Compression:

Stored size: 939 Bytes

Contents

module Landrush
  module Action
    class Teardown
      include Common

      def call(env)
        handle_action_stack(env) do
          teardown if enabled?
        end
      end

      def teardown
        teardown_machine_dns
        DependentVMs.remove(machine_hostname)

        if DependentVMs.none?
          teardown_static_dns
          teardown_server
        end
      end

      def teardown_machine_dns
        if Store.hosts.has? machine_hostname
          info "removing machine entry: #{machine_hostname}"
          Store.hosts.delete(machine_hostname)
        end
      end

      def teardown_static_dns
        config.hosts.each do |static_hostname, _|
          if Store.hosts.has? static_hostname
            info "removing static entry: #{static_hostname}"
            Store.hosts.delete static_hostname
          end
        end
      end

      def teardown_server
        Server.stop
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
landrush-0.15.4 lib/landrush/action/teardown.rb
landrush-0.15.3 lib/landrush/action/teardown.rb
landrush-0.15.2 lib/landrush/action/teardown.rb
landrush-0.15.1 lib/landrush/action/teardown.rb
landrush-0.15.0 lib/landrush/action/teardown.rb
landrush-0.14.1 lib/landrush/action/teardown.rb
landrush-0.14.0 lib/landrush/action/teardown.rb