Beispiel #1
0
 def update_uwsgi(signum):
     flatpages_root = app.config["FLATPAGES_ROOT"]
     logger.debug("Udpating git repository at %s", flatpages_root)
     hasToReload = update_repo(flatpages_root)
     if hasToReload:
         logger.debug("Reloading flatpages…")
         uwsgi.reload()
Beispiel #2
0
 def update_uwsgi(signum):
     flatpages_root = app.config["FLATPAGES_ROOT"]
     logger.debug("Udpating git repository at %s", flatpages_root)
     hasToReload = update_repo(flatpages_root)
     if hasToReload:
         logger.debug("Reloading flatpages…")
         uwsgi.reload()
Beispiel #3
0
def content_hook():
    auth_key = current_app.config.get('GIT_UPDATE_HOOK_TOKEN')

    if not auth_key:
        # no key configured (default) → feature not enabled
        abort(404)

    key = request.args.get('token')
    if not key:
        logger.debug("`update-content` called without Token",
                     extra={'data': {'request_args': request.args}})
        abort(401)

    if key != auth_key:
        logger.warning("`update-content` called with wrong Token",
                       extra={'data': {'request_args': request.args,
                                       'auth_key': auth_key}})
        abort(403)

    logger.info("Update hook triggered. Fetching content.")
    reload_necessary = update_repo(current_app.config['FLATPAGES_ROOT'])
    if reload_necessary:
        try:
            import uwsgi
        except ImportError:
            logger.debug("UWSGI not present, skipping reload")
            pass
        else:
            logger.debug("Reloading UWSGI...")
            uwsgi.reload()

    # 204: No content
    # https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#204
    return "", 204
Beispiel #4
0
 def update_uwsgi(signum):
     flatpages_root = app.config["FLATPAGES_ROOT"]
     logger.debug("Updating git repository at %s", flatpages_root)
     hasToReload = update_repo(flatpages_root)
     if hasToReload:
         logger.debug("Reloading flatpages and uwsgi", extra={'data': {
             'uwsgi.numproc': uwsgi.numproc,
             'uwsgi.opt': uwsgi.opt,
             'uwsgi.applications': uwsgi.applications,
         }})
         uwsgi.reload()
Beispiel #5
0
 def update_uwsgi(signum):
     flatpages_root = app.config["FLATPAGES_ROOT"]
     logger.debug("Udpating git repository at %s", flatpages_root)
     hasToReload = update_repo(flatpages_root)
     if hasToReload:
         logger.debug("Reloading flatpages and uwsgi", extra={'data': {
             'uwsgi.numproc': uwsgi.numproc,
             'uwsgi.opt': uwsgi.opt,
             'uwsgi.applications': uwsgi.applications,
         }})
         uwsgi.reload()
Beispiel #6
0
 def update_uwsgi(signum):
     hasToReload = update_repo(app.config["FLATPAGES_ROOT"])
     if hasToReload:
         uwsgi.reload
Beispiel #7
0
 def update_uwsgi(signum):
     hasToReload = update_repo(app.config["FLATPAGES_ROOT"])
     if hasToReload:
         uwsgi.reload
Beispiel #8
0
 def update_repo(self):
     update_repo(self.cloned_repo_path)