Skip to content

Commit

Permalink
allow -a option to register AMI from bake -p created snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
stonith committed Apr 28, 2016
1 parent 96bdd58 commit 6fb723b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/linecook/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ class Linecook::CLI < Thor
method_option :clean, type: :boolean, default: false, desc: 'Clean up all build artifacts', aliases: '-c'
method_option :build, type: :boolean, default: true, desc: 'Build the image', aliases: '-b'
method_option :snapshot, type: :boolean, default: false, desc: 'Snapshot the resulting build to create an image', aliases: '-s'
method_option :ami, type: :boolean, default: false, desc: 'Create an ami', aliases: '-a'
method_option :upload, type: :boolean, default: false, desc: 'Upload the resulting build. Implies --snapshot and --encrypt.', aliases: '-u'
method_option :package, type: :boolean, default: false, desc: 'Package the resulting image. Implies --upload, --snapshot and --encrypt.', aliases: '-p'
def bake
Expand Down
4 changes: 2 additions & 2 deletions lib/linecook/provisioner/manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ module Linecook
module Baker
extend self

def bake(name: nil, tag: nil, id: nil, snapshot: nil, upload: nil, package: nil, build: nil, keep: nil, clean: nil)
def bake(name: nil, tag: nil, id: nil, snapshot: nil, upload: nil, package: nil, build: nil, keep: nil, clean: nil, ami: nil)
build_agent = Linecook::Build.new(name, tag: tag, id: id, image: image(name))
resume = clean ? false : true
provider(name).provision(build_agent, name) if build
snapshot = build_agent.snapshot(save: true, resume: resume) if snapshot || upload || package
Linecook::ImageManager.upload(snapshot, type: build_agent.type) if upload || package
Linecook::Packager.package(snapshot, type: build_agent.type) if package
Linecook::Packager.package(snapshot, type: build_agent.type, ami: ami) if package
rescue => e
puts e.message
puts e.backtrace
Expand Down

0 comments on commit 6fb723b

Please sign in to comment.