class InfluxdbSetup::CreateDb

Public Instance Methods

call() click to toggle source
# File lib/influxdb_setup/create_db.rb, line 3
def call
  db = @config.db_name
  root = @config.build_client
  databases = root.list_databases.map { |row| row["name"] }

  unless databases.include?(db)
    root.create_database(db)
  else
    log "Influxdb database '#{db}' already exists"
  end
end