Class: Kitsune::Kit::Workflows::InspectEnvironment
- Defined in:
- lib/kitsune/kit/workflows/inspect_environment.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(config:, provider:, state_store:, event_bus: Events::NullBus.new, clock: Clock.new) ⇒ InspectEnvironment
constructor
A new instance of InspectEnvironment.
Constructor Details
#initialize(config:, provider:, state_store:, event_bus: Events::NullBus.new, clock: Clock.new) ⇒ InspectEnvironment
Returns a new instance of InspectEnvironment.
21 22 23 24 25 |
# File 'lib/kitsune/kit/workflows/inspect_environment.rb', line 21 def initialize(config:, provider:, state_store:, event_bus: Events::NullBus.new, clock: Clock.new) super(config: config, event_bus: event_bus, clock: clock) @provider = provider @state_store = state_store end |
Instance Method Details
#call ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/kitsune/kit/workflows/inspect_environment.rb', line 27 def call started_at = monotonic_time emit("run_started", command: "inspect", environment: config.environment) state = @state_store.read(config.environment) server = @provider.find_server(name: config.server.name, tags: config.server.) value = EnvironmentStatus.new( environment: config.environment, server: server, managed_resources: state["resources"], last_operations: state["operations"].last(20) ) emit("run_finished", status: "success", duration_ms: elapsed_ms(started_at)) Result.success(value, metadata: { run_id: run_id }) end |