Module: TheseUtils

Defined in:
lib/pangea-orchestrator/cli.rb

Class Method Summary collapse

Class Method Details

.cfgObject



11
12
13
14
15
# File 'lib/pangea-orchestrator/cli.rb', line 11

def cfg
  @cfg ||= Pangea::Utils.symbolize(
    Pangea::Config.config
  )
end

.state_initObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/pangea-orchestrator/cli.rb', line 17

def state_init
  state = Pangea::S3State.new
  cfg[:namespaces].each_key do |nk|
    ns_config = cfg[:namespaces][nk]
    case ns_config[:state][:type].to_sym
    when :s3
      bucket_name     = ns_config[:state][:config][:bucket]
      region          = ns_config[:state][:config][:region]
      lock_table_name = ns_config[:state][:config][:lock]

      state.create_bucket(
        name: bucket_name,
        region: region
      )

      state.create_dynamodb_table_for_lock(
        name: lock_table_name,
        region: region
      )
    end
  end
end