class Covalence::StateStoreRepository

todo: monitor behavior forking to determine when the split the class

Public Class Methods

query_by_stack_name(data_store, stack_name, stack_workspace, tool) click to toggle source
# File lib/covalence/core/repositories/state_store_repository.rb, line 8
def query_by_stack_name(data_store, stack_name, stack_workspace, tool)
  if tool == 'terraform'
    query_tool_by_stack_name(data_store, stack_name, stack_workspace)
  else
    return nil
  end
end

Private Class Methods

query_tool_by_stack_name(data_store, stack_name, stack_workspace) click to toggle source
# File lib/covalence/core/repositories/state_store_repository.rb, line 18
def query_tool_by_stack_name(data_store, stack_name, stack_workspace)
  stores = data_store.lookup("#{stack_name}::state", [])
  raise "State store array cannot be empty" if stores.blank?
  stores.map do |store|
    StateStore.new(
      backend: store.keys.first,
      params: store.values.first,
      workspace_enabled: !stack_workspace.empty?
    )
  end
end