2013-03-11 03:08:28 +00:00
|
|
|
module Vagrant
|
|
|
|
module LXC
|
|
|
|
module Action
|
|
|
|
class ForcedHalt
|
|
|
|
def initialize(app, env)
|
|
|
|
@app = app
|
|
|
|
end
|
|
|
|
|
|
|
|
def call(env)
|
|
|
|
if env[:machine].provider.state.running?
|
|
|
|
env[:ui].info I18n.t("vagrant.actions.vm.halt.force")
|
2013-04-05 05:23:30 +00:00
|
|
|
# TODO: Driver#halt is kinda graceful as well, if it doesn't
|
2013-03-11 03:08:28 +00:00
|
|
|
# work we can issue a lxc-stop.
|
2013-04-05 05:23:30 +00:00
|
|
|
env[:machine].provider.driver.halt
|
2013-03-11 03:08:28 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
@app.call(env)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|