• Sign in

Georg GH. Hopp / vagrant-lxd · Files

Dogs2 white

GitLab

  • Go to dashboard
  • Project
  • Activity
  • Files
  • Commits
  • Builds 0
  • Graphs
  • Milestones
  • Issues 0
  • Merge Requests 0
  • Labels
  • Wiki
  • Forks
  • Snippets
  • Network
  • vagrant-lxd
  • lib
  • vagrant
  • lxd
  • action
  • stop.rb
  • add basic stop and destroy action and provision in up
    ecd8be87
    Georg Hopp authored
    2017-05-09 08:33:44 +0200  
    Browse Files »
stop.rb 489 Bytes
Raw Blame History Permalink
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
module Vagrant
  module Lxd
    module Action
      class Stop
        def initialize(app, env)
          @app = app
          @logger = Log4r::Logger.new("vagrant::lxd::action::stop")
        end

        def call(env)
          driver = env[:machine].provider.driver

          if driver.container?
            if driver.state == :running
              driver.stop
            end
          end

          @app.call(env)
        end
      end
    end
  end
end

# vim: set et ts=2 sw=2: