diff options
author | Victor Shyba <victor.shyba@gmail.com> | 2015-10-27 13:30:07 -0300 |
---|---|---|
committer | Victor Shyba <victor.shyba@gmail.com> | 2015-10-29 16:50:01 -0300 |
commit | bc8e8bea61b01e0b93593e24a816574f5a19ac61 (patch) | |
tree | 4c6bc6273977faa3537b2cd88bd2f5ea810d9485 /common/src/leap | |
parent | 7c50a100a46c69f759dc22165cec9b8098cac3a4 (diff) |
[feat] adds --migrate-all to create-user-db script
This parameter applies the ensure_database to all existing databases,
making all of them use the latest design documents.
This can be used to migrate security documents, update handlers or any
other kind of design document.
Diffstat (limited to 'common/src/leap')
-rw-r--r-- | common/src/leap/soledad/common/couch.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/common/src/leap/soledad/common/couch.py b/common/src/leap/soledad/common/couch.py index c2809a47..ccedef15 100644 --- a/common/src/leap/soledad/common/couch.py +++ b/common/src/leap/soledad/common/couch.py @@ -70,6 +70,23 @@ logger = logging.getLogger(__name__) COUCH_TIMEOUT = 120 # timeout for transfers between Soledad server and Couch +def list_users_dbs(couch_url): + """ + Retrieves a list with all databases that starts with 'user-' on CouchDB. + Those databases belongs to users. So, the list will contain all the + database names in the form of 'user-{uuid4}'. + + :param couch_url: The couch url with needed credentials + :type couch_url: str + + :return: The list of all database names from users. + :rtype: [str] + """ + with couch_server(couch_url) as server: + users = [dbname for dbname in server if dbname.startswith('user-')] + return users + + class InvalidURLError(Exception): """ |