""" database updater """
# pylint: disable=E0401, C0413
import sys

sys.path.insert(0, '..')
sys.path.insert(1, '.')
import time  # nopep8
from acme_srv.helper import logger_setup, uts_to_date_utc  # nopep8
from acme_srv.housekeeping import Housekeeping  # nopep8

if __name__ == '__main__':

    DEBUG = True

    # initialize logger
    LOGGER = logger_setup(DEBUG)

    SUFFIX = uts_to_date_utc(int(time.time()), '%Y-%m-%d-%H%M%S')

    # this is just for testing
    # from shutil import copyfile
    # copyfile('db.sqlite3.old', 'db.sqlite3')
    # copyfile('acme_srv/acme_srv.db.old', 'acme_srv/acme_srv.db')

    with Housekeeping(DEBUG, LOGGER) as housekeeping:

        # certificate report in json format
        cert_report = housekeeping.certreport_get(
            report_name='certificate_report_{0}'.format(SUFFIX),
            report_format='json')
        # certificate report in csv format
#!/usr/bin/python3
# -*- coding: utf-8 -*-
""" CA handler for Microsoft Windows Client Certificate Enrollment Protocol (MS-WCCE) """
from __future__ import print_function
import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir, os.path.pardir)))
# pylint: disable=E0401, E0611, C0209, C0413
from acme_srv.helper import logger_setup  # nopep8
from examples.ca_handler.mswcce_ca_handler import CAhandler  # nopep8

if __name__ == '__main__':

    # initialize logger
    LOGGER = logger_setup(True)

    with CAhandler(True, LOGGER) as ca_handler:
        request = ca_handler.request_create()