Coverage for appr/models/kv/etcd/db.py: 74%

# Coverage for appr/models/kv/etcd/db.py : 74%

## 23 statements 17 run 6 missing 0 excluded

Hot-keys on this page

r m x p toggle line displays

j k next/prev highlighted chunk

0 (zero) top of page

1 (one) first highlighted chunk

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 | from __future__ import absolute_import, division, print_function import os import etcd import appr.models.kv from appr.exception import Forbidden from appr.models.db_base import ApprDB from appr.models.kv.etcd import etcd_client from appr.models.kv.etcd.blob import Blob from appr.models.kv.etcd.channel import Channel from appr.models.kv.etcd.package import Package class EtcdDB(ApprDB): Channel = Channel Package = Package Blob = Blob @classmethod def reset_db(cls, force=False): """ clean the database """ if os.getenv("APPR_DB_ALLOW_RESET", "false") == "true" or force: try: etcd_client.delete(appr.models.kv.APPR_KV_PREFIX, recursive=True) except etcd.EtcdKeyNotFound: pass else: raise Forbidden("Reset DB is deactivated") ApprDB = EtcdDB