lib/cloudstrap/bootstrap_agent.rb in cloudstrap-0.30.3.pre vs lib/cloudstrap/bootstrap_agent.rb in cloudstrap-0.30.11.pre
- old
+ new
@@ -2,16 +2,29 @@
require 'moneta'
require 'securerandom'
require_relative 'amazon'
require_relative 'config'
+require_relative 'errors'
require_relative 'hdp/bootstrap_properties'
require_relative 'ssh'
module StackatoLKG
class BootstrapAgent
include ::Contracts::Core
include ::Contracts::Builtin
+
+ Contract None => BootstrapAgent
+ def initialize
+ validate_configuration!
+ self
+ end
+
+ Contract None => Any
+ def validate_configuration! # TODO: Does this really belong in BootstrapAgent?
+ return if ec2.valid_region?(config.region)
+ raise ::Cloudstrap::ConfigurationError, "Region #{config.region} is not valid"
+ end
Contract None => String
def create_vpc
cache.store(:vpc_id, ec2.create_vpc.vpc_id).tap do |vpc_id|
ec2.assign_name(bootstrap_tag, vpc_id)