Skip to content

Commit

Permalink
Support specifying a mirror for iso location.
Browse files Browse the repository at this point in the history
  • Loading branch information
Yvonne Lam authored and Seth Thomas committed Jul 9, 2015
1 parent d8d9841 commit e127f36
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion bin/bento
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ class Options
opts.on("-e BUILDS", "--except BUILDS", "Build all Packer builds except these") do |opt|
options.except = opt
end

opts.on("-m MIRROR", "--mirror MIRROR", "Look for isos at MIRROR") do |opt|
options.mirror = opt
end
},
argv: templates_argv_proc
},
Expand Down Expand Up @@ -178,14 +182,15 @@ class BuildRunner
include Common
include PackerExec

attr_reader :templates, :dry_run, :debug, :builds, :except, :build_timestamp
attr_reader :templates, :dry_run, :debug, :builds, :except, :mirror, :build_timestamp

def initialize(opts)
@templates = opts.templates
@dry_run = opts.dry_run
@debug = opts.debug
@builds = opts.builds
@except = opts.except
@mirror = opts.mirror
@build_timestamp = Time.now.gmtime.strftime("%Y%m%d%H%M%S")
end

Expand Down Expand Up @@ -217,6 +222,9 @@ class BuildRunner
cmd.insert(2, "-var-file=#{vars}") if File.exist?(vars)
cmd.insert(2, "-only=#{builds}") if builds
cmd.insert(2, "-except=#{except}") if except
# Build the command line in the correct order and without spaces as future input for the splat operator.
cmd.insert(2, "mirror=#{mirror}") if mirror
cmd.insert(2, "-var") if mirror
cmd.insert(2, "-debug") if debug
cmd.insert(0, "echo") if dry_run
cmd
Expand Down

0 comments on commit e127f36

Please sign in to comment.