Class: Vcloud::Launcher::Launch
- Inherits:
-
Object
- Object
- Vcloud::Launcher::Launch
- Defined in:
- lib/vcloud/launcher/launch.rb
Defined Under Namespace
Classes: MissingConfigurationError, MissingPreambleError
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
-
#initialize ⇒ Launch
constructor
A new instance of Launch.
- #run(config_file = nil, cli_options = {}) ⇒ Object
- #set_logging_level(cli_options) ⇒ Object
Constructor Details
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
8 9 10 |
# File 'lib/vcloud/launcher/launch.rb', line 8 def config @config end |
Instance Method Details
#run(config_file = nil, cli_options = {}) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/vcloud/launcher/launch.rb', line 14 def run(config_file = nil, = {}) set_logging_level() @config = @config_loader.load_config(config_file, Vcloud::Launcher::Schema::LAUNCHER_VAPPS) validate_config config[:vapps].each do |vapp_config| Vcloud::Core.logger.info("Provisioning vApp #{vapp_config[:name]}.") begin vapp = ::Vcloud::Launcher::VappOrchestrator.provision(vapp_config) #methadone sends option starting with 'no' as false. vapp.power_on unless ["dont-power-on"] Vcloud::Core.logger.info("Provisioned vApp #{vapp_config[:name]} successfully.") rescue RuntimeError => e Vcloud::Core.logger.error("Failure: Could not provision vApp: #{e.}") break unless ["continue-on-error"] end end end |
#set_logging_level(cli_options) ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'lib/vcloud/launcher/launch.rb', line 35 def set_logging_level() if [:verbose] Vcloud::Core.logger.level = Logger::DEBUG elsif [:quiet] Vcloud::Core.logger.level = Logger::ERROR else Vcloud::Core.logger.level = Logger::INFO end end |