Sha256: 5ec61d68789a3fbfbb4ed01061e5c6e4e98f061dac36c1553562fbec289e787d
Contents?: true
Size: 1.3 KB
Versions: 1
Compression:
Stored size: 1.3 KB
Contents
# Copyright 2013 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. require "log4r" module VagrantPlugins module Google module Action # This terminates the running instance. class TerminateInstance def initialize(app, env) @app = app @logger = Log4r::Logger.new("vagrant_google::action::terminate_instance") end def call(env) server = env[:google_compute].servers.get(env[:machine].id, env[:machine].provider_config.zone) # Destroy the server and remove the tracking ID env[:ui].info(I18n.t("vagrant_google.terminating")) server.destroy if not server.nil? server.wait_for { not ready? } env[:machine].id = nil @app.call(env) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tcr-vagrant-google-0.1.4 | lib/vagrant-google/action/terminate_instance.rb |