Sha256: 41b43ca53a0f5e480afd8b0e6f26f7485fbc4b461aa2d4450b887328b4dbdd5f
Contents?: true
Size: 1.08 KB
Versions: 15
Compression:
Stored size: 1.08 KB
Contents
require "log4r" require 'vagrant-skytap/environment_properties' require 'vagrant-skytap/vm_properties' module VagrantPlugins module Skytap module Action # This action reads the state of the machine and puts it in the # `:machine_state_id` key in the environment. class ReadState attr_reader :env def initialize(app, env) @app = app @env = env @logger = Log4r::Logger.new("vagrant_skytap::action::read_state") end def call(env) env[:machine_state_id] = read_state(env[:machine]) @app.call(env) end def read_state(machine) if VmProperties.read(machine.data_dir) if environment = env[:environment] environment.reload elsif props = API::Environment.properties(env) @logger.info("env[:environment] was not set!") end if vm = environment.try(:current_vm) return vm.runstate.to_sym end end :not_created end end end end end
Version data entries
15 entries across 15 versions & 1 rubygems