Sha256: f922813a9197cf581613e435cbb83736fa69fe96b588abfcf2df1b5e271afa04
Contents?: true
Size: 1.25 KB
Versions: 1
Compression:
Stored size: 1.25 KB
Contents
require 'open3' module OpenStax::Aws class Packer_1_2_5 def initialize(absolute_file_path:, dry_run: true) @logger = OpenStax::Aws.configuration.logger @only = [] @vars = {} @dry_run = dry_run @verbose = false @debug = false @absolute_file_path = absolute_file_path end def only(builders) @only = [builders].flatten end def var(key, value) @vars[key.to_s] = value.to_s end def verbose! @verbose = true end def debug! @debug = true end def command cmd = "packer build --only=amazon-ebs" cmd = "#{cmd} --only=#{@only.join(',')}" if !@only.empty? @vars.each do |key, value| cmd = "#{cmd} --var '#{key}=#{value}'" end cmd = "PACKER_LOG=1 #{cmd}" if @verbose cmd = "#{cmd} --debug" if @debug cmd = "#{cmd} #{@absolute_file_path}" end def run @logger.info("**** DRY RUN ****") if @dry_run @logger.info("Running: #{command}") if !@dry_run @logger.info("Printing stderr for desired verbosity") Open3.popen2e(command) do |stdin, stdout_err, wait_thr| while line=stdout_err.gets do puts(line) end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
openstax_aws-1.0.0 | lib/openstax/aws/packer_1_2_5.rb |