Class: VagrantPlugins::SoftLayer::Action::WaitForRebuild
- Inherits:
-
Object
- Object
- VagrantPlugins::SoftLayer::Action::WaitForRebuild
- Includes:
- Util::Warden
- Defined in:
- lib/vagrant-softlayer/action/wait_for_rebuild.rb
Overview
Waits until the new machine has been rebuilt.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ WaitForRebuild
constructor
A new instance of WaitForRebuild.
Methods included from Util::Warden
Constructor Details
#initialize(app, env) ⇒ WaitForRebuild
Returns a new instance of WaitForRebuild.
10 11 12 13 |
# File 'lib/vagrant-softlayer/action/wait_for_rebuild.rb', line 10 def initialize(app, env) @app = app @logger = Log4r::Logger.new("vagrant_softlayer::action::wait_for_rebuild") end |
Instance Method Details
#call(env) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/vagrant-softlayer/action/wait_for_rebuild.rb', line 15 def call(env) env[:ui].info I18n.t("vagrant_softlayer.vm.wait_for_rebuild") # 20 minutes timeout Timeout::timeout(1200) do @logger.debug("Checking if the instance has been rebuilt.") sl_warden do while env[:sl_machine].object_mask("activeTransactionCount").getObject["activeTransactionCount"] > 0 @logger.debug("The machine is still being rebuilt. Retrying in 10 seconds.") sleep 10 end end end env[:ui].info I18n.t("vagrant_softlayer.vm.rebuilt") @app.call(env) end |