Sha256: 64ee1ea302332fcb01ad53f3d79e04064bf19d7d1cb48b5939f0c8fcc53a6246
Contents?: true
Size: 1.23 KB
Versions: 4
Compression:
Stored size: 1.23 KB
Contents
require "log4r" module VagrantPlugins module Vmpooler module Action # This reboots a running server, if there is one. class TakeSnapshot def initialize(app, env) @app = app @logger = Log4r::Logger.new("vagrant_vmpooler::action::take_snapshot") end def call(env) if env[:machine].id env[:ui].info(I18n.t("vagrant_vmpooler.snapshoting_server")) # make api call to snapshot server provider_config = env[:machine].provider_config token = provider_config.token url = provider_config.url verbose = provider_config.verbose hostname = env[:machine].id begin response = Pooler.snapshot(verbose, url, hostname, token) if response['ok'] == false env[:ui].info(I81n.t("vagrant_vmpooler.errors.failed_snapshot")) env[:ui].info(response) end rescue TokenError => e env[:ui].warn(I18n.t("vagrant_vmpooler.errors.no_token_error")) env[:ui].info(I81n.t("vagrant_vmpooler.errors.failed_snapshot")) end end @app.call(env) end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems