You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by ja...@apache.org on 2018/08/08 02:58:46 UTC

[incubator-openwhisk-package-kafka] branch master updated: Remove required access to the whole couchdb database. (#274)

This is an automated email from the ASF dual-hosted git repository.

japetrsn pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-package-kafka.git


The following commit(s) were added to refs/heads/master by this push:
     new 457f76d  Remove required access to the whole couchdb database. (#274)
457f76d is described below

commit 457f76dbd930a573fcfb427890a6c84645c8b61a
Author: Christian Bickel <gi...@cbickel.de>
AuthorDate: Wed Aug 8 04:58:44 2018 +0200

    Remove required access to the whole couchdb database. (#274)
---
 provider/database.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/provider/database.py b/provider/database.py
index 817f3a7..bed6296 100644
--- a/provider/database.py
+++ b/provider/database.py
@@ -23,6 +23,7 @@ import os
 import time
 
 from cloudant.client import CouchDB
+from cloudant.client import CouchDatabase
 from cloudant.result import Result
 from datetime import datetime
 
@@ -46,12 +47,13 @@ class Database:
         self.client = CouchDB(self.username, self.password, url=self.url, timeout=timeout, auto_renew=True)
         self.client.connect()
 
-        if self.dbname in self.client.all_dbs():
+        self.database = CouchDatabase(self.client, self.dbname)
+
+        if self.database.exists():
             logging.info('Database exists - connecting to it.')
-            self.database = self.client[self.dbname]
         else:
             logging.warn('Database does not exist - creating it.')
-            self.database = self.client.create_database(self.dbname)
+            self.database.create()
 
     def destroy(self):
         if self.client is not None: