From 5535fc09c6fd1486d3a3b0e37335b0fe177c2745 Mon Sep 17 00:00:00 2001 From: Jeff Blaine Date: Thu, 25 Apr 2013 22:11:53 +0000 Subject: [PATCH] Intro .provision_on_start flag for ships Allows control over when the livery provisioning happens for ships. This was needed because sometimes we don't want to provision (Puppet) until all ships are up and we know their hostnames in AWS, etc. --- README.md | 1 + lib/blimpy/box.rb | 4 ++-- lib/blimpy/fleet.rb | 6 ++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 44f39c0..84e7b47 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,7 @@ Here's an example Blimpfile: ship.username = 'ubuntu' # [Optional] SSH username, defaults to "ubuntu" for AWS machines ship.flavor = 'm1.small' # [Optional] defaults to t1.micro ship.tags = {:mytag => 'somevalue'} # [Optional] + ship.provision_on_start = false # [Optional] defaults to true end end ``` diff --git a/lib/blimpy/box.rb b/lib/blimpy/box.rb index 72e5b5b..4214fec 100644 --- a/lib/blimpy/box.rb +++ b/lib/blimpy/box.rb @@ -14,7 +14,7 @@ module Blimpy attr_accessor :image_id, :flavor, :group, :ports attr_accessor :dns, :internal_dns attr_accessor :name, :tags, :fleet_id, :username, :ssh_port, :livery - + attr_accessor :provision_on_start def self.from_instance_id(an_id, data) return if data[:type].nil? @@ -33,6 +33,7 @@ module Blimpy end def initialize(server=nil) + @provision_on_start = true @livery = nil @group = nil @name = 'Unnamed Box' @@ -161,7 +162,6 @@ module Blimpy end end - def with_data(ship_id, data) data.each do |key, value| next if immutable_attributes.include? key.to_sym diff --git a/lib/blimpy/fleet.rb b/lib/blimpy/fleet.rb index 00e8ce3..1c572d8 100644 --- a/lib/blimpy/fleet.rb +++ b/lib/blimpy/fleet.rb @@ -124,8 +124,10 @@ module Blimpy print "\n" puts ">> #{host.name} online at: #{host.dns}" host.online! - host.bootstrap - puts + if host.provision_on_start + host.bootstrap + puts + end end save!