Browse Source

use absolute path for db file

master
Andrea Cimbalo 7 years ago
parent
commit
de48fcbba3
4 changed files with 15 additions and 24 deletions
  1. +0
    -22
      manager.py
  2. +3
    -1
      models/authority.py
  3. +3
    -1
      models/certificate.py
  4. +9
    -0
      models/customModel.py

+ 0
- 22
manager.py View File

@ -23,8 +23,6 @@ __doc__= """
Define classes to interact with certificate requests and Certification Authority
"""
db = SqliteDatabase(os.path.join(MANAGER_PATH, 'ca_manager.db'))
class CAManager(object):
"""
Middleware to interact with ssh-keygen
@ -37,10 +35,6 @@ class CAManager(object):
self.request = RequestLookup()
self.certificate = CertificateLookup()
@property
def db_path(self):
return os.path.join(self.path, 'ca_manager.db')
@property
def ssh_ca_dir(self):
return os.path.join(self.path, 'ssh_cas')
@ -72,22 +66,6 @@ def init_manager(paths):
if not os.path.exists(dirpath):
os.mkdir(dirpath)
# ensure the database exists
# in MANAGER_PATH and create the
# tables for Authority and Certificate
db.connect()
models_required = [
SSHAuthority,
SSLAuthority,
Certificate,
]
db.create_tables(
models_required,
safe = True,
)
def sign_request(ca_manager, request_id, authority_id):
authority, request = None, None


+ 3
- 1
models/authority.py View File

@ -6,13 +6,15 @@ from peewee import *
import os
import os.path
from models import customModel
from paths import *
__doc__= """
Module of base classes to handle authorities
"""
class Authority(Model):
class Authority(customModel.CustomModel):
request_allowed = []
# data stored in the database


+ 3
- 1
models/certificate.py View File

@ -6,11 +6,13 @@ from peewee import *
import os
import json
from models import customModel
from models.authority import Authority
from paths import *
class Certificate(Model):
class Certificate(customModel.CustomModel):
"""
"""


+ 9
- 0
models/customModel.py View File

@ -0,0 +1,9 @@
from paths import *
from peewee import *
import os
custom_db = SqliteDatabase(os.path.join(MANAGER_PATH, 'ca_manager.db'))
class CustomModel(Model):
class Meta:
database = custom_db

Loading…
Cancel
Save