Class: App::Stacks
- Inherits:
-
Object
- Object
- App::Stacks
- Defined in:
- lib/core/stacks.rb
Constant Summary collapse
- SCHEMA_FILE =
"#{App::Opt::get_base_path}#{App::Opt::OPT_PATH}/awx/stacks-schema.yml"
- @@stacks =
nil
Class Method Summary collapse
-
.init(stacks) ⇒ Object
Takes a Hash that will have all the deployment info.
Class Method Details
.init(stacks) ⇒ Object
Takes a Hash that will have all the deployment info.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/core/stacks.rb', line 11 def self.init(stacks) raise RuntimeError, 'Cannot run App::Stacks::init() more than once.' unless @@stacks.nil? raise RuntimeError, "Need either a Local or S3Bucket key, found neither: #{stacks.keys}" unless stacks.has_key?('Local') || stacks.has_key?('S3Bucket') @@stacks = {} if stacks.has_key?('Local') source_file = File.(stacks['Local']['File']) # Throw error if source file doesn't exist. Blufin::Terminal::error("Cannot find source file: #{Blufin::Terminal::format_directory(source_file)}") unless Blufin::Files::file_exists(source_file) # Validate the source file against the expected schema. process_source_file(source_file) elsif stacks.has_key?('S3Bucket') # TODO - Finish this once we start running this on an EC2 instance (build/deploy server). # TODO - Whatever file we validate should be available on disk locally. # TODO - If the source is an S3 bucket, pull it down into a /tmp folder (on EC2 instance) and validate from there. end end |