summaryrefslogtreecommitdiff
path: root/manifests/create_db.pp
blob: 112e09471dfe724491a5a134ee0bdfd8870add8e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
define couchdb::create_db ($host, 
                                $admins="{\"names\": [], \"roles\": [] }", 
                                $readers="{\"names\": [], \"roles\": [] }") {

  Site_couchdb::Query["create_db_$name"] -> Site_couchdb::Query["db_security_${name}"]

  site_couchdb::query { "create_db_$name":
    cmd  => 'PUT',
    host => $host,
    url  => $name,
  }

  site_couchdb::query { "db_security_${name}":
    cmd  => 'PUT',
    host => $host,
    url  => "$name/_security",
    data => "{ \"admins\": $admins, \"readers\": $readers }"
  }

}