Use $QUAYPATH and $QUAYDIR in conf and init files

This commit is contained in:
Antoine Legrand 2017-02-02 00:17:25 +01:00 committed by Antoine Legrand
parent 334a08d90b
commit cdb3722c17
59 changed files with 341 additions and 225 deletions

View file

@ -32,6 +32,7 @@ from util.useremails import send_confirmation_email, send_recovery_email
from util.license import decode_license, LicenseDecodeError
from util.security.ssl import load_certificate, CertInvalidException
from util.config.validator import EXTRA_CA_DIRECTORY
from _init import ROOT_DIR
logger = logging.getLogger(__name__)
@ -179,7 +180,7 @@ class ChangeLog(ApiResource):
def get(self):
""" Returns the change log for this installation. """
if SuperUserPermission().can():
with open('CHANGELOG.md', 'r') as f:
with open(os.path.join(ROOT_DIR, 'CHANGELOG.md'), 'r') as f:
return {
'log': f.read()
}

View file

@ -13,7 +13,7 @@ from flask import make_response, render_template, request, abort, session
from flask_login import login_user
from flask_principal import identity_changed
import endpoints.decorated # Register the various exceptions via decorators.
import endpoints.decorated # Register the various exceptions via decorators.
import features
from app import app, oauth_apps, oauth_login, LoginWrappedDBUser, user_analytics, license_validator
@ -25,6 +25,7 @@ from util.names import parse_namespace_repository
from util.secscan import PRIORITY_LEVELS
from util.saas.useranalytics import build_error_callback
from util.timedeltastring import convert_to_timedelta
from _init import STATIC_DIR, __version__
logger = logging.getLogger(__name__)
@ -133,16 +134,9 @@ def list_files(path, extension):
# Remove the static/ prefix. It is added in the template.
return os.path.join(dp, f)[len('static/'):]
filepath = 'static/' + path
filepath = os.path.join('static/', path)
return [join_path(dp, f) for dp, dn, files in os.walk(filepath) for f in files if matches(f)]
@lru_cache(maxsize=1)
def _get_version_number():
try:
with open('CHANGELOG.md') as f:
return re.search('(v[0-9]+\.[0-9]+\.[0-9]+)', f.readline()).group(0)
except IOError:
return ''
def render_page_template(name, route_data=None, **kwargs):
debugging = app.config.get('DEBUGGING', False)
@ -188,7 +182,7 @@ def render_page_template(name, route_data=None, **kwargs):
version_number = ''
if not features.BILLING:
version_number = 'Quay %s' % _get_version_number()
version_number = 'Quay %s' % __version__
resp = make_response(render_template(name,
route_data=route_data,
@ -226,4 +220,3 @@ def render_page_template(name, route_data=None, **kwargs):
resp.headers['X-FRAME-OPTIONS'] = 'DENY'
return resp

View file

@ -1,3 +1,4 @@
import os
import json
import logging
@ -38,6 +39,8 @@ from util.saas.useranalytics import build_error_callback
from util.systemlogs import build_logs_archive
from util.useremails import send_email_changed
from util.registry.gzipinputstream import GzipInputStream
from _init import ROOT_DIR
PGP_KEY_MIMETYPE = 'application/pgp-keys'
@ -287,7 +290,7 @@ def dbrevision_health():
db_revision = result[0]
# Find the local revision from the file system.
with open('ALEMBIC_HEAD', 'r') as f:
with open(os.path.join(ROOT_DIR, 'ALEMBIC_HEAD'), 'r') as f:
local_revision = f.readline().split(' ')[0]
data = {