Sha256: 2efc547363d298faa69d4c9bad11ba646db152240d0548f9da4e1d1d991d0d99
Contents?: true
Size: 1.33 KB
Versions: 7
Compression:
Stored size: 1.33 KB
Contents
require 'leeroy' require 'leeroy/task' require 'leeroy/helpers/aws' module Leeroy module Task class Terminate < Leeroy::Task::Base include Leeroy::Helpers::AWS def perform(args = self.args, options = self.options, global_options = self.global_options) begin super(args, options, global_options) # destroy instance terminated = destroyInstance instanceid = self.state.instanceid if terminated.include?(instanceid) # clean up semaphore if present semaphore = self.state.semaphore if semaphore.nil? # guess at semaphore from instance ID s3_object = buildS3ObjectName(instanceid, 'semaphores') bucket = checkEnv('LEEROY_S3_BUCKET') semaphore = Leeroy::Types::Semaphore.new(bucket: bucket, object: s3_object, payload: '') end unless semaphore.nil? logger.debug "clearing semaphore #{semaphore}" clearSemaphore(semaphore) end logger.debug "clearing instanceid #{instanceid} from state" self.state.instanceid = nil end dump_state logger.debug "done performing for #{self.class}" rescue StandardError => e raise e end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems