Class: VagrantPlugins::OrbStack::Action::Start
- Inherits:
-
Object
- Object
- VagrantPlugins::OrbStack::Action::Start
- Includes:
- MachineValidation
- Defined in:
- lib/vagrant-orbstack/action/start.rb
Overview
Action middleware for starting OrbStack machines
This middleware handles starting a stopped OrbStack machine. It calls the OrbStack CLI to start the machine and invalidates the provider's state cache to ensure subsequent state queries are fresh.
The OrbStack CLI is idempotent - starting an already running machine is safe and will not cause an error.
Instance Method Summary collapse
-
#call(env) ⇒ Object
Execute the middleware.
-
#initialize(app, _env) ⇒ Start
constructor
Initialize the middleware.
Methods included from MachineValidation
Constructor Details
#initialize(app, _env) ⇒ Start
Initialize the middleware.
32 33 34 |
# File 'lib/vagrant-orbstack/action/start.rb', line 32 def initialize(app, _env) @app = app end |
Instance Method Details
#call(env) ⇒ Object
Execute the middleware.
Starts the machine by calling OrbStack CLI start command, then invalidates the state cache to ensure fresh state queries.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/vagrant-orbstack/action/start.rb', line 47 def call(env) machine = env[:machine] ui = env[:ui] # Validate machine ID exists machine_id = validate_machine_id!(machine, 'start') ui.info("Starting machine '#{machine_id}'...") # Call OrbStack CLI to start the machine Util::OrbStackCLI.start_machine(machine_id) # Invalidate state cache to ensure fresh state on next query machine.provider.invalidate_state_cache # Continue middleware chain @app.call(env) end |