Class: Stemcell::CommandLine
- Inherits:
-
Object
- Object
- Stemcell::CommandLine
- Defined in:
- lib/stemcell/command_line.rb
Constant Summary collapse
- VERSION_STRING =
"Stemcell #{VERSION} (c) 2012-2016 Airbnb."
- BANNER_STRING =
"Launch instances from metadata stored in roles!\n" \ "Usage: stemcell [chef role] [options]"
- OPTION_PARSER_DEFAULTS =
{ 'non_interactive' => false, 'aws_creds' => 'default', 'ssh_user' => 'ubuntu' }
Instance Attribute Summary collapse
-
#chef_role ⇒ Object
readonly
Returns the value of attribute chef_role.
-
#chef_root ⇒ Object
readonly
Returns the value of attribute chef_root.
-
#launcher ⇒ Object
readonly
Returns the value of attribute launcher.
-
#showing_help ⇒ Object
readonly
Returns the value of attribute showing_help.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#chef_role ⇒ Object (readonly)
Returns the value of attribute chef_role.
9 10 11 |
# File 'lib/stemcell/command_line.rb', line 9 def chef_role @chef_role end |
#chef_root ⇒ Object (readonly)
Returns the value of attribute chef_root.
8 9 10 |
# File 'lib/stemcell/command_line.rb', line 8 def chef_root @chef_root end |
#launcher ⇒ Object (readonly)
Returns the value of attribute launcher.
6 7 8 |
# File 'lib/stemcell/command_line.rb', line 6 def launcher @launcher end |
#showing_help ⇒ Object (readonly)
Returns the value of attribute showing_help.
7 8 9 |
# File 'lib/stemcell/command_line.rb', line 7 def showing_help @showing_help end |
Class Method Details
.run! ⇒ Object
21 22 23 |
# File 'lib/stemcell/command_line.rb', line 21 def self.run! CommandLine.new.run! end |
Instance Method Details
#run! ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/stemcell/command_line.rb', line 25 def run! determine_root_and_showing_help initialize_launcher retrieve_defaults configure_option_parser = determine_role() print_usage_and_exit unless chef_role # If we didn't successfully initialize the launcher, we should exit. exit unless @launcher print_version display_chef_repo_warnings # Retrieve AWS credentials via the aws-creds gems (if available) awc_name = .delete('aws_creds') credentials = retrieve_credentials_from_awc(awc_name) .merge!(credentials) if credentials # Move launcher in the non-interactive mode (if requested) launcher.interactive = !.delete('non_interactive') instances = launch_instance(chef_role, ) tail_converge(instances, ) if ['tail'] puts "\nDone.\n".green end |