mirror of
https://github.com/laurivosandi/certidude
synced 2024-12-22 16:25:17 +00:00
api: bootstrap: drop usage of global authority import
This commit is contained in:
parent
863deafa59
commit
937c81bd5f
@ -9,7 +9,7 @@ import hashlib
|
||||
from datetime import datetime, timedelta
|
||||
from time import sleep
|
||||
from xattr import listxattr, getxattr
|
||||
from certidude import authority, mailer
|
||||
from certidude import mailer
|
||||
from certidude.auth import login_required, authorize_admin
|
||||
from certidude.user import User
|
||||
from certidude.decorators import serialize, csrf_protection
|
||||
@ -202,7 +202,7 @@ class NormalizeMiddleware(object):
|
||||
req.context["remote_addr"] = ipaddress.ip_address(req.access_route[0])
|
||||
|
||||
def certidude_app(log_handlers=[]):
|
||||
from certidude import config
|
||||
from certidude import authority, config
|
||||
from .signed import SignedCertificateDetailResource
|
||||
from .request import RequestListResource, RequestDetailResource
|
||||
from .lease import LeaseResource, LeaseDetailResource
|
||||
@ -242,7 +242,7 @@ def certidude_app(log_handlers=[]):
|
||||
app.add_route("/api/lease/", LeaseResource())
|
||||
|
||||
# Bootstrap resource
|
||||
app.add_route("/api/bootstrap/", BootstrapResource())
|
||||
app.add_route("/api/bootstrap/", BootstrapResource(authority))
|
||||
|
||||
# LEDE image builder resource
|
||||
app.add_route("/api/build/{profile}/{suggested_filename}", ImageBuilderResource())
|
||||
|
@ -1,14 +1,17 @@
|
||||
import logging
|
||||
from certidude.decorators import serialize
|
||||
from certidude.config import cp
|
||||
from certidude import authority, config, const
|
||||
from certidude import config, const
|
||||
from jinja2 import Template
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class BootstrapResource(object):
|
||||
def __init__(self, authority):
|
||||
self.authority = authority
|
||||
|
||||
def on_get(self, req, resp):
|
||||
resp.body = Template(open(config.BOOTSTRAP_TEMPLATE).read()).render(
|
||||
authority = const.FQDN,
|
||||
servers = authority.list_server_names())
|
||||
servers = self.authority.list_server_names())
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user