summaryrefslogtreecommitdiff
path: root/manifests/create_db.pp
blob: abf5d694e9e5e2af03ee55584cbf559ecdb41002 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
define couchdb::create_db ( $host='127.0.0.1:5984',
                            $admins='{\'names\': [], \'roles\': [] }',
                            $readers='{\'names\': [], \'roles\': [] }') {

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

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

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

  #couchdb::update { "create_db_$name":
  #  db    => $name,
  #  id    => '',
  #  data  => ''
  #}

  #couchdb::update { "db_security_$name":
  #  db    => $name,
  #  id    => '_security',
  #  data => "{ \"admins\": $admins, \"readers\": $readers }"
  #}


}