Class: VagrantPlugins::OrbStack::Action::Create
- Inherits:
-
Object
- Object
- VagrantPlugins::OrbStack::Action::Create
- Defined in:
- lib/vagrant-orbstack/action/create.rb
Overview
Action middleware for creating and starting OrbStack machines
This middleware handles the machine creation lifecycle with full idempotency support. It checks the current machine state and:
- If running: does nothing (no-op)
- If stopped: starts the existing machine
- If not created: creates a new machine with unique name
After creation, persists machine metadata and invalidates state cache.
Instance Method Summary collapse
-
#call(env) ⇒ Object
Execute the middleware.
-
#initialize(app, _env) ⇒ Create
constructor
Initialize the middleware.
Constructor Details
#initialize(app, _env) ⇒ Create
Initialize the middleware.
33 34 35 |
# File 'lib/vagrant-orbstack/action/create.rb', line 33 def initialize(app, _env) @app = app end |
Instance Method Details
#call(env) ⇒ Object
Execute the middleware.
Implements idempotent machine creation:
- Query current state
- If running: no-op
- If stopped: start machine
- If not created: create new machine
- Persist metadata and invalidate cache
- Continue middleware chain
54 55 56 57 |
# File 'lib/vagrant-orbstack/action/create.rb', line 54 def call(env) handle_machine_state(env) @app.call(env) end |