Class: Opsup::App
Constant Summary collapse
- AVAILABLE_COMMANDS =
T.let( %w[ update_cookbooks setup configure deploy ].freeze, T::Array[String], )
Class Method Summary collapse
Instance Method Summary collapse
- #available_commands ⇒ Object
-
#initialize(logger:) ⇒ App
constructor
A new instance of App.
- #run(commands, config) ⇒ Object
Constructor Details
#initialize(logger:) ⇒ App
Returns a new instance of App.
18 19 20 |
# File 'lib/opsup/app.rb', line 18 def initialize(logger:) @logger = T.let(logger, ::Logger) end |
Class Method Details
.create ⇒ Object
11 12 13 14 15 |
# File 'lib/opsup/app.rb', line 11 def self.create new( logger: Opsup::Logger.instance, ) end |
Instance Method Details
#available_commands ⇒ Object
33 34 35 |
# File 'lib/opsup/app.rb', line 33 def available_commands AVAILABLE_COMMANDS end |
#run(commands, config) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/opsup/app.rb', line 38 def run(commands, config) validate_commands(commands) @logger.warn('Started in DRYRUN MODE') if config.dryrun @logger.debug("Running #{commands} with #{config.to_h}") opsworks = new_opsworks_client(config) opsworks_commands = commands.map { |c| command_to_opsworks_command(c) } stack_operator = Opsup::StackOperator.create(opsworks: opsworks) stack_operator.run_commands( opsworks_commands, stack_name: config.stack_name, mode: config.running_mode, dryrun: config.dryrun, ) ensure @logger.warn('Finished in DRYRUN MODE') if config.dryrun end |